@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.
- package/dist/components/axis.d.ts.map +1 -1
- package/dist/control/ExtendedCurveInterpolator.d.ts.map +1 -1
- package/dist/control/IntersectionReferenceSystem.d.ts.map +1 -1
- package/dist/control/LayerManager.d.ts.map +1 -1
- package/dist/control/MainController.d.ts.map +1 -1
- package/dist/control/ZoomPanHandler.d.ts.map +1 -1
- package/dist/control/overlay.d.ts.map +1 -1
- package/dist/datautils/colortable.d.ts.map +1 -1
- package/dist/datautils/findsample.d.ts.map +1 -1
- package/dist/datautils/picks.d.ts.map +1 -1
- package/dist/datautils/schematicShapeGenerator.d.ts +5 -5
- package/dist/datautils/schematicShapeGenerator.d.ts.map +1 -1
- package/dist/datautils/seismicimage.d.ts.map +1 -1
- package/dist/datautils/surfacedata.d.ts.map +1 -1
- package/dist/datautils/trajectory.d.ts.map +1 -1
- package/dist/index.cjs +1 -14
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2168 -1290
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1 -14
- package/dist/index.umd.js.map +1 -1
- package/dist/layers/CalloutCanvasLayer.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +1 -1
- package/dist/layers/GeomodelCanvasLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLabelsLayer.d.ts.map +1 -1
- package/dist/layers/GeomodelLayerV2.d.ts.map +1 -1
- package/dist/layers/GridLayer.d.ts.map +1 -1
- package/dist/layers/ImageCanvasLayer.d.ts.map +1 -1
- package/dist/layers/ReferenceLineLayer.d.ts.map +1 -1
- package/dist/layers/SchematicLayer.d.ts.map +1 -1
- package/dist/layers/WellborePathLayer.d.ts.map +1 -1
- package/dist/layers/base/CanvasLayer.d.ts.map +1 -1
- package/dist/layers/base/HTMLLayer.d.ts.map +1 -1
- package/dist/layers/base/Layer.d.ts.map +1 -1
- package/dist/layers/base/PixiLayer.d.ts.map +1 -1
- package/dist/layers/base/SVGLayer.d.ts.map +1 -1
- package/dist/layers/schematicInterfaces.d.ts.map +1 -1
- package/dist/utils/arc-length.d.ts.map +1 -1
- package/dist/utils/root-finder.d.ts.map +1 -1
- package/dist/utils/text.d.ts.map +1 -1
- package/dist/utils/vectorUtils.d.ts.map +1 -1
- package/dist/vendor/pixi-dashed-line/index.d.ts.map +1 -1
- package/package.json +15 -17
- package/src/components/axis.ts +40 -10
- package/src/control/ExtendedCurveInterpolator.ts +47 -9
- package/src/control/IntersectionReferenceSystem.ts +110 -30
- package/src/control/LayerManager.ts +76 -24
- package/src/control/MainController.ts +37 -8
- package/src/control/ZoomPanHandler.ts +76 -14
- package/src/control/overlay.ts +18 -6
- package/src/datautils/colortable.ts +7 -2
- package/src/datautils/findsample.ts +12 -2
- package/src/datautils/picks.ts +66 -18
- package/src/datautils/schematicShapeGenerator.ts +570 -146
- package/src/datautils/seismicimage.ts +36 -10
- package/src/datautils/surfacedata.ts +119 -40
- package/src/datautils/trajectory.ts +56 -17
- package/src/layers/CalloutCanvasLayer.ts +129 -26
- package/src/layers/CustomDisplayObjects/ComplexRope.ts +2 -1
- package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +5 -5
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRope.ts +6 -2
- package/src/layers/GeomodelCanvasLayer.ts +10 -3
- package/src/layers/GeomodelLabelsLayer.ts +212 -87
- package/src/layers/GeomodelLayerV2.ts +8 -3
- package/src/layers/GridLayer.ts +14 -3
- package/src/layers/ImageCanvasLayer.ts +17 -3
- package/src/layers/ReferenceLineLayer.ts +31 -9
- package/src/layers/SchematicLayer.ts +499 -150
- package/src/layers/WellborePathLayer.ts +22 -7
- package/src/layers/base/CanvasLayer.ts +18 -4
- package/src/layers/base/HTMLLayer.ts +11 -3
- package/src/layers/base/Layer.ts +10 -2
- package/src/layers/base/PixiLayer.ts +27 -7
- package/src/layers/base/SVGLayer.ts +13 -3
- package/src/layers/schematicInterfaces.ts +16 -6
- package/src/utils/arc-length.ts +31 -5
- package/src/utils/root-finder.ts +32 -4
- package/src/utils/text.ts +34 -7
- package/src/utils/vectorUtils.ts +23 -6
- 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 {
|
|
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 {
|
|
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 {
|
|
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 =
|
|
117
|
+
type InterlacedRenderObjects =
|
|
118
|
+
| CasingRenderObject
|
|
119
|
+
| CementRenderObject
|
|
120
|
+
| CementSqueezeRenderObject;
|
|
102
121
|
|
|
103
122
|
const foldInterlacedRenderObjects =
|
|
104
|
-
<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<
|
|
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 = (
|
|
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(
|
|
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 = {
|
|
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(
|
|
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
|
|
222
|
-
|
|
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] =
|
|
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(
|
|
290
|
+
return Math.abs(
|
|
291
|
+
this.scalingFactors.height / (baseDomain[1] - baseDomain[0]),
|
|
292
|
+
);
|
|
248
293
|
}
|
|
249
294
|
|
|
250
|
-
protected getZFactorScaledPathForPoints = (
|
|
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(
|
|
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({
|
|
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>(
|
|
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({
|
|
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(
|
|
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 =
|
|
328
|
-
|
|
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({
|
|
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: {
|
|
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 {
|
|
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
|
|
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) =>
|
|
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(
|
|
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(
|
|
380
|
-
|
|
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<
|
|
476
|
+
const [cementSqueezes, remainingPAndA] = pAndA.reduce<
|
|
477
|
+
[CementSqueeze[], Exclude<PAndA, CementSqueeze>[]]
|
|
478
|
+
>(
|
|
385
479
|
([squeezes, remaining], current: PAndA) =>
|
|
386
|
-
isCementSqueeze(current)
|
|
480
|
+
isCementSqueeze(current)
|
|
481
|
+
? [[current, ...squeezes], remaining]
|
|
482
|
+
: [squeezes, [current, ...remaining]],
|
|
387
483
|
[[], []],
|
|
388
484
|
);
|
|
389
485
|
|
|
390
|
-
const cementSqueezesShape: CementSqueezeRenderObject[] = cementSqueezes.map(
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
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(
|
|
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(
|
|
442
|
-
const perfShapes = this.createPerforationShape(
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
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(
|
|
461
|
-
const perfShapes = this.createPerforationShape(
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
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(
|
|
483
|
-
const perfShapes = this.createPerforationShape(
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
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(
|
|
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(
|
|
541
|
-
|
|
542
|
-
|
|
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(
|
|
549
|
-
|
|
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 &&
|
|
726
|
+
cementPlugOptions &&
|
|
727
|
+
this.drawComplexRope(
|
|
728
|
+
cementPlugSegments,
|
|
729
|
+
this.getCementPlugTexture(cementPlugOptions),
|
|
730
|
+
);
|
|
560
731
|
|
|
561
|
-
const { rightPath, leftPath } = cementPlugSegments.reduce<{
|
|
732
|
+
const { rightPath, leftPath } = cementPlugSegments.reduce<{
|
|
733
|
+
rightPath: Point[];
|
|
734
|
+
leftPath: Point[];
|
|
735
|
+
}>(
|
|
562
736
|
(acc, current) => {
|
|
563
|
-
const { leftPath, rightPath } = createTubularRenderingObject(
|
|
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(
|
|
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(
|
|
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 = (
|
|
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(
|
|
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 = ({
|
|
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(
|
|
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(
|
|
816
|
+
private getSymbolTexture(
|
|
817
|
+
symbolKey: string,
|
|
818
|
+
diameter: number,
|
|
819
|
+
): Texture | undefined {
|
|
618
820
|
const baseTexture = this.textureSymbolCacheArray?.[symbolKey]?.source;
|
|
619
|
-
return baseTexture
|
|
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 = (
|
|
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(
|
|
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
|
|
846
|
+
const { exaggerationFactor = 1, holeOptions } = this
|
|
847
|
+
.options as SchematicLayerOptions<T>;
|
|
633
848
|
const exaggeratedDiameter = holeObject.diameter * exaggerationFactor;
|
|
634
|
-
const { rightPath, leftPath } = createTubularRenderingObject(
|
|
635
|
-
|
|
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(
|
|
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(
|
|
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({
|
|
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(
|
|
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
|
-
(
|
|
696
|
-
|
|
697
|
-
|
|
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(
|
|
950
|
+
foundCementSqueezes.forEach(item => (item.zIndex = zIndex++));
|
|
703
951
|
casingRenderObject.zIndex = zIndex++;
|
|
704
952
|
|
|
705
953
|
return {
|
|
706
|
-
result: [
|
|
707
|
-
|
|
708
|
-
|
|
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
|
-
{
|
|
968
|
+
{
|
|
969
|
+
result: [],
|
|
970
|
+
remainingCement: cementRenderObject,
|
|
971
|
+
remainingCementSqueezes: cementSqueezes,
|
|
972
|
+
},
|
|
712
973
|
);
|
|
713
974
|
|
|
714
|
-
return result
|
|
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(
|
|
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 = (
|
|
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(
|
|
1026
|
+
const outlineClosureType = SchematicLayer.getOutlineClosureType(
|
|
1027
|
+
index,
|
|
1028
|
+
list.length - 1,
|
|
1029
|
+
);
|
|
758
1030
|
|
|
759
|
-
const texture = this.createCasingTexture(
|
|
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(
|
|
1037
|
+
this.drawCasingWindowOutline(
|
|
1038
|
+
section.leftPath,
|
|
1039
|
+
section.rightPath,
|
|
1040
|
+
casingOptions!,
|
|
1041
|
+
casingRenderObject.casingWallWidth,
|
|
1042
|
+
);
|
|
764
1043
|
} else {
|
|
765
|
-
this.drawOutline(
|
|
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
|
|
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(
|
|
784
|
-
|
|
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 = (
|
|
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(
|
|
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(
|
|
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(
|
|
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 &&
|
|
1134
|
+
cementOptions &&
|
|
1135
|
+
(this.cementTextureCache = createCementTexture(cementOptions));
|
|
819
1136
|
}
|
|
820
1137
|
return this.cementTextureCache;
|
|
821
1138
|
}
|
|
822
1139
|
|
|
823
|
-
private createPerforationShape = (
|
|
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(
|
|
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 &&
|
|
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
|
|
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(
|
|
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(
|
|
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
|
|
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 &&
|
|
1210
|
+
screenOptions &&
|
|
1211
|
+
(this.screenTextureCache = createScreenTexture(screenOptions));
|
|
871
1212
|
}
|
|
872
1213
|
return this.screenTextureCache;
|
|
873
1214
|
}
|
|
874
1215
|
|
|
875
|
-
private drawCompletionRope(
|
|
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(
|
|
1225
|
+
const rope: FixedWidthSimpleRope = new FixedWidthSimpleRope(
|
|
1226
|
+
texture,
|
|
1227
|
+
path,
|
|
1228
|
+
diameter,
|
|
1229
|
+
);
|
|
881
1230
|
this.addChild(rope);
|
|
882
1231
|
}
|
|
883
1232
|
}
|