@equinor/esv-intersection 4.0.0 → 4.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/dist/components/axis.d.ts.map +1 -1
  2. package/dist/control/ExtendedCurveInterpolator.d.ts.map +1 -1
  3. package/dist/control/IntersectionReferenceSystem.d.ts.map +1 -1
  4. package/dist/control/LayerManager.d.ts.map +1 -1
  5. package/dist/control/MainController.d.ts.map +1 -1
  6. package/dist/control/ZoomPanHandler.d.ts.map +1 -1
  7. package/dist/control/overlay.d.ts.map +1 -1
  8. package/dist/datautils/colortable.d.ts.map +1 -1
  9. package/dist/datautils/findsample.d.ts.map +1 -1
  10. package/dist/datautils/picks.d.ts.map +1 -1
  11. package/dist/datautils/schematicShapeGenerator.d.ts +5 -5
  12. package/dist/datautils/schematicShapeGenerator.d.ts.map +1 -1
  13. package/dist/datautils/seismicimage.d.ts.map +1 -1
  14. package/dist/datautils/surfacedata.d.ts.map +1 -1
  15. package/dist/datautils/trajectory.d.ts.map +1 -1
  16. package/dist/index.cjs +1 -14
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.mjs +2168 -1290
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/index.umd.js +1 -14
  21. package/dist/index.umd.js.map +1 -1
  22. package/dist/layers/CalloutCanvasLayer.d.ts.map +1 -1
  23. package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +1 -1
  24. package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +1 -1
  25. package/dist/layers/GeomodelCanvasLayer.d.ts.map +1 -1
  26. package/dist/layers/GeomodelLabelsLayer.d.ts.map +1 -1
  27. package/dist/layers/GeomodelLayerV2.d.ts.map +1 -1
  28. package/dist/layers/GridLayer.d.ts.map +1 -1
  29. package/dist/layers/ImageCanvasLayer.d.ts.map +1 -1
  30. package/dist/layers/ReferenceLineLayer.d.ts.map +1 -1
  31. package/dist/layers/SchematicLayer.d.ts.map +1 -1
  32. package/dist/layers/WellborePathLayer.d.ts.map +1 -1
  33. package/dist/layers/base/CanvasLayer.d.ts.map +1 -1
  34. package/dist/layers/base/HTMLLayer.d.ts.map +1 -1
  35. package/dist/layers/base/Layer.d.ts.map +1 -1
  36. package/dist/layers/base/PixiLayer.d.ts.map +1 -1
  37. package/dist/layers/base/SVGLayer.d.ts.map +1 -1
  38. package/dist/layers/schematicInterfaces.d.ts.map +1 -1
  39. package/dist/utils/arc-length.d.ts.map +1 -1
  40. package/dist/utils/root-finder.d.ts.map +1 -1
  41. package/dist/utils/text.d.ts.map +1 -1
  42. package/dist/utils/vectorUtils.d.ts.map +1 -1
  43. package/dist/vendor/pixi-dashed-line/index.d.ts.map +1 -1
  44. package/package.json +15 -17
  45. package/src/components/axis.ts +40 -10
  46. package/src/control/ExtendedCurveInterpolator.ts +47 -9
  47. package/src/control/IntersectionReferenceSystem.ts +110 -30
  48. package/src/control/LayerManager.ts +76 -24
  49. package/src/control/MainController.ts +37 -8
  50. package/src/control/ZoomPanHandler.ts +76 -14
  51. package/src/control/overlay.ts +18 -6
  52. package/src/datautils/colortable.ts +7 -2
  53. package/src/datautils/findsample.ts +12 -2
  54. package/src/datautils/picks.ts +66 -18
  55. package/src/datautils/schematicShapeGenerator.ts +570 -146
  56. package/src/datautils/seismicimage.ts +36 -10
  57. package/src/datautils/surfacedata.ts +119 -40
  58. package/src/datautils/trajectory.ts +56 -17
  59. package/src/layers/CalloutCanvasLayer.ts +129 -26
  60. package/src/layers/CustomDisplayObjects/ComplexRope.ts +2 -1
  61. package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +5 -5
  62. package/src/layers/CustomDisplayObjects/UniformTextureStretchRope.ts +6 -2
  63. package/src/layers/GeomodelCanvasLayer.ts +10 -3
  64. package/src/layers/GeomodelLabelsLayer.ts +212 -87
  65. package/src/layers/GeomodelLayerV2.ts +8 -3
  66. package/src/layers/GridLayer.ts +14 -3
  67. package/src/layers/ImageCanvasLayer.ts +17 -3
  68. package/src/layers/ReferenceLineLayer.ts +31 -9
  69. package/src/layers/SchematicLayer.ts +499 -150
  70. package/src/layers/WellborePathLayer.ts +22 -7
  71. package/src/layers/base/CanvasLayer.ts +18 -4
  72. package/src/layers/base/HTMLLayer.ts +11 -3
  73. package/src/layers/base/Layer.ts +10 -2
  74. package/src/layers/base/PixiLayer.ts +27 -7
  75. package/src/layers/base/SVGLayer.ts +13 -3
  76. package/src/layers/schematicInterfaces.ts +16 -6
  77. package/src/utils/arc-length.ts +31 -5
  78. package/src/utils/root-finder.ts +32 -4
  79. package/src/utils/text.ts +34 -7
  80. package/src/utils/vectorUtils.ts +23 -6
  81. package/src/vendor/pixi-dashed-line/index.ts +66 -13
@@ -1,9 +1,22 @@
1
1
  import { max } from 'd3-array';
2
2
  import { scaleLinear, ScaleLinear } from 'd3-scale';
3
- import { Assets, Graphics, groupD8, Point, Rectangle, MeshRope, Texture } from 'pixi.js';
3
+ import {
4
+ Assets,
5
+ Graphics,
6
+ groupD8,
7
+ Point,
8
+ Rectangle,
9
+ MeshRope,
10
+ Texture,
11
+ } from 'pixi.js';
4
12
  import { DashLine } from '../vendor/pixi-dashed-line';
5
13
  import { LayerOptions, PixiLayer, PixiRenderApplication } from '.';
6
- import { DEFAULT_TEXTURE_SIZE, EXAGGERATED_DIAMETER, HOLE_OUTLINE, SCREEN_OUTLINE } from '../constants';
14
+ import {
15
+ DEFAULT_TEXTURE_SIZE,
16
+ EXAGGERATED_DIAMETER,
17
+ HOLE_OUTLINE,
18
+ SCREEN_OUTLINE,
19
+ } from '../constants';
7
20
  import {
8
21
  assertNever,
9
22
  Casing,
@@ -68,7 +81,10 @@ import {
68
81
  import { OnUpdateEvent, OnRescaleEvent, OnUnmountEvent } from '../interfaces';
69
82
  import { convertColor } from '../utils/color';
70
83
  import { createNormals, offsetPoint, offsetPoints } from '../utils/vectorUtils';
71
- import { ComplexRope, ComplexRopeSegment } from './CustomDisplayObjects/ComplexRope';
84
+ import {
85
+ ComplexRope,
86
+ ComplexRopeSegment,
87
+ } from './CustomDisplayObjects/ComplexRope';
72
88
  import { FixedWidthSimpleRope } from './CustomDisplayObjects/FixedWidthSimpleRope';
73
89
  import { UniformTextureStretchRope } from './CustomDisplayObjects/UniformTextureStretchRope';
74
90
 
@@ -98,10 +114,17 @@ interface CementSqueezeRenderObject {
98
114
  zIndex?: number;
99
115
  }
100
116
 
101
- type InterlacedRenderObjects = CasingRenderObject | CementRenderObject | CementSqueezeRenderObject;
117
+ type InterlacedRenderObjects =
118
+ | CasingRenderObject
119
+ | CementRenderObject
120
+ | CementSqueezeRenderObject;
102
121
 
103
122
  const foldInterlacedRenderObjects =
104
- <T>(fCasing: (obj: CasingRenderObject) => T, fCement: (obj: CementRenderObject) => T, fCementSqueeze: (obj: CementSqueezeRenderObject) => T) =>
123
+ <T>(
124
+ fCasing: (obj: CasingRenderObject) => T,
125
+ fCement: (obj: CementRenderObject) => T,
126
+ fCementSqueeze: (obj: CementSqueezeRenderObject) => T,
127
+ ) =>
105
128
  (renderObject: InterlacedRenderObjects): T => {
106
129
  switch (renderObject.kind) {
107
130
  case 'casing':
@@ -115,7 +138,9 @@ const foldInterlacedRenderObjects =
115
138
  }
116
139
  };
117
140
 
118
- export interface SchematicLayerOptions<T extends SchematicData> extends LayerOptions<T> {
141
+ export interface SchematicLayerOptions<
142
+ T extends SchematicData,
143
+ > extends LayerOptions<T> {
119
144
  exaggerationFactor?: number;
120
145
  internalLayerOptions?: InternalLayerOptions;
121
146
  holeOptions?: HoleOptions;
@@ -128,7 +153,9 @@ export interface SchematicLayerOptions<T extends SchematicData> extends LayerOpt
128
153
  perforationOptions?: PerforationOptions;
129
154
  }
130
155
 
131
- const defaultSchematicLayerOptions = (layerId: string): SchematicLayerOptions<SchematicData> => ({
156
+ const defaultSchematicLayerOptions = (
157
+ layerId: string,
158
+ ): SchematicLayerOptions<SchematicData> => ({
132
159
  exaggerationFactor: 2,
133
160
  internalLayerOptions: defaultInternalLayerOptions(layerId),
134
161
  holeOptions: defaultHoleOptions,
@@ -167,7 +194,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
167
194
  yScale: scaleLinear(),
168
195
  };
169
196
 
170
- constructor(ctx: PixiRenderApplication, id?: string, options?: SchematicLayerOptions<T>) {
197
+ constructor(
198
+ ctx: PixiRenderApplication,
199
+ id?: string,
200
+ options?: SchematicLayerOptions<T>,
201
+ ) {
171
202
  super(ctx, id, options);
172
203
  this.options = <SchematicLayerOptions<T>>{
173
204
  ...this.options,
@@ -196,13 +227,20 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
196
227
  public override async onRescale(event: OnRescaleEvent): Promise<void> {
197
228
  const shouldRecalculate = this.scalingFactors.zFactor !== event.zFactor;
198
229
 
199
- this.scalingFactors = { height: event.height, zFactor: event.zFactor, yScale: event.yScale };
230
+ this.scalingFactors = {
231
+ height: event.height,
232
+ zFactor: event.zFactor,
233
+ yScale: event.yScale,
234
+ };
200
235
  super.optionsRescale(event);
201
236
  const yRatio = this.yRatio();
202
237
  const flippedX = event.xBounds[0] > event.xBounds[1];
203
238
  const flippedY = event.yBounds[0] > event.yBounds[1];
204
239
  this.setContainerPosition(event.xScale(0), event.yScale(0));
205
- this.setContainerScale(event.xRatio * (flippedX ? -1 : 1), yRatio * (flippedY ? -1 : 1));
240
+ this.setContainerScale(
241
+ event.xRatio * (flippedX ? -1 : 1),
242
+ yRatio * (flippedY ? -1 : 1),
243
+ );
206
244
  if (shouldRecalculate) {
207
245
  this.clearLayer();
208
246
  await this.preRender();
@@ -218,12 +256,17 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
218
256
  }
219
257
 
220
258
  const { internalLayerOptions } = this.options as SchematicLayerOptions<T>;
221
- const entries = internalLayerOptions ? Object.entries(internalLayerOptions) : [];
222
- const entryFound = entries.find(([_key, id]: [string, string]) => id === layerId);
259
+ const entries = internalLayerOptions
260
+ ? Object.entries(internalLayerOptions)
261
+ : [];
262
+ const entryFound = entries.find(
263
+ ([_key, id]: [string, string]) => id === layerId,
264
+ );
223
265
  const keyFound = entryFound?.[0];
224
266
 
225
267
  if (keyFound) {
226
- this.internalLayerVisibility[keyFound as keyof InternalLayerVisibility] = isVisible;
268
+ this.internalLayerVisibility[keyFound as keyof InternalLayerVisibility] =
269
+ isVisible;
227
270
  this.clearLayer();
228
271
  await this.preRender();
229
272
  this.render();
@@ -244,14 +287,19 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
244
287
  const ySpan = domain[1] - domain[0];
245
288
  const baseYSpan = ySpan * this.scalingFactors.zFactor;
246
289
  const baseDomain: [number, number] = [domain[0], domain[0] + baseYSpan];
247
- return Math.abs(this.scalingFactors.height / (baseDomain[1] - baseDomain[0]));
290
+ return Math.abs(
291
+ this.scalingFactors.height / (baseDomain[1] - baseDomain[0]),
292
+ );
248
293
  }
249
294
 
250
- protected getZFactorScaledPathForPoints = (start: number, end: number): Point[] => {
295
+ protected getZFactorScaledPathForPoints = (
296
+ start: number,
297
+ end: number,
298
+ ): Point[] => {
251
299
  const y = (y: number): number => y * this.scalingFactors.zFactor;
252
300
 
253
301
  const path = this.referenceSystem?.getCurtainPath(start, end, true) ?? [];
254
- return path.map((p) => new Point(p.point[0], y(p.point[1]!)));
302
+ return path.map(p => new Point(p.point[0], y(p.point[1]!)));
255
303
  };
256
304
 
257
305
  protected drawBigPolygon = (coords: Point[], color = 0x000000) => {
@@ -267,7 +315,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
267
315
  return undefined;
268
316
  }
269
317
 
270
- const rope: MeshRope = new MeshRope({ texture, points: path, textureScale: 1 });
318
+ const rope: MeshRope = new MeshRope({
319
+ texture,
320
+ points: path,
321
+ textureScale: 1,
322
+ });
271
323
  rope.tint = tint || rope.tint;
272
324
  this.addChild(rope);
273
325
  }
@@ -289,7 +341,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
289
341
  outlineClosure: OutlineClosure = 'None',
290
342
  lineAlignment = 1,
291
343
  ): void {
292
- const leftPathReverse = leftPath.map<Point>((d) => d.clone()).reverse();
344
+ const leftPathReverse = leftPath.map<Point>(d => d.clone()).reverse();
293
345
 
294
346
  const startPointRight = rightPath[0]!;
295
347
  const startPointLeft = leftPathReverse[0]!;
@@ -308,7 +360,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
308
360
  line.lineTo(startPointRight.x, startPointRight.y);
309
361
  }
310
362
 
311
- line.stroke({ width: lineWidth, color: lineColor, alignment: lineAlignment });
363
+ line.stroke({
364
+ width: lineWidth,
365
+ color: lineColor,
366
+ alignment: lineAlignment,
367
+ });
312
368
 
313
369
  this.addChild(line);
314
370
  }
@@ -322,10 +378,18 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
322
378
  * @param lineWidth Width of line
323
379
  * @param lineAlignment alignment of the line to draw, (0 = inner, 0.5 = middle, 1 = outer).
324
380
  */
325
- protected drawCasingWindowOutline(leftPath: Point[], rightPath: Point[], { lineColor, windowOptions }: CasingOptions, lineWidth = 1): void {
381
+ protected drawCasingWindowOutline(
382
+ leftPath: Point[],
383
+ rightPath: Point[],
384
+ { lineColor, windowOptions }: CasingOptions,
385
+ lineWidth = 1,
386
+ ): void {
326
387
  // Correct the dashed path. Should always be displayed on the upper side of the wellbore path.
327
- const flippedPaths = !!this.referenceSystem?.options?.calculateDisplacementFromBottom;
328
- const [linePath, dashedPath] = flippedPaths ? [leftPath, rightPath] : [rightPath, leftPath];
388
+ const flippedPaths =
389
+ !!this.referenceSystem?.options?.calculateDisplacementFromBottom;
390
+ const [linePath, dashedPath] = flippedPaths
391
+ ? [leftPath, rightPath]
392
+ : [rightPath, leftPath];
329
393
  const [dashedAlignment, solidAlignment] = flippedPaths ? [1, 0] : [0, 1];
330
394
 
331
395
  const graphics = new Graphics();
@@ -333,7 +397,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
333
397
  const startPointLinePath = linePath[0]!;
334
398
  graphics.moveTo(startPointLinePath.x, startPointLinePath.y);
335
399
  linePath.forEach((p: Point) => graphics.lineTo(p.x, p.y));
336
- graphics.setStrokeStyle({ width: lineWidth, color: convertColor(lineColor), alignment: solidAlignment });
400
+ graphics.setStrokeStyle({
401
+ width: lineWidth,
402
+ color: convertColor(lineColor),
403
+ alignment: solidAlignment,
404
+ });
337
405
 
338
406
  const dashedLine = new DashLine(graphics, {
339
407
  dash: [windowOptions.dashLength, windowOptions.spaceLength],
@@ -351,7 +419,10 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
351
419
  this.addChild(graphics);
352
420
  }
353
421
 
354
- private perforationRopeAndTextureReferences: { rope: ComplexRope; texture: Texture }[] = [];
422
+ private perforationRopeAndTextureReferences: {
423
+ rope: ComplexRope;
424
+ texture: Texture;
425
+ }[] = [];
355
426
 
356
427
  public async preRender(): Promise<void> {
357
428
  if (!this.data || !this.referenceSystem) {
@@ -359,41 +430,77 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
359
430
  }
360
431
 
361
432
  const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
362
- const { holeSizes, casings, cements, completion, symbols, pAndA, perforations } = this.data;
433
+ const {
434
+ holeSizes,
435
+ casings,
436
+ cements,
437
+ completion,
438
+ symbols,
439
+ pAndA,
440
+ perforations,
441
+ } = this.data;
363
442
 
364
443
  await this.updateSymbolCache(symbols);
365
444
 
366
445
  holeSizes.sort((a: HoleSize, b: HoleSize) => b.diameter - a.diameter);
367
446
  const maxHoleDiameter =
368
- holeSizes.length > 0 ? (max(holeSizes, (d) => d.diameter) ?? 0) * exaggerationFactor : EXAGGERATED_DIAMETER * exaggerationFactor;
447
+ holeSizes.length > 0
448
+ ? (max(holeSizes, d => d.diameter) ?? 0) * exaggerationFactor
449
+ : EXAGGERATED_DIAMETER * exaggerationFactor;
369
450
  if (this.internalLayerVisibility.holeLayerId) {
370
- holeSizes.forEach((hole: HoleSize) => this.drawHoleSize(maxHoleDiameter, hole));
451
+ holeSizes.forEach((hole: HoleSize) =>
452
+ this.drawHoleSize(maxHoleDiameter, hole),
453
+ );
371
454
  }
372
455
 
373
456
  casings.sort((a: Casing, b: Casing) => b.diameter - a.diameter);
374
- const casingRenderObjects: CasingRenderObject[] = casings.map((casing: Casing) => this.createCasingRenderObject(casing));
457
+ const casingRenderObjects: CasingRenderObject[] = casings.map(
458
+ (casing: Casing) => this.createCasingRenderObject(casing),
459
+ );
375
460
 
376
461
  const cementShapes: CementRenderObject[] = cements.map(
377
462
  (cement: Cement): CementRenderObject => ({
378
463
  kind: 'cement',
379
- segments: createComplexRopeSegmentsForCement(cement, casings, completion, holeSizes, exaggerationFactor, this.getZFactorScaledPathForPoints),
380
- casingIds: (cement.referenceIds || []).filter((id) => id),
464
+ segments: createComplexRopeSegmentsForCement(
465
+ cement,
466
+ casings,
467
+ completion,
468
+ holeSizes,
469
+ exaggerationFactor,
470
+ this.getZFactorScaledPathForPoints,
471
+ ),
472
+ casingIds: (cement.referenceIds || []).filter(id => id),
381
473
  }),
382
474
  );
383
475
 
384
- const [cementSqueezes, remainingPAndA] = pAndA.reduce<[CementSqueeze[], Exclude<PAndA, CementSqueeze>[]]>(
476
+ const [cementSqueezes, remainingPAndA] = pAndA.reduce<
477
+ [CementSqueeze[], Exclude<PAndA, CementSqueeze>[]]
478
+ >(
385
479
  ([squeezes, remaining], current: PAndA) =>
386
- isCementSqueeze(current) ? [[current, ...squeezes], remaining] : [squeezes, [current, ...remaining]],
480
+ isCementSqueeze(current)
481
+ ? [[current, ...squeezes], remaining]
482
+ : [squeezes, [current, ...remaining]],
387
483
  [[], []],
388
484
  );
389
485
 
390
- const cementSqueezesShape: CementSqueezeRenderObject[] = cementSqueezes.map((squeeze) => ({
391
- kind: 'cementSqueeze',
392
- segments: this.createCementSqueezeShape(squeeze, casings, completion, holeSizes),
393
- casingIds: squeeze.referenceIds,
394
- }));
486
+ const cementSqueezesShape: CementSqueezeRenderObject[] = cementSqueezes.map(
487
+ squeeze => ({
488
+ kind: 'cementSqueeze',
489
+ segments: this.createCementSqueezeShape(
490
+ squeeze,
491
+ casings,
492
+ completion,
493
+ holeSizes,
494
+ ),
495
+ casingIds: squeeze.referenceIds,
496
+ }),
497
+ );
395
498
 
396
- this.sortCementAndCasingRenderObjects(casingRenderObjects, cementShapes, cementSqueezesShape).forEach(
499
+ this.sortCementAndCasingRenderObjects(
500
+ casingRenderObjects,
501
+ cementShapes,
502
+ cementSqueezesShape,
503
+ ).forEach(
397
504
  foldInterlacedRenderObjects(
398
505
  (casingRO: CasingRenderObject) => {
399
506
  if (this.internalLayerVisibility.casingLayerId) {
@@ -438,67 +545,119 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
438
545
  const packings = perforations.filter(hasPacking);
439
546
  const fracLines = perforations.filter(hasFracLines);
440
547
  const spikes = perforations.filter(hasSpikes);
441
- packings.forEach((perforation) => {
442
- const perfShapes = this.createPerforationShape(perforation, casings, holeSizes);
443
- const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } = perfShapes.reduce(
444
- (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
445
- if (!dict[ps.diameter]) {
446
- dict[ps.diameter] = [];
447
- }
448
- dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
449
- return dict;
548
+ packings.forEach(perforation => {
549
+ const perfShapes = this.createPerforationShape(
550
+ perforation,
551
+ casings,
552
+ holeSizes,
553
+ );
554
+ const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } =
555
+ perfShapes.reduce(
556
+ (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
557
+ if (!dict[ps.diameter]) {
558
+ dict[ps.diameter] = [];
559
+ }
560
+ dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
561
+ return dict;
562
+ },
563
+ {},
564
+ );
565
+ Object.values(perfShapesByDiameter).forEach(
566
+ perfShapesWithSameDiameter => {
567
+ const texture = createPerforationPackingTexture(
568
+ perforation,
569
+ perfShapesWithSameDiameter[0]!,
570
+ perforationOptions!,
571
+ );
572
+ const rope = this.drawComplexRope(
573
+ perfShapesWithSameDiameter,
574
+ texture,
575
+ );
576
+ rope &&
577
+ this.perforationRopeAndTextureReferences.push({ rope, texture });
450
578
  },
451
- {},
452
579
  );
453
- Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
454
- const texture = createPerforationPackingTexture(perforation, perfShapesWithSameDiameter[0]!, perforationOptions!);
455
- const rope = this.drawComplexRope(perfShapesWithSameDiameter, texture);
456
- rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
457
- });
458
580
  });
459
581
 
460
- spikes.forEach((perforation) => {
461
- const perfShapes = this.createPerforationShape(perforation, casings, holeSizes);
462
- const thiccPerfShapes = perfShapes.map((ps) => ({ ...ps, diameter: ps.diameter * 3 }));
463
- const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } = thiccPerfShapes.reduce(
464
- (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
465
- if (!dict[ps.diameter]) {
466
- dict[ps.diameter] = [];
467
- }
468
- dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
469
- return dict;
582
+ spikes.forEach(perforation => {
583
+ const perfShapes = this.createPerforationShape(
584
+ perforation,
585
+ casings,
586
+ holeSizes,
587
+ );
588
+ const thiccPerfShapes = perfShapes.map(ps => ({
589
+ ...ps,
590
+ diameter: ps.diameter * 3,
591
+ }));
592
+ const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } =
593
+ thiccPerfShapes.reduce(
594
+ (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
595
+ if (!dict[ps.diameter]) {
596
+ dict[ps.diameter] = [];
597
+ }
598
+ dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
599
+ return dict;
600
+ },
601
+ {},
602
+ );
603
+ Object.values(perfShapesByDiameter).forEach(
604
+ perfShapesWithSameDiameter => {
605
+ perfShapesWithSameDiameter.forEach(perfShape => {
606
+ const texture = createPerforationSpikeTexture(
607
+ perforation,
608
+ perforations,
609
+ perfShape,
610
+ perforationOptions!,
611
+ );
612
+ const rope = this.drawComplexRope([perfShape], texture);
613
+ rope &&
614
+ this.perforationRopeAndTextureReferences.push({
615
+ rope,
616
+ texture,
617
+ });
618
+ });
470
619
  },
471
- {},
472
620
  );
473
- Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
474
- perfShapesWithSameDiameter.forEach((perfShape) => {
475
- const texture = createPerforationSpikeTexture(perforation, perforations, perfShape, perforationOptions!);
476
- const rope = this.drawComplexRope([perfShape], texture);
477
- rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
478
- });
479
- });
480
621
  });
481
622
 
482
- fracLines.forEach((perforation) => {
483
- const perfShapes = this.createPerforationShape(perforation, casings, holeSizes);
484
- const thiccPerfShapes = perfShapes.map((ps) => ({ ...ps, diameter: ps.diameter * 3 }));
485
- const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } = thiccPerfShapes.reduce(
486
- (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
487
- if (!dict[ps.diameter]) {
488
- dict[ps.diameter] = [];
489
- }
490
- dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
491
- return dict;
623
+ fracLines.forEach(perforation => {
624
+ const perfShapes = this.createPerforationShape(
625
+ perforation,
626
+ casings,
627
+ holeSizes,
628
+ );
629
+ const thiccPerfShapes = perfShapes.map(ps => ({
630
+ ...ps,
631
+ diameter: ps.diameter * 3,
632
+ }));
633
+ const perfShapesByDiameter: { [key: number]: ComplexRopeSegment[] } =
634
+ thiccPerfShapes.reduce(
635
+ (dict: { [key: number]: ComplexRopeSegment[] }, ps) => {
636
+ if (!dict[ps.diameter]) {
637
+ dict[ps.diameter] = [];
638
+ }
639
+ dict[ps.diameter] = [...(dict[ps.diameter] ?? []), ps];
640
+ return dict;
641
+ },
642
+ {},
643
+ );
644
+ Object.values(perfShapesByDiameter).forEach(
645
+ perfShapesWithSameDiameter => {
646
+ perfShapesWithSameDiameter.forEach(perfShape => {
647
+ const texture = createPerforationFracLineTexture(
648
+ perforation,
649
+ perfShape,
650
+ perforationOptions!,
651
+ );
652
+ const rope = this.drawComplexRope([perfShape], texture);
653
+ rope &&
654
+ this.perforationRopeAndTextureReferences.push({
655
+ rope,
656
+ texture,
657
+ });
658
+ });
492
659
  },
493
- {},
494
660
  );
495
- Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
496
- perfShapesWithSameDiameter.forEach((perfShape) => {
497
- const texture = createPerforationFracLineTexture(perforation, perfShape, perforationOptions!);
498
- const rope = this.drawComplexRope([perfShape], texture);
499
- rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
500
- });
501
- });
502
661
  });
503
662
  }
504
663
 
@@ -516,7 +675,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
516
675
  }
517
676
 
518
677
  if (this.internalLayerVisibility.pAndALayerId) {
519
- remainingPAndA.forEach((obj) => {
678
+ remainingPAndA.forEach(obj => {
520
679
  if (isPAndASymbol(obj)) {
521
680
  const symbolRenderObject = this.prepareSymbolRenderObject(obj);
522
681
  this.drawSymbolComponent(symbolRenderObject);
@@ -537,16 +696,24 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
537
696
  }
538
697
 
539
698
  const existingKeys = Object.keys(this.textureSymbolCacheArray);
540
- const promises = Object.entries(symbols).map(async ([key, symbol]: [string, string]) => {
541
- if (!existingKeys.includes(key) && this.textureSymbolCacheArray) {
542
- this.textureSymbolCacheArray[key] = await Assets.load(symbol);
543
- }
544
- });
699
+ const promises = Object.entries(symbols).map(
700
+ async ([key, symbol]: [string, string]) => {
701
+ if (!existingKeys.includes(key) && this.textureSymbolCacheArray) {
702
+ this.textureSymbolCacheArray[key] = await Assets.load(symbol);
703
+ }
704
+ },
705
+ );
545
706
  await Promise.all(promises);
546
707
  }
547
708
 
548
- private drawCementPlug(cementPlug: CementPlug, casings: Casing[], completion: Completion[], holes: HoleSize[]) {
549
- const { exaggerationFactor = 1, cementPlugOptions } = this.options as SchematicLayerOptions<T>;
709
+ private drawCementPlug(
710
+ cementPlug: CementPlug,
711
+ casings: Casing[],
712
+ completion: Completion[],
713
+ holes: HoleSize[],
714
+ ) {
715
+ const { exaggerationFactor = 1, cementPlugOptions } = this
716
+ .options as SchematicLayerOptions<T>;
550
717
 
551
718
  const cementPlugSegments = createComplexRopeSegmentsForCementPlug(
552
719
  cementPlug,
@@ -556,11 +723,21 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
556
723
  exaggerationFactor,
557
724
  this.getZFactorScaledPathForPoints,
558
725
  );
559
- cementPlugOptions && this.drawComplexRope(cementPlugSegments, this.getCementPlugTexture(cementPlugOptions));
726
+ cementPlugOptions &&
727
+ this.drawComplexRope(
728
+ cementPlugSegments,
729
+ this.getCementPlugTexture(cementPlugOptions),
730
+ );
560
731
 
561
- const { rightPath, leftPath } = cementPlugSegments.reduce<{ rightPath: Point[]; leftPath: Point[] }>(
732
+ const { rightPath, leftPath } = cementPlugSegments.reduce<{
733
+ rightPath: Point[];
734
+ leftPath: Point[];
735
+ }>(
562
736
  (acc, current) => {
563
- const { leftPath, rightPath } = createTubularRenderingObject(current.diameter / 2, current.points);
737
+ const { leftPath, rightPath } = createTubularRenderingObject(
738
+ current.diameter / 2,
739
+ current.points,
740
+ );
564
741
 
565
742
  return {
566
743
  rightPath: [...acc.rightPath, ...rightPath],
@@ -569,12 +746,22 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
569
746
  },
570
747
  { rightPath: [], leftPath: [] },
571
748
  );
572
- this.drawOutline(leftPath, rightPath, convertColor('black'), 0.25, 'TopAndBottom');
749
+ this.drawOutline(
750
+ leftPath,
751
+ rightPath,
752
+ convertColor('black'),
753
+ 0.25,
754
+ 'TopAndBottom',
755
+ );
573
756
  }
574
757
 
575
758
  private createCasingRenderObject(casing: Casing): CasingRenderObject {
576
759
  const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
577
- return prepareCasingRenderObject(exaggerationFactor, casing, this.getZFactorScaledPathForPoints);
760
+ return prepareCasingRenderObject(
761
+ exaggerationFactor,
762
+ casing,
763
+ this.getZFactorScaledPathForPoints,
764
+ );
578
765
  }
579
766
 
580
767
  private getCementPlugTexture(cementPlugOptions: CementPlugOptions): Texture {
@@ -584,12 +771,17 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
584
771
  return this.cementPlugTextureCache;
585
772
  }
586
773
 
587
- private prepareSymbolRenderObject = (component: CompletionSymbol | PAndASymbol): SymbolRenderObject => {
774
+ private prepareSymbolRenderObject = (
775
+ component: CompletionSymbol | PAndASymbol,
776
+ ): SymbolRenderObject => {
588
777
  const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
589
778
 
590
779
  const exaggeratedDiameter = component.diameter * exaggerationFactor;
591
780
 
592
- const pathPoints = this.getZFactorScaledPathForPoints(component.start, component.end);
781
+ const pathPoints = this.getZFactorScaledPathForPoints(
782
+ component.start,
783
+ component.end,
784
+ );
593
785
 
594
786
  return {
595
787
  pathPoints,
@@ -598,7 +790,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
598
790
  };
599
791
  };
600
792
 
601
- private drawSymbolComponent = ({ pathPoints, referenceDiameter, symbolKey }: SymbolRenderObject): void => {
793
+ private drawSymbolComponent = ({
794
+ pathPoints,
795
+ referenceDiameter,
796
+ symbolKey,
797
+ }: SymbolRenderObject): void => {
602
798
  const texture = this.getSymbolTexture(symbolKey, referenceDiameter);
603
799
  // The rope renders fine in CANVAS/fallback mode
604
800
  this.drawSVGRope(pathPoints, texture!);
@@ -609,47 +805,92 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
609
805
  return undefined;
610
806
  }
611
807
 
612
- const rope: UniformTextureStretchRope = new UniformTextureStretchRope(texture, path);
808
+ const rope: UniformTextureStretchRope = new UniformTextureStretchRope(
809
+ texture,
810
+ path,
811
+ );
613
812
 
614
813
  this.addChild(rope);
615
814
  }
616
815
 
617
- private getSymbolTexture(symbolKey: string, diameter: number): Texture | undefined {
816
+ private getSymbolTexture(
817
+ symbolKey: string,
818
+ diameter: number,
819
+ ): Texture | undefined {
618
820
  const baseTexture = this.textureSymbolCacheArray?.[symbolKey]?.source;
619
- return baseTexture ? new Texture({ source: baseTexture, orig: new Rectangle(0, 0, 0, diameter), rotate: groupD8.MAIN_DIAGONAL }) : undefined;
821
+ return baseTexture
822
+ ? new Texture({
823
+ source: baseTexture,
824
+ orig: new Rectangle(0, 0, 0, diameter),
825
+ rotate: groupD8.MAIN_DIAGONAL,
826
+ })
827
+ : undefined;
620
828
  }
621
829
 
622
- private drawHoleSize = (maxHoleDiameter: number, holeObject: HoleSize): void => {
830
+ private drawHoleSize = (
831
+ maxHoleDiameter: number,
832
+ holeObject: HoleSize,
833
+ ): void => {
623
834
  if (holeObject == null) {
624
835
  return;
625
836
  }
626
837
 
627
- const pathPoints = this.getZFactorScaledPathForPoints(holeObject.start, holeObject.end);
838
+ const pathPoints = this.getZFactorScaledPathForPoints(
839
+ holeObject.start,
840
+ holeObject.end,
841
+ );
628
842
  if (pathPoints.length === 0) {
629
843
  return;
630
844
  }
631
845
 
632
- const { exaggerationFactor = 1, holeOptions } = this.options as SchematicLayerOptions<T>;
846
+ const { exaggerationFactor = 1, holeOptions } = this
847
+ .options as SchematicLayerOptions<T>;
633
848
  const exaggeratedDiameter = holeObject.diameter * exaggerationFactor;
634
- const { rightPath, leftPath } = createTubularRenderingObject(exaggeratedDiameter / 2, pathPoints);
635
- const texture = this.getHoleTexture(holeOptions!, exaggeratedDiameter, maxHoleDiameter);
849
+ const { rightPath, leftPath } = createTubularRenderingObject(
850
+ exaggeratedDiameter / 2,
851
+ pathPoints,
852
+ );
853
+ const texture = this.getHoleTexture(
854
+ holeOptions!,
855
+ exaggeratedDiameter,
856
+ maxHoleDiameter,
857
+ );
636
858
 
637
859
  this.drawHoleRope(pathPoints, texture, maxHoleDiameter);
638
860
 
639
- this.drawOutline(leftPath, rightPath, convertColor(holeOptions!.lineColor), HOLE_OUTLINE * exaggerationFactor, 'TopAndBottom', 0);
861
+ this.drawOutline(
862
+ leftPath,
863
+ rightPath,
864
+ convertColor(holeOptions!.lineColor),
865
+ HOLE_OUTLINE * exaggerationFactor,
866
+ 'TopAndBottom',
867
+ 0,
868
+ );
640
869
  };
641
870
 
642
- private drawHoleRope(path: Point[], texture: Texture, maxHoleDiameter: number): void {
871
+ private drawHoleRope(
872
+ path: Point[],
873
+ texture: Texture,
874
+ maxHoleDiameter: number,
875
+ ): void {
643
876
  if (path.length === 0) {
644
877
  return undefined;
645
878
  }
646
879
 
647
- const rope: MeshRope = new MeshRope({ texture, points: path, textureScale: maxHoleDiameter / DEFAULT_TEXTURE_SIZE });
880
+ const rope: MeshRope = new MeshRope({
881
+ texture,
882
+ points: path,
883
+ textureScale: maxHoleDiameter / DEFAULT_TEXTURE_SIZE,
884
+ });
648
885
 
649
886
  this.addChild(rope);
650
887
  }
651
888
 
652
- private getHoleTexture(holeOptions: HoleOptions, diameter: number, maxHoleDiameter: number): Texture {
889
+ private getHoleTexture(
890
+ holeOptions: HoleOptions,
891
+ diameter: number,
892
+ maxHoleDiameter: number,
893
+ ): Texture {
653
894
  const size = DEFAULT_TEXTURE_SIZE;
654
895
  const height = size;
655
896
  const width = size;
@@ -692,26 +933,48 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
692
933
  let zIndex = 0;
693
934
 
694
935
  const { result } = casingRenderObjects.reduce(
695
- (acc: InterlaceReducerAcc, casingRenderObject: CasingRenderObject): InterlaceReducerAcc => {
696
- const foundCementShape = acc.remainingCement.find((cement) => cement.casingIds.includes(casingRenderObject.id));
697
- const foundCementSqueezes = acc.remainingCementSqueezes.filter((squeeze) => squeeze.casingIds.includes(casingRenderObject.id));
936
+ (
937
+ acc: InterlaceReducerAcc,
938
+ casingRenderObject: CasingRenderObject,
939
+ ): InterlaceReducerAcc => {
940
+ const foundCementShape = acc.remainingCement.find(cement =>
941
+ cement.casingIds.includes(casingRenderObject.id),
942
+ );
943
+ const foundCementSqueezes = acc.remainingCementSqueezes.filter(
944
+ squeeze => squeeze.casingIds.includes(casingRenderObject.id),
945
+ );
698
946
 
699
947
  if (foundCementShape) {
700
948
  foundCementShape.zIndex = zIndex++;
701
949
  }
702
- foundCementSqueezes.forEach((item) => (item.zIndex = zIndex++));
950
+ foundCementSqueezes.forEach(item => (item.zIndex = zIndex++));
703
951
  casingRenderObject.zIndex = zIndex++;
704
952
 
705
953
  return {
706
- result: [...acc.result, foundCementShape!, casingRenderObject, ...foundCementSqueezes],
707
- remainingCement: acc.remainingCement.filter((c) => c !== foundCementShape),
708
- remainingCementSqueezes: acc.remainingCementSqueezes.filter((squeeze) => !foundCementSqueezes.includes(squeeze)),
954
+ result: [
955
+ ...acc.result,
956
+ foundCementShape!,
957
+ casingRenderObject,
958
+ ...foundCementSqueezes,
959
+ ],
960
+ remainingCement: acc.remainingCement.filter(
961
+ c => c !== foundCementShape,
962
+ ),
963
+ remainingCementSqueezes: acc.remainingCementSqueezes.filter(
964
+ squeeze => !foundCementSqueezes.includes(squeeze),
965
+ ),
709
966
  };
710
967
  },
711
- { result: [], remainingCement: cementRenderObject, remainingCementSqueezes: cementSqueezes },
968
+ {
969
+ result: [],
970
+ remainingCement: cementRenderObject,
971
+ remainingCementSqueezes: cementSqueezes,
972
+ },
712
973
  );
713
974
 
714
- return result.filter((item): item is InterlacedRenderObjects => item != null).sort((a, b) => a.zIndex! - b.zIndex!);
975
+ return result
976
+ .filter((item): item is InterlacedRenderObjects => item != null)
977
+ .sort((a, b) => a.zIndex! - b.zIndex!);
715
978
  }
716
979
 
717
980
  /**
@@ -723,7 +986,10 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
723
986
  * @param getExaggerationFactor
724
987
  * @returns
725
988
  */
726
- private drawComplexRope(intervals: ComplexRopeSegment[], texture: Texture): ComplexRope | undefined {
989
+ private drawComplexRope(
990
+ intervals: ComplexRopeSegment[],
991
+ texture: Texture,
992
+ ): ComplexRope | undefined {
727
993
  if (intervals.length === 0) {
728
994
  return undefined;
729
995
  }
@@ -734,7 +1000,10 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
734
1000
  return rope;
735
1001
  }
736
1002
 
737
- private static getOutlineClosureType = (index: number, maxIndex: number): OutlineClosure => {
1003
+ private static getOutlineClosureType = (
1004
+ index: number,
1005
+ maxIndex: number,
1006
+ ): OutlineClosure => {
738
1007
  if (index === 0) {
739
1008
  if (index === maxIndex) {
740
1009
  return 'TopAndBottom';
@@ -754,15 +1023,31 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
754
1023
  const casingLineColorNumber = convertColor(casingOptions!.lineColor);
755
1024
 
756
1025
  casingRenderObject.sections.forEach((section, index, list) => {
757
- const outlineClosureType = SchematicLayer.getOutlineClosureType(index, list.length - 1);
1026
+ const outlineClosureType = SchematicLayer.getOutlineClosureType(
1027
+ index,
1028
+ list.length - 1,
1029
+ );
758
1030
 
759
- const texture = this.createCasingTexture(casingRenderObject.referenceDiameter);
1031
+ const texture = this.createCasingTexture(
1032
+ casingRenderObject.referenceDiameter,
1033
+ );
760
1034
  this.drawRope(section.pathPoints, texture, casingSolidColorNumber);
761
1035
 
762
1036
  if (section.kind === 'casing-window') {
763
- this.drawCasingWindowOutline(section.leftPath, section.rightPath, casingOptions!, casingRenderObject.casingWallWidth);
1037
+ this.drawCasingWindowOutline(
1038
+ section.leftPath,
1039
+ section.rightPath,
1040
+ casingOptions!,
1041
+ casingRenderObject.casingWallWidth,
1042
+ );
764
1043
  } else {
765
- this.drawOutline(section.leftPath, section.rightPath, casingLineColorNumber, casingRenderObject.casingWallWidth, outlineClosureType);
1044
+ this.drawOutline(
1045
+ section.leftPath,
1046
+ section.rightPath,
1047
+ casingLineColorNumber,
1048
+ casingRenderObject.casingWallWidth,
1049
+ outlineClosureType,
1050
+ );
766
1051
  }
767
1052
  });
768
1053
  };
@@ -776,28 +1061,52 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
776
1061
  }
777
1062
 
778
1063
  private drawShoe(casingEnd: number, casingRadius: number): void {
779
- const { exaggerationFactor = 1, casingOptions } = this.options as SchematicLayerOptions<T>;
1064
+ const { exaggerationFactor = 1, casingOptions } = this
1065
+ .options as SchematicLayerOptions<T>;
780
1066
  const shoeWidth = casingOptions!.shoeSize.width * exaggerationFactor;
781
1067
  const shoeLength = casingOptions!.shoeSize.length * exaggerationFactor;
782
1068
 
783
- const shoeCoords = this.generateShoe(casingEnd, casingRadius, shoeLength, shoeWidth);
784
- const shoeCoords2 = this.generateShoe(casingEnd, casingRadius, shoeLength, -shoeWidth);
1069
+ const shoeCoords = this.generateShoe(
1070
+ casingEnd,
1071
+ casingRadius,
1072
+ shoeLength,
1073
+ shoeWidth,
1074
+ );
1075
+ const shoeCoords2 = this.generateShoe(
1076
+ casingEnd,
1077
+ casingRadius,
1078
+ shoeLength,
1079
+ -shoeWidth,
1080
+ );
785
1081
  this.drawBigPolygon(shoeCoords2);
786
1082
  this.drawBigPolygon(shoeCoords);
787
1083
  }
788
1084
 
789
- private generateShoe = (casingEnd: number, casingRadius: number, length: number, width: number): Point[] => {
1085
+ private generateShoe = (
1086
+ casingEnd: number,
1087
+ casingRadius: number,
1088
+ length: number,
1089
+ width: number,
1090
+ ): Point[] => {
790
1091
  const start = casingEnd - length;
791
1092
  const end = casingEnd;
792
1093
 
793
1094
  const points = this.getZFactorScaledPathForPoints(start, end);
794
1095
 
795
1096
  const normal = createNormals(points);
796
- const shoeEdge: Point[] = offsetPoints(points, normal, casingRadius * (width < 0 ? -1 : 1));
1097
+ const shoeEdge: Point[] = offsetPoints(
1098
+ points,
1099
+ normal,
1100
+ casingRadius * (width < 0 ? -1 : 1),
1101
+ );
797
1102
 
798
1103
  const shoeTipPoint = points[points.length - 1]!;
799
1104
  const shoeTipNormal = normal[normal.length - 1]!;
800
- const shoeTip: Point = offsetPoint(shoeTipPoint, shoeTipNormal, width + casingRadius * (width < 0 ? -1 : 1));
1105
+ const shoeTip: Point = offsetPoint(
1106
+ shoeTipPoint,
1107
+ shoeTipNormal,
1108
+ width + casingRadius * (width < 0 ? -1 : 1),
1109
+ );
801
1110
 
802
1111
  return [...shoeEdge, shoeTip];
803
1112
  };
@@ -809,46 +1118,77 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
809
1118
  holes: HoleSize[],
810
1119
  ): ComplexRopeSegment[] => {
811
1120
  const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
812
- return createComplexRopeSegmentsForCementSqueeze(squeeze, casings, completion, holes, exaggerationFactor, this.getZFactorScaledPathForPoints);
1121
+ return createComplexRopeSegmentsForCementSqueeze(
1122
+ squeeze,
1123
+ casings,
1124
+ completion,
1125
+ holes,
1126
+ exaggerationFactor,
1127
+ this.getZFactorScaledPathForPoints,
1128
+ );
813
1129
  };
814
1130
 
815
1131
  private getCementTexture(): Texture | null {
816
1132
  if (!this.cementTextureCache) {
817
1133
  const { cementOptions } = this.options as SchematicLayerOptions<T>;
818
- cementOptions && (this.cementTextureCache = createCementTexture(cementOptions));
1134
+ cementOptions &&
1135
+ (this.cementTextureCache = createCementTexture(cementOptions));
819
1136
  }
820
1137
  return this.cementTextureCache;
821
1138
  }
822
1139
 
823
- private createPerforationShape = (perforation: Perforation, casings: Casing[], holes: HoleSize[]): PerforationShape[] => {
1140
+ private createPerforationShape = (
1141
+ perforation: Perforation,
1142
+ casings: Casing[],
1143
+ holes: HoleSize[],
1144
+ ): PerforationShape[] => {
824
1145
  const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
825
- return createComplexRopeSegmentsForPerforation(perforation, casings, holes, exaggerationFactor, this.getZFactorScaledPathForPoints);
1146
+ return createComplexRopeSegmentsForPerforation(
1147
+ perforation,
1148
+ casings,
1149
+ holes,
1150
+ exaggerationFactor,
1151
+ this.getZFactorScaledPathForPoints,
1152
+ );
826
1153
  };
827
1154
 
828
1155
  private getCementSqueezeTexture(): Texture | null {
829
1156
  if (!this.cementSqueezeTextureCache) {
830
1157
  const { cementSqueezeOptions } = this.options as SchematicLayerOptions<T>;
831
- cementSqueezeOptions && (this.cementSqueezeTextureCache = createCementSqueezeTexture(cementSqueezeOptions));
1158
+ cementSqueezeOptions &&
1159
+ (this.cementSqueezeTextureCache =
1160
+ createCementSqueezeTexture(cementSqueezeOptions));
832
1161
  }
833
1162
  return this.cementSqueezeTextureCache;
834
1163
  }
835
1164
 
836
1165
  private drawScreen({ start, end, diameter }: Screen): void {
837
- const { exaggerationFactor = 1, screenOptions } = this.options as SchematicLayerOptions<T>;
1166
+ const { exaggerationFactor = 1, screenOptions } = this
1167
+ .options as SchematicLayerOptions<T>;
838
1168
  const exaggeratedDiameter = exaggerationFactor * diameter;
839
1169
 
840
1170
  const pathPoints = this.getZFactorScaledPathForPoints(start, end);
841
- const { leftPath, rightPath } = createTubularRenderingObject(exaggeratedDiameter / 2, pathPoints);
1171
+ const { leftPath, rightPath } = createTubularRenderingObject(
1172
+ exaggeratedDiameter / 2,
1173
+ pathPoints,
1174
+ );
842
1175
 
843
1176
  const texture = this.getScreenTexture();
844
1177
  if (texture) {
845
1178
  this.drawCompletionRope(pathPoints, texture, exaggeratedDiameter);
846
- this.drawOutline(leftPath, rightPath, convertColor(screenOptions!.lineColor), SCREEN_OUTLINE * exaggerationFactor, 'TopAndBottom');
1179
+ this.drawOutline(
1180
+ leftPath,
1181
+ rightPath,
1182
+ convertColor(screenOptions!.lineColor),
1183
+ SCREEN_OUTLINE * exaggerationFactor,
1184
+ 'TopAndBottom',
1185
+ );
847
1186
  }
848
1187
  }
849
1188
 
850
1189
  private drawTubing({ diameter, start, end }: Tubing): void {
851
- const { exaggerationFactor = 1, tubingOptions } = this.options as SchematicLayerOptions<T>;
1190
+ const { exaggerationFactor = 1, tubingOptions } = this
1191
+ .options as SchematicLayerOptions<T>;
852
1192
  const exaggeratedDiameter = exaggerationFactor * diameter;
853
1193
 
854
1194
  const pathPoints = this.getZFactorScaledPathForPoints(start, end);
@@ -867,17 +1207,26 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
867
1207
  private getScreenTexture(): Texture | null {
868
1208
  if (!this.screenTextureCache) {
869
1209
  const { screenOptions } = this.options as SchematicLayerOptions<T>;
870
- screenOptions && (this.screenTextureCache = createScreenTexture(screenOptions));
1210
+ screenOptions &&
1211
+ (this.screenTextureCache = createScreenTexture(screenOptions));
871
1212
  }
872
1213
  return this.screenTextureCache;
873
1214
  }
874
1215
 
875
- private drawCompletionRope(path: Point[], texture: Texture, diameter: number): void {
1216
+ private drawCompletionRope(
1217
+ path: Point[],
1218
+ texture: Texture,
1219
+ diameter: number,
1220
+ ): void {
876
1221
  if (path.length === 0) {
877
1222
  return;
878
1223
  }
879
1224
 
880
- const rope: FixedWidthSimpleRope = new FixedWidthSimpleRope(texture, path, diameter);
1225
+ const rope: FixedWidthSimpleRope = new FixedWidthSimpleRope(
1226
+ texture,
1227
+ path,
1228
+ diameter,
1229
+ );
881
1230
  this.addChild(rope);
882
1231
  }
883
1232
  }