@equinor/esv-intersection 3.1.9 → 4.1.0
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 +10 -10
- 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 +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +2533 -1570
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/layers/CalloutCanvasLayer.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts +2 -3
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts +3 -4
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts +4 -4
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts +3 -4
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +1 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.d.ts +4 -4
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.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 +6 -6
- 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 +7 -8
- 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 +6 -6
- package/dist/utils/vectorUtils.d.ts.map +1 -1
- package/dist/vendor/pixi-dashed-line/index.d.ts +13 -13
- package/dist/vendor/pixi-dashed-line/index.d.ts.map +1 -1
- package/package.json +4 -6
- 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 +591 -165
- 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 +11 -13
- package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +14 -13
- package/src/layers/CustomDisplayObjects/FixedWidthSimpleRope.ts +11 -14
- package/src/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.ts +13 -12
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRope.ts +16 -17
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.ts +11 -11
- package/src/layers/GeomodelCanvasLayer.ts +10 -3
- package/src/layers/GeomodelLabelsLayer.ts +212 -87
- package/src/layers/GeomodelLayerV2.ts +11 -7
- 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 +533 -173
- 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 +36 -43
- 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 +27 -10
- package/src/vendor/pixi-dashed-line/index.ts +93 -39
|
@@ -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,
|
|
@@ -186,46 +217,58 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
186
217
|
this.textureSymbolCacheArray = null;
|
|
187
218
|
}
|
|
188
219
|
|
|
189
|
-
public override onUpdate(event: OnUpdateEvent<T>): void {
|
|
220
|
+
public override async onUpdate(event: OnUpdateEvent<T>): Promise<void> {
|
|
190
221
|
super.onUpdate(event);
|
|
191
222
|
this.clearLayer();
|
|
192
|
-
this.preRender();
|
|
223
|
+
await this.preRender();
|
|
193
224
|
this.render();
|
|
194
225
|
}
|
|
195
226
|
|
|
196
|
-
public override onRescale(event: OnRescaleEvent): void {
|
|
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
|
-
this.preRender();
|
|
246
|
+
await this.preRender();
|
|
209
247
|
}
|
|
210
248
|
|
|
211
249
|
this.render();
|
|
212
250
|
}
|
|
213
251
|
|
|
214
|
-
public override setVisibility(isVisible: boolean, layerId: string) {
|
|
252
|
+
public override async setVisibility(isVisible: boolean, layerId: string) {
|
|
215
253
|
if (layerId === this.id) {
|
|
216
254
|
super.setVisibility(isVisible, layerId);
|
|
217
255
|
return;
|
|
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
|
-
this.preRender();
|
|
271
|
+
await this.preRender();
|
|
229
272
|
this.render();
|
|
230
273
|
}
|
|
231
274
|
}
|
|
@@ -244,21 +287,25 @@ 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
|
-
protected drawBigPolygon = (coords:
|
|
305
|
+
protected drawBigPolygon = (coords: Point[], color = 0x000000) => {
|
|
258
306
|
const polygon = new Graphics();
|
|
259
|
-
polygon.
|
|
260
|
-
polygon.
|
|
261
|
-
polygon.endFill();
|
|
307
|
+
polygon.poly(coords);
|
|
308
|
+
polygon.fill(color);
|
|
262
309
|
|
|
263
310
|
this.addChild(polygon);
|
|
264
311
|
};
|
|
@@ -268,7 +315,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
268
315
|
return undefined;
|
|
269
316
|
}
|
|
270
317
|
|
|
271
|
-
const rope:
|
|
318
|
+
const rope: MeshRope = new MeshRope({
|
|
319
|
+
texture,
|
|
320
|
+
points: path,
|
|
321
|
+
textureScale: 1,
|
|
322
|
+
});
|
|
272
323
|
rope.tint = tint || rope.tint;
|
|
273
324
|
this.addChild(rope);
|
|
274
325
|
}
|
|
@@ -290,13 +341,12 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
290
341
|
outlineClosure: OutlineClosure = 'None',
|
|
291
342
|
lineAlignment = 1,
|
|
292
343
|
): void {
|
|
293
|
-
const leftPathReverse = leftPath.map<Point>(
|
|
344
|
+
const leftPathReverse = leftPath.map<Point>(d => d.clone()).reverse();
|
|
294
345
|
|
|
295
346
|
const startPointRight = rightPath[0]!;
|
|
296
347
|
const startPointLeft = leftPathReverse[0]!;
|
|
297
348
|
|
|
298
349
|
const line = new Graphics();
|
|
299
|
-
line.lineStyle(lineWidth, lineColor, undefined, lineAlignment);
|
|
300
350
|
line.moveTo(startPointRight.x, startPointRight.y);
|
|
301
351
|
rightPath.forEach((p: Point) => line.lineTo(p.x, p.y));
|
|
302
352
|
|
|
@@ -310,6 +360,12 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
310
360
|
line.lineTo(startPointRight.x, startPointRight.y);
|
|
311
361
|
}
|
|
312
362
|
|
|
363
|
+
line.stroke({
|
|
364
|
+
width: lineWidth,
|
|
365
|
+
color: lineColor,
|
|
366
|
+
alignment: lineAlignment,
|
|
367
|
+
});
|
|
368
|
+
|
|
313
369
|
this.addChild(line);
|
|
314
370
|
}
|
|
315
371
|
|
|
@@ -322,18 +378,30 @@ 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();
|
|
332
|
-
graphics.lineStyle(lineWidth, convertColor(lineColor), undefined, solidAlignment);
|
|
333
396
|
|
|
334
397
|
const startPointLinePath = linePath[0]!;
|
|
335
398
|
graphics.moveTo(startPointLinePath.x, startPointLinePath.y);
|
|
336
399
|
linePath.forEach((p: Point) => graphics.lineTo(p.x, p.y));
|
|
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,49 +419,88 @@ 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
|
-
public preRender(): void {
|
|
427
|
+
public async preRender(): Promise<void> {
|
|
357
428
|
if (!this.data || !this.referenceSystem) {
|
|
358
429
|
return;
|
|
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
|
-
this.updateSymbolCache(symbols);
|
|
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) {
|
|
@@ -420,12 +527,16 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
420
527
|
);
|
|
421
528
|
|
|
422
529
|
this.perforationRopeAndTextureReferences.forEach(({ rope, texture }) => {
|
|
423
|
-
rope.
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
530
|
+
if (!rope.destroyed) {
|
|
531
|
+
rope.destroy({
|
|
532
|
+
children: true,
|
|
533
|
+
texture: true,
|
|
534
|
+
textureSource: true,
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
if (texture) {
|
|
538
|
+
texture.destroy(true);
|
|
539
|
+
}
|
|
429
540
|
});
|
|
430
541
|
this.perforationRopeAndTextureReferences = [];
|
|
431
542
|
|
|
@@ -434,67 +545,119 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
434
545
|
const packings = perforations.filter(hasPacking);
|
|
435
546
|
const fracLines = perforations.filter(hasFracLines);
|
|
436
547
|
const spikes = perforations.filter(hasSpikes);
|
|
437
|
-
packings.forEach(
|
|
438
|
-
const perfShapes = this.createPerforationShape(
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
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 });
|
|
446
578
|
},
|
|
447
|
-
{},
|
|
448
579
|
);
|
|
449
|
-
Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
|
|
450
|
-
const texture = createPerforationPackingTexture(perforation, perfShapesWithSameDiameter[0]!, perforationOptions!);
|
|
451
|
-
const rope = this.drawComplexRope(perfShapesWithSameDiameter, texture);
|
|
452
|
-
rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
|
|
453
|
-
});
|
|
454
580
|
});
|
|
455
581
|
|
|
456
|
-
spikes.forEach(
|
|
457
|
-
const perfShapes = this.createPerforationShape(
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
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
|
+
});
|
|
466
619
|
},
|
|
467
|
-
{},
|
|
468
620
|
);
|
|
469
|
-
Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
|
|
470
|
-
perfShapesWithSameDiameter.forEach((perfShape) => {
|
|
471
|
-
const texture = createPerforationSpikeTexture(perforation, perforations, perfShape, perforationOptions!);
|
|
472
|
-
const rope = this.drawComplexRope([perfShape], texture);
|
|
473
|
-
rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
|
|
474
|
-
});
|
|
475
|
-
});
|
|
476
621
|
});
|
|
477
622
|
|
|
478
|
-
fracLines.forEach(
|
|
479
|
-
const perfShapes = this.createPerforationShape(
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
+
});
|
|
488
659
|
},
|
|
489
|
-
{},
|
|
490
660
|
);
|
|
491
|
-
Object.values(perfShapesByDiameter).forEach((perfShapesWithSameDiameter) => {
|
|
492
|
-
perfShapesWithSameDiameter.forEach((perfShape) => {
|
|
493
|
-
const texture = createPerforationFracLineTexture(perforation, perfShape, perforationOptions!);
|
|
494
|
-
const rope = this.drawComplexRope([perfShape], texture);
|
|
495
|
-
rope && this.perforationRopeAndTextureReferences.push({ rope, texture });
|
|
496
|
-
});
|
|
497
|
-
});
|
|
498
661
|
});
|
|
499
662
|
}
|
|
500
663
|
|
|
@@ -512,7 +675,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
512
675
|
}
|
|
513
676
|
|
|
514
677
|
if (this.internalLayerVisibility.pAndALayerId) {
|
|
515
|
-
remainingPAndA.forEach(
|
|
678
|
+
remainingPAndA.forEach(obj => {
|
|
516
679
|
if (isPAndASymbol(obj)) {
|
|
517
680
|
const symbolRenderObject = this.prepareSymbolRenderObject(obj);
|
|
518
681
|
this.drawSymbolComponent(symbolRenderObject);
|
|
@@ -524,7 +687,7 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
524
687
|
}
|
|
525
688
|
}
|
|
526
689
|
|
|
527
|
-
private updateSymbolCache(symbols: { [key: string]: string }) {
|
|
690
|
+
private async updateSymbolCache(symbols: { [key: string]: string }) {
|
|
528
691
|
if (!this.textureSymbolCacheArray) {
|
|
529
692
|
this.textureSymbolCacheArray = {};
|
|
530
693
|
}
|
|
@@ -533,15 +696,24 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
533
696
|
}
|
|
534
697
|
|
|
535
698
|
const existingKeys = Object.keys(this.textureSymbolCacheArray);
|
|
536
|
-
Object.entries(symbols).
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
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
|
+
);
|
|
706
|
+
await Promise.all(promises);
|
|
541
707
|
}
|
|
542
708
|
|
|
543
|
-
private drawCementPlug(
|
|
544
|
-
|
|
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>;
|
|
545
717
|
|
|
546
718
|
const cementPlugSegments = createComplexRopeSegmentsForCementPlug(
|
|
547
719
|
cementPlug,
|
|
@@ -551,11 +723,21 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
551
723
|
exaggerationFactor,
|
|
552
724
|
this.getZFactorScaledPathForPoints,
|
|
553
725
|
);
|
|
554
|
-
cementPlugOptions &&
|
|
726
|
+
cementPlugOptions &&
|
|
727
|
+
this.drawComplexRope(
|
|
728
|
+
cementPlugSegments,
|
|
729
|
+
this.getCementPlugTexture(cementPlugOptions),
|
|
730
|
+
);
|
|
555
731
|
|
|
556
|
-
const { rightPath, leftPath } = cementPlugSegments.reduce<{
|
|
732
|
+
const { rightPath, leftPath } = cementPlugSegments.reduce<{
|
|
733
|
+
rightPath: Point[];
|
|
734
|
+
leftPath: Point[];
|
|
735
|
+
}>(
|
|
557
736
|
(acc, current) => {
|
|
558
|
-
const { leftPath, rightPath } = createTubularRenderingObject(
|
|
737
|
+
const { leftPath, rightPath } = createTubularRenderingObject(
|
|
738
|
+
current.diameter / 2,
|
|
739
|
+
current.points,
|
|
740
|
+
);
|
|
559
741
|
|
|
560
742
|
return {
|
|
561
743
|
rightPath: [...acc.rightPath, ...rightPath],
|
|
@@ -564,12 +746,22 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
564
746
|
},
|
|
565
747
|
{ rightPath: [], leftPath: [] },
|
|
566
748
|
);
|
|
567
|
-
this.drawOutline(
|
|
749
|
+
this.drawOutline(
|
|
750
|
+
leftPath,
|
|
751
|
+
rightPath,
|
|
752
|
+
convertColor('black'),
|
|
753
|
+
0.25,
|
|
754
|
+
'TopAndBottom',
|
|
755
|
+
);
|
|
568
756
|
}
|
|
569
757
|
|
|
570
758
|
private createCasingRenderObject(casing: Casing): CasingRenderObject {
|
|
571
759
|
const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
|
|
572
|
-
return prepareCasingRenderObject(
|
|
760
|
+
return prepareCasingRenderObject(
|
|
761
|
+
exaggerationFactor,
|
|
762
|
+
casing,
|
|
763
|
+
this.getZFactorScaledPathForPoints,
|
|
764
|
+
);
|
|
573
765
|
}
|
|
574
766
|
|
|
575
767
|
private getCementPlugTexture(cementPlugOptions: CementPlugOptions): Texture {
|
|
@@ -579,12 +771,17 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
579
771
|
return this.cementPlugTextureCache;
|
|
580
772
|
}
|
|
581
773
|
|
|
582
|
-
private prepareSymbolRenderObject = (
|
|
774
|
+
private prepareSymbolRenderObject = (
|
|
775
|
+
component: CompletionSymbol | PAndASymbol,
|
|
776
|
+
): SymbolRenderObject => {
|
|
583
777
|
const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
|
|
584
778
|
|
|
585
779
|
const exaggeratedDiameter = component.diameter * exaggerationFactor;
|
|
586
780
|
|
|
587
|
-
const pathPoints = this.getZFactorScaledPathForPoints(
|
|
781
|
+
const pathPoints = this.getZFactorScaledPathForPoints(
|
|
782
|
+
component.start,
|
|
783
|
+
component.end,
|
|
784
|
+
);
|
|
588
785
|
|
|
589
786
|
return {
|
|
590
787
|
pathPoints,
|
|
@@ -593,7 +790,11 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
593
790
|
};
|
|
594
791
|
};
|
|
595
792
|
|
|
596
|
-
private drawSymbolComponent = ({
|
|
793
|
+
private drawSymbolComponent = ({
|
|
794
|
+
pathPoints,
|
|
795
|
+
referenceDiameter,
|
|
796
|
+
symbolKey,
|
|
797
|
+
}: SymbolRenderObject): void => {
|
|
597
798
|
const texture = this.getSymbolTexture(symbolKey, referenceDiameter);
|
|
598
799
|
// The rope renders fine in CANVAS/fallback mode
|
|
599
800
|
this.drawSVGRope(pathPoints, texture!);
|
|
@@ -604,47 +805,92 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
604
805
|
return undefined;
|
|
605
806
|
}
|
|
606
807
|
|
|
607
|
-
const rope: UniformTextureStretchRope = new UniformTextureStretchRope(
|
|
808
|
+
const rope: UniformTextureStretchRope = new UniformTextureStretchRope(
|
|
809
|
+
texture,
|
|
810
|
+
path,
|
|
811
|
+
);
|
|
608
812
|
|
|
609
813
|
this.addChild(rope);
|
|
610
814
|
}
|
|
611
815
|
|
|
612
|
-
private getSymbolTexture(
|
|
613
|
-
|
|
614
|
-
|
|
816
|
+
private getSymbolTexture(
|
|
817
|
+
symbolKey: string,
|
|
818
|
+
diameter: number,
|
|
819
|
+
): Texture | undefined {
|
|
820
|
+
const baseTexture = this.textureSymbolCacheArray?.[symbolKey]?.source;
|
|
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;
|
|
615
828
|
}
|
|
616
829
|
|
|
617
|
-
private drawHoleSize = (
|
|
830
|
+
private drawHoleSize = (
|
|
831
|
+
maxHoleDiameter: number,
|
|
832
|
+
holeObject: HoleSize,
|
|
833
|
+
): void => {
|
|
618
834
|
if (holeObject == null) {
|
|
619
835
|
return;
|
|
620
836
|
}
|
|
621
837
|
|
|
622
|
-
const pathPoints = this.getZFactorScaledPathForPoints(
|
|
838
|
+
const pathPoints = this.getZFactorScaledPathForPoints(
|
|
839
|
+
holeObject.start,
|
|
840
|
+
holeObject.end,
|
|
841
|
+
);
|
|
623
842
|
if (pathPoints.length === 0) {
|
|
624
843
|
return;
|
|
625
844
|
}
|
|
626
845
|
|
|
627
|
-
const { exaggerationFactor = 1, holeOptions } = this
|
|
846
|
+
const { exaggerationFactor = 1, holeOptions } = this
|
|
847
|
+
.options as SchematicLayerOptions<T>;
|
|
628
848
|
const exaggeratedDiameter = holeObject.diameter * exaggerationFactor;
|
|
629
|
-
const { rightPath, leftPath } = createTubularRenderingObject(
|
|
630
|
-
|
|
849
|
+
const { rightPath, leftPath } = createTubularRenderingObject(
|
|
850
|
+
exaggeratedDiameter / 2,
|
|
851
|
+
pathPoints,
|
|
852
|
+
);
|
|
853
|
+
const texture = this.getHoleTexture(
|
|
854
|
+
holeOptions!,
|
|
855
|
+
exaggeratedDiameter,
|
|
856
|
+
maxHoleDiameter,
|
|
857
|
+
);
|
|
631
858
|
|
|
632
859
|
this.drawHoleRope(pathPoints, texture, maxHoleDiameter);
|
|
633
860
|
|
|
634
|
-
this.drawOutline(
|
|
861
|
+
this.drawOutline(
|
|
862
|
+
leftPath,
|
|
863
|
+
rightPath,
|
|
864
|
+
convertColor(holeOptions!.lineColor),
|
|
865
|
+
HOLE_OUTLINE * exaggerationFactor,
|
|
866
|
+
'TopAndBottom',
|
|
867
|
+
0,
|
|
868
|
+
);
|
|
635
869
|
};
|
|
636
870
|
|
|
637
|
-
private drawHoleRope(
|
|
871
|
+
private drawHoleRope(
|
|
872
|
+
path: Point[],
|
|
873
|
+
texture: Texture,
|
|
874
|
+
maxHoleDiameter: number,
|
|
875
|
+
): void {
|
|
638
876
|
if (path.length === 0) {
|
|
639
877
|
return undefined;
|
|
640
878
|
}
|
|
641
879
|
|
|
642
|
-
const rope:
|
|
880
|
+
const rope: MeshRope = new MeshRope({
|
|
881
|
+
texture,
|
|
882
|
+
points: path,
|
|
883
|
+
textureScale: maxHoleDiameter / DEFAULT_TEXTURE_SIZE,
|
|
884
|
+
});
|
|
643
885
|
|
|
644
886
|
this.addChild(rope);
|
|
645
887
|
}
|
|
646
888
|
|
|
647
|
-
private getHoleTexture(
|
|
889
|
+
private getHoleTexture(
|
|
890
|
+
holeOptions: HoleOptions,
|
|
891
|
+
diameter: number,
|
|
892
|
+
maxHoleDiameter: number,
|
|
893
|
+
): Texture {
|
|
648
894
|
const size = DEFAULT_TEXTURE_SIZE;
|
|
649
895
|
const height = size;
|
|
650
896
|
const width = size;
|
|
@@ -655,10 +901,13 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
655
901
|
this.holeTextureCache = createHoleBaseTexture(holeOptions, width, height);
|
|
656
902
|
}
|
|
657
903
|
|
|
658
|
-
const baseTexture = this.holeTextureCache.
|
|
904
|
+
const baseTexture = this.holeTextureCache.source;
|
|
659
905
|
const sidePadding = (height - textureDiameter) / 2;
|
|
660
906
|
const frame = new Rectangle(0, sidePadding, width, textureDiameter);
|
|
661
|
-
const texture = new Texture(
|
|
907
|
+
const texture = new Texture({
|
|
908
|
+
source: baseTexture,
|
|
909
|
+
frame,
|
|
910
|
+
});
|
|
662
911
|
|
|
663
912
|
return texture;
|
|
664
913
|
}
|
|
@@ -684,26 +933,48 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
684
933
|
let zIndex = 0;
|
|
685
934
|
|
|
686
935
|
const { result } = casingRenderObjects.reduce(
|
|
687
|
-
(
|
|
688
|
-
|
|
689
|
-
|
|
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
|
+
);
|
|
690
946
|
|
|
691
947
|
if (foundCementShape) {
|
|
692
948
|
foundCementShape.zIndex = zIndex++;
|
|
693
949
|
}
|
|
694
|
-
foundCementSqueezes.forEach(
|
|
950
|
+
foundCementSqueezes.forEach(item => (item.zIndex = zIndex++));
|
|
695
951
|
casingRenderObject.zIndex = zIndex++;
|
|
696
952
|
|
|
697
953
|
return {
|
|
698
|
-
result: [
|
|
699
|
-
|
|
700
|
-
|
|
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
|
+
),
|
|
701
966
|
};
|
|
702
967
|
},
|
|
703
|
-
{
|
|
968
|
+
{
|
|
969
|
+
result: [],
|
|
970
|
+
remainingCement: cementRenderObject,
|
|
971
|
+
remainingCementSqueezes: cementSqueezes,
|
|
972
|
+
},
|
|
704
973
|
);
|
|
705
974
|
|
|
706
|
-
return result
|
|
975
|
+
return result
|
|
976
|
+
.filter((item): item is InterlacedRenderObjects => item != null)
|
|
977
|
+
.sort((a, b) => a.zIndex! - b.zIndex!);
|
|
707
978
|
}
|
|
708
979
|
|
|
709
980
|
/**
|
|
@@ -715,7 +986,10 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
715
986
|
* @param getExaggerationFactor
|
|
716
987
|
* @returns
|
|
717
988
|
*/
|
|
718
|
-
private drawComplexRope(
|
|
989
|
+
private drawComplexRope(
|
|
990
|
+
intervals: ComplexRopeSegment[],
|
|
991
|
+
texture: Texture,
|
|
992
|
+
): ComplexRope | undefined {
|
|
719
993
|
if (intervals.length === 0) {
|
|
720
994
|
return undefined;
|
|
721
995
|
}
|
|
@@ -726,7 +1000,10 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
726
1000
|
return rope;
|
|
727
1001
|
}
|
|
728
1002
|
|
|
729
|
-
private static getOutlineClosureType = (
|
|
1003
|
+
private static getOutlineClosureType = (
|
|
1004
|
+
index: number,
|
|
1005
|
+
maxIndex: number,
|
|
1006
|
+
): OutlineClosure => {
|
|
730
1007
|
if (index === 0) {
|
|
731
1008
|
if (index === maxIndex) {
|
|
732
1009
|
return 'TopAndBottom';
|
|
@@ -746,47 +1023,90 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
746
1023
|
const casingLineColorNumber = convertColor(casingOptions!.lineColor);
|
|
747
1024
|
|
|
748
1025
|
casingRenderObject.sections.forEach((section, index, list) => {
|
|
749
|
-
const outlineClosureType = SchematicLayer.getOutlineClosureType(
|
|
1026
|
+
const outlineClosureType = SchematicLayer.getOutlineClosureType(
|
|
1027
|
+
index,
|
|
1028
|
+
list.length - 1,
|
|
1029
|
+
);
|
|
750
1030
|
|
|
751
|
-
const texture = this.createCasingTexture(
|
|
1031
|
+
const texture = this.createCasingTexture(
|
|
1032
|
+
casingRenderObject.referenceDiameter,
|
|
1033
|
+
);
|
|
752
1034
|
this.drawRope(section.pathPoints, texture, casingSolidColorNumber);
|
|
753
1035
|
|
|
754
1036
|
if (section.kind === 'casing-window') {
|
|
755
|
-
this.drawCasingWindowOutline(
|
|
1037
|
+
this.drawCasingWindowOutline(
|
|
1038
|
+
section.leftPath,
|
|
1039
|
+
section.rightPath,
|
|
1040
|
+
casingOptions!,
|
|
1041
|
+
casingRenderObject.casingWallWidth,
|
|
1042
|
+
);
|
|
756
1043
|
} else {
|
|
757
|
-
this.drawOutline(
|
|
1044
|
+
this.drawOutline(
|
|
1045
|
+
section.leftPath,
|
|
1046
|
+
section.rightPath,
|
|
1047
|
+
casingLineColorNumber,
|
|
1048
|
+
casingRenderObject.casingWallWidth,
|
|
1049
|
+
outlineClosureType,
|
|
1050
|
+
);
|
|
758
1051
|
}
|
|
759
1052
|
});
|
|
760
1053
|
};
|
|
761
1054
|
|
|
762
1055
|
private createCasingTexture(diameter: number): Texture {
|
|
763
1056
|
const textureWidthPO2 = 16;
|
|
764
|
-
return new Texture(
|
|
1057
|
+
return new Texture({
|
|
1058
|
+
source: Texture.WHITE.source,
|
|
1059
|
+
orig: new Rectangle(0, 0, textureWidthPO2, diameter),
|
|
1060
|
+
});
|
|
765
1061
|
}
|
|
766
1062
|
|
|
767
1063
|
private drawShoe(casingEnd: number, casingRadius: number): void {
|
|
768
|
-
const { exaggerationFactor = 1, casingOptions } = this
|
|
1064
|
+
const { exaggerationFactor = 1, casingOptions } = this
|
|
1065
|
+
.options as SchematicLayerOptions<T>;
|
|
769
1066
|
const shoeWidth = casingOptions!.shoeSize.width * exaggerationFactor;
|
|
770
1067
|
const shoeLength = casingOptions!.shoeSize.length * exaggerationFactor;
|
|
771
1068
|
|
|
772
|
-
const shoeCoords = this.generateShoe(
|
|
773
|
-
|
|
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
|
+
);
|
|
774
1081
|
this.drawBigPolygon(shoeCoords2);
|
|
775
1082
|
this.drawBigPolygon(shoeCoords);
|
|
776
1083
|
}
|
|
777
1084
|
|
|
778
|
-
private generateShoe = (
|
|
1085
|
+
private generateShoe = (
|
|
1086
|
+
casingEnd: number,
|
|
1087
|
+
casingRadius: number,
|
|
1088
|
+
length: number,
|
|
1089
|
+
width: number,
|
|
1090
|
+
): Point[] => {
|
|
779
1091
|
const start = casingEnd - length;
|
|
780
1092
|
const end = casingEnd;
|
|
781
1093
|
|
|
782
1094
|
const points = this.getZFactorScaledPathForPoints(start, end);
|
|
783
1095
|
|
|
784
1096
|
const normal = createNormals(points);
|
|
785
|
-
const shoeEdge: Point[] = offsetPoints(
|
|
1097
|
+
const shoeEdge: Point[] = offsetPoints(
|
|
1098
|
+
points,
|
|
1099
|
+
normal,
|
|
1100
|
+
casingRadius * (width < 0 ? -1 : 1),
|
|
1101
|
+
);
|
|
786
1102
|
|
|
787
1103
|
const shoeTipPoint = points[points.length - 1]!;
|
|
788
1104
|
const shoeTipNormal = normal[normal.length - 1]!;
|
|
789
|
-
const shoeTip: Point = offsetPoint(
|
|
1105
|
+
const shoeTip: Point = offsetPoint(
|
|
1106
|
+
shoeTipPoint,
|
|
1107
|
+
shoeTipNormal,
|
|
1108
|
+
width + casingRadius * (width < 0 ? -1 : 1),
|
|
1109
|
+
);
|
|
790
1110
|
|
|
791
1111
|
return [...shoeEdge, shoeTip];
|
|
792
1112
|
};
|
|
@@ -798,46 +1118,77 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
798
1118
|
holes: HoleSize[],
|
|
799
1119
|
): ComplexRopeSegment[] => {
|
|
800
1120
|
const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
|
|
801
|
-
return createComplexRopeSegmentsForCementSqueeze(
|
|
1121
|
+
return createComplexRopeSegmentsForCementSqueeze(
|
|
1122
|
+
squeeze,
|
|
1123
|
+
casings,
|
|
1124
|
+
completion,
|
|
1125
|
+
holes,
|
|
1126
|
+
exaggerationFactor,
|
|
1127
|
+
this.getZFactorScaledPathForPoints,
|
|
1128
|
+
);
|
|
802
1129
|
};
|
|
803
1130
|
|
|
804
1131
|
private getCementTexture(): Texture | null {
|
|
805
1132
|
if (!this.cementTextureCache) {
|
|
806
1133
|
const { cementOptions } = this.options as SchematicLayerOptions<T>;
|
|
807
|
-
cementOptions &&
|
|
1134
|
+
cementOptions &&
|
|
1135
|
+
(this.cementTextureCache = createCementTexture(cementOptions));
|
|
808
1136
|
}
|
|
809
1137
|
return this.cementTextureCache;
|
|
810
1138
|
}
|
|
811
1139
|
|
|
812
|
-
private createPerforationShape = (
|
|
1140
|
+
private createPerforationShape = (
|
|
1141
|
+
perforation: Perforation,
|
|
1142
|
+
casings: Casing[],
|
|
1143
|
+
holes: HoleSize[],
|
|
1144
|
+
): PerforationShape[] => {
|
|
813
1145
|
const { exaggerationFactor = 1 } = this.options as SchematicLayerOptions<T>;
|
|
814
|
-
return createComplexRopeSegmentsForPerforation(
|
|
1146
|
+
return createComplexRopeSegmentsForPerforation(
|
|
1147
|
+
perforation,
|
|
1148
|
+
casings,
|
|
1149
|
+
holes,
|
|
1150
|
+
exaggerationFactor,
|
|
1151
|
+
this.getZFactorScaledPathForPoints,
|
|
1152
|
+
);
|
|
815
1153
|
};
|
|
816
1154
|
|
|
817
1155
|
private getCementSqueezeTexture(): Texture | null {
|
|
818
1156
|
if (!this.cementSqueezeTextureCache) {
|
|
819
1157
|
const { cementSqueezeOptions } = this.options as SchematicLayerOptions<T>;
|
|
820
|
-
cementSqueezeOptions &&
|
|
1158
|
+
cementSqueezeOptions &&
|
|
1159
|
+
(this.cementSqueezeTextureCache =
|
|
1160
|
+
createCementSqueezeTexture(cementSqueezeOptions));
|
|
821
1161
|
}
|
|
822
1162
|
return this.cementSqueezeTextureCache;
|
|
823
1163
|
}
|
|
824
1164
|
|
|
825
1165
|
private drawScreen({ start, end, diameter }: Screen): void {
|
|
826
|
-
const { exaggerationFactor = 1, screenOptions } = this
|
|
1166
|
+
const { exaggerationFactor = 1, screenOptions } = this
|
|
1167
|
+
.options as SchematicLayerOptions<T>;
|
|
827
1168
|
const exaggeratedDiameter = exaggerationFactor * diameter;
|
|
828
1169
|
|
|
829
1170
|
const pathPoints = this.getZFactorScaledPathForPoints(start, end);
|
|
830
|
-
const { leftPath, rightPath } = createTubularRenderingObject(
|
|
1171
|
+
const { leftPath, rightPath } = createTubularRenderingObject(
|
|
1172
|
+
exaggeratedDiameter / 2,
|
|
1173
|
+
pathPoints,
|
|
1174
|
+
);
|
|
831
1175
|
|
|
832
1176
|
const texture = this.getScreenTexture();
|
|
833
1177
|
if (texture) {
|
|
834
1178
|
this.drawCompletionRope(pathPoints, texture, exaggeratedDiameter);
|
|
835
|
-
this.drawOutline(
|
|
1179
|
+
this.drawOutline(
|
|
1180
|
+
leftPath,
|
|
1181
|
+
rightPath,
|
|
1182
|
+
convertColor(screenOptions!.lineColor),
|
|
1183
|
+
SCREEN_OUTLINE * exaggerationFactor,
|
|
1184
|
+
'TopAndBottom',
|
|
1185
|
+
);
|
|
836
1186
|
}
|
|
837
1187
|
}
|
|
838
1188
|
|
|
839
1189
|
private drawTubing({ diameter, start, end }: Tubing): void {
|
|
840
|
-
const { exaggerationFactor = 1, tubingOptions } = this
|
|
1190
|
+
const { exaggerationFactor = 1, tubingOptions } = this
|
|
1191
|
+
.options as SchematicLayerOptions<T>;
|
|
841
1192
|
const exaggeratedDiameter = exaggerationFactor * diameter;
|
|
842
1193
|
|
|
843
1194
|
const pathPoints = this.getZFactorScaledPathForPoints(start, end);
|
|
@@ -856,17 +1207,26 @@ export class SchematicLayer<T extends SchematicData> extends PixiLayer<T> {
|
|
|
856
1207
|
private getScreenTexture(): Texture | null {
|
|
857
1208
|
if (!this.screenTextureCache) {
|
|
858
1209
|
const { screenOptions } = this.options as SchematicLayerOptions<T>;
|
|
859
|
-
screenOptions &&
|
|
1210
|
+
screenOptions &&
|
|
1211
|
+
(this.screenTextureCache = createScreenTexture(screenOptions));
|
|
860
1212
|
}
|
|
861
1213
|
return this.screenTextureCache;
|
|
862
1214
|
}
|
|
863
1215
|
|
|
864
|
-
private drawCompletionRope(
|
|
1216
|
+
private drawCompletionRope(
|
|
1217
|
+
path: Point[],
|
|
1218
|
+
texture: Texture,
|
|
1219
|
+
diameter: number,
|
|
1220
|
+
): void {
|
|
865
1221
|
if (path.length === 0) {
|
|
866
1222
|
return;
|
|
867
1223
|
}
|
|
868
1224
|
|
|
869
|
-
const rope: FixedWidthSimpleRope = new FixedWidthSimpleRope(
|
|
1225
|
+
const rope: FixedWidthSimpleRope = new FixedWidthSimpleRope(
|
|
1226
|
+
texture,
|
|
1227
|
+
path,
|
|
1228
|
+
diameter,
|
|
1229
|
+
);
|
|
870
1230
|
this.addChild(rope);
|
|
871
1231
|
}
|
|
872
1232
|
}
|