@equinor/esv-intersection 3.0.9 → 3.0.11
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/control/ExtendedCurveInterpolator.d.ts +0 -1
- package/dist/index.cjs +2 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.mjs +2188 -2087
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/interfaces.d.ts +1 -3
- package/dist/utils/arc-length.d.ts +0 -1
- package/dist/utils/binary-search.d.ts +0 -1
- package/dist/utils/root-finder.d.ts +1 -2
- package/package.json +25 -25
- package/src/components/axis.ts +23 -30
- package/src/control/ExtendedCurveInterpolator.ts +7 -7
- package/src/control/IntersectionReferenceSystem.ts +33 -41
- package/src/control/LayerManager.ts +33 -31
- package/src/control/MainController.ts +5 -7
- package/src/control/ZoomPanHandler.ts +50 -45
- package/src/control/interfaces.ts +3 -3
- package/src/control/overlay.ts +42 -35
- package/src/datautils/colortable.ts +4 -4
- package/src/datautils/findsample.ts +8 -7
- package/src/datautils/picks.ts +13 -13
- package/src/datautils/schematicShapeGenerator.ts +47 -17
- package/src/datautils/seismicimage.ts +12 -13
- package/src/datautils/surfacedata.ts +27 -26
- package/src/datautils/trajectory.ts +34 -32
- package/src/interfaces.ts +1 -1
- package/src/layers/CalloutCanvasLayer.ts +55 -58
- package/src/layers/CustomDisplayObjects/ComplexRopeGeometry.ts +23 -20
- package/src/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.ts +9 -10
- package/src/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.ts +13 -13
- package/src/layers/GeomodelCanvasLayer.ts +43 -36
- package/src/layers/GeomodelLabelsLayer.ts +99 -96
- package/src/layers/GeomodelLayerV2.ts +11 -11
- package/src/layers/GridLayer.ts +25 -21
- package/src/layers/ImageCanvasLayer.ts +17 -11
- package/src/layers/ReferenceLineLayer.ts +53 -45
- package/src/layers/SchematicLayer.ts +78 -75
- package/src/layers/WellborePathLayer.ts +48 -46
- package/src/layers/base/CanvasLayer.ts +18 -18
- package/src/layers/base/HTMLLayer.ts +5 -5
- package/src/layers/base/Layer.ts +18 -18
- package/src/layers/base/PixiLayer.ts +24 -20
- package/src/layers/base/SVGLayer.ts +5 -5
- package/src/utils/arc-length.ts +3 -10
- package/src/utils/binary-search.ts +2 -2
- package/src/utils/color.ts +9 -5
- package/src/utils/root-finder.ts +4 -4
- package/src/utils/text.ts +5 -5
- package/src/utils/vectorUtils.ts +13 -6
- package/src/vendor/pixi-dashed-line/index.ts +3 -2
- package/dist/components/axis.d.ts +0 -48
- package/dist/components/axis.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.d.ts.map +0 -1
- package/dist/constants.d.ts +0 -12
- package/dist/constants.d.ts.map +0 -1
- package/dist/control/ExtendedCurveInterpolator.d.ts.map +0 -1
- package/dist/control/IntersectionReferenceSystem.d.ts +0 -97
- package/dist/control/IntersectionReferenceSystem.d.ts.map +0 -1
- package/dist/control/LayerManager.d.ts +0 -77
- package/dist/control/LayerManager.d.ts.map +0 -1
- package/dist/control/MainController.d.ts +0 -155
- package/dist/control/MainController.d.ts.map +0 -1
- package/dist/control/ZoomPanHandler.d.ts +0 -159
- package/dist/control/ZoomPanHandler.d.ts.map +0 -1
- package/dist/control/index.d.ts +0 -6
- package/dist/control/index.d.ts.map +0 -1
- package/dist/control/interfaces.d.ts +0 -38
- package/dist/control/interfaces.d.ts.map +0 -1
- package/dist/control/overlay.d.ts +0 -21
- package/dist/control/overlay.d.ts.map +0 -1
- package/dist/datautils/colortable.d.ts +0 -2
- package/dist/datautils/colortable.d.ts.map +0 -1
- package/dist/datautils/findsample.d.ts +0 -3
- package/dist/datautils/findsample.d.ts.map +0 -1
- package/dist/datautils/index.d.ts +0 -7
- package/dist/datautils/index.d.ts.map +0 -1
- package/dist/datautils/interfaces.d.ts +0 -64
- package/dist/datautils/interfaces.d.ts.map +0 -1
- package/dist/datautils/picks.d.ts +0 -75
- package/dist/datautils/picks.d.ts.map +0 -1
- package/dist/datautils/schematicShapeGenerator.d.ts +0 -60
- package/dist/datautils/schematicShapeGenerator.d.ts.map +0 -1
- package/dist/datautils/seismicimage.d.ts +0 -46
- package/dist/datautils/seismicimage.d.ts.map +0 -1
- package/dist/datautils/surfacedata.d.ts +0 -11
- package/dist/datautils/surfacedata.d.ts.map +0 -1
- package/dist/datautils/trajectory.d.ts +0 -15
- package/dist/datautils/trajectory.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces.d.ts.map +0 -1
- package/dist/layers/CalloutCanvasLayer.d.ts +0 -61
- package/dist/layers/CalloutCanvasLayer.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts +0 -22
- package/dist/layers/CustomDisplayObjects/ComplexRope.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts +0 -24
- package/dist/layers/CustomDisplayObjects/ComplexRopeGeometry.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts +0 -21
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRope.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts +0 -27
- package/dist/layers/CustomDisplayObjects/FixedWidthSimpleRopeGeometry.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts +0 -18
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRope.d.ts.map +0 -1
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.d.ts +0 -25
- package/dist/layers/CustomDisplayObjects/UniformTextureStretchRopeGeometry.d.ts.map +0 -1
- package/dist/layers/GeomodelCanvasLayer.d.ts +0 -29
- package/dist/layers/GeomodelCanvasLayer.d.ts.map +0 -1
- package/dist/layers/GeomodelLabelsLayer.d.ts +0 -50
- package/dist/layers/GeomodelLabelsLayer.d.ts.map +0 -1
- package/dist/layers/GeomodelLayerV2.d.ts +0 -13
- package/dist/layers/GeomodelLayerV2.d.ts.map +0 -1
- package/dist/layers/GridLayer.d.ts +0 -30
- package/dist/layers/GridLayer.d.ts.map +0 -1
- package/dist/layers/ImageCanvasLayer.d.ts +0 -21
- package/dist/layers/ImageCanvasLayer.d.ts.map +0 -1
- package/dist/layers/ReferenceLineLayer.d.ts +0 -30
- package/dist/layers/ReferenceLineLayer.d.ts.map +0 -1
- package/dist/layers/SchematicLayer.d.ts +0 -114
- package/dist/layers/SchematicLayer.d.ts.map +0 -1
- package/dist/layers/SeismicCanvasLayer.d.ts +0 -19
- package/dist/layers/SeismicCanvasLayer.d.ts.map +0 -1
- package/dist/layers/WellborePathLayer.d.ts +0 -18
- package/dist/layers/WellborePathLayer.d.ts.map +0 -1
- package/dist/layers/base/CanvasLayer.d.ts +0 -20
- package/dist/layers/base/CanvasLayer.d.ts.map +0 -1
- package/dist/layers/base/HTMLLayer.d.ts +0 -14
- package/dist/layers/base/HTMLLayer.d.ts.map +0 -1
- package/dist/layers/base/Layer.d.ts +0 -70
- package/dist/layers/base/Layer.d.ts.map +0 -1
- package/dist/layers/base/PixiLayer.d.ts +0 -33
- package/dist/layers/base/PixiLayer.d.ts.map +0 -1
- package/dist/layers/base/SVGLayer.d.ts +0 -14
- package/dist/layers/base/SVGLayer.d.ts.map +0 -1
- package/dist/layers/base/index.d.ts +0 -6
- package/dist/layers/base/index.d.ts.map +0 -1
- package/dist/layers/index.d.ts +0 -17
- package/dist/layers/index.d.ts.map +0 -1
- package/dist/layers/schematicInterfaces.d.ts +0 -210
- package/dist/layers/schematicInterfaces.d.ts.map +0 -1
- package/dist/utils/arc-length.d.ts.map +0 -1
- package/dist/utils/binary-search.d.ts.map +0 -1
- package/dist/utils/color.d.ts +0 -6
- package/dist/utils/color.d.ts.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/root-finder.d.ts.map +0 -1
- package/dist/utils/text.d.ts +0 -15
- package/dist/utils/text.d.ts.map +0 -1
- package/dist/utils/vectorUtils.d.ts +0 -16
- package/dist/utils/vectorUtils.d.ts.map +0 -1
- package/dist/vendor/pixi-dashed-line/index.d.ts +0 -57
- package/dist/vendor/pixi-dashed-line/index.d.ts.map +0 -1
|
@@ -51,15 +51,15 @@ export interface CasingRenderObject {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
export const getEndLines = (
|
|
54
|
-
rightPath: IPoint[],
|
|
55
|
-
leftPath: IPoint[],
|
|
54
|
+
rightPath: [IPoint, IPoint, ...IPoint[]],
|
|
55
|
+
leftPath: [IPoint, IPoint, ...IPoint[]],
|
|
56
56
|
): {
|
|
57
|
-
top: IPoint
|
|
58
|
-
bottom: IPoint
|
|
57
|
+
top: [IPoint, IPoint];
|
|
58
|
+
bottom: [IPoint, IPoint];
|
|
59
59
|
} => {
|
|
60
60
|
return {
|
|
61
61
|
top: [rightPath[0], leftPath[0]],
|
|
62
|
-
bottom: [rightPath[rightPath.length - 1], leftPath[leftPath.length - 1]],
|
|
62
|
+
bottom: [rightPath[rightPath.length - 1] as IPoint, leftPath[leftPath.length - 1] as IPoint],
|
|
63
63
|
};
|
|
64
64
|
};
|
|
65
65
|
|
|
@@ -215,8 +215,8 @@ export const createComplexRopeSegmentsForCement = (
|
|
|
215
215
|
throw new Error(`Invalid cement data, can't find referenced casing/completion string for cement with id '${cement.id}'`);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
attachedStrings.sort((a
|
|
219
|
-
const bottomOfCement = attachedStrings[attachedStrings.length - 1]
|
|
218
|
+
attachedStrings.sort((a, b) => a.end - b.end); // ascending
|
|
219
|
+
const bottomOfCement = attachedStrings[attachedStrings.length - 1]!.end;
|
|
220
220
|
|
|
221
221
|
const { overlappingOuterStrings, overlappingHoles } = findIntersectingItems(cement.toc, bottomOfCement, nonAttachedStrings, holes);
|
|
222
222
|
|
|
@@ -232,7 +232,7 @@ export const createComplexRopeSegmentsForCement = (
|
|
|
232
232
|
return [];
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
const nextDepth = list[index + 1]
|
|
235
|
+
const nextDepth = list[index + 1]!;
|
|
236
236
|
const diameterAtChangeDepth = findCementOuterDiameterAtDepth(attachedStrings, overlappingOuterStrings, overlappingHoles, depth);
|
|
237
237
|
|
|
238
238
|
return [{ top: depth, bottom: nextDepth, diameter: diameterAtChangeDepth * exaggerationFactor }];
|
|
@@ -258,7 +258,7 @@ const splitByReferencedStrings = (
|
|
|
258
258
|
}
|
|
259
259
|
return { ...acc, nonAttachedStrings: [...acc.nonAttachedStrings, current] };
|
|
260
260
|
},
|
|
261
|
-
{ attachedStrings: [], nonAttachedStrings: [] },
|
|
261
|
+
{ attachedStrings: [] as (Casing | Completion)[], nonAttachedStrings: [] as (Casing | Completion)[] },
|
|
262
262
|
);
|
|
263
263
|
|
|
264
264
|
export const createComplexRopeSegmentsForCementSqueeze = (
|
|
@@ -289,7 +289,7 @@ export const createComplexRopeSegmentsForCementSqueeze = (
|
|
|
289
289
|
return [];
|
|
290
290
|
}
|
|
291
291
|
|
|
292
|
-
const nextDepth = list[index + 1]
|
|
292
|
+
const nextDepth = list[index + 1]!;
|
|
293
293
|
|
|
294
294
|
const diameterAtDepth = findCementOuterDiameterAtDepth(attachedStrings, overlappingOuterStrings, overlappingHoles, depth);
|
|
295
295
|
|
|
@@ -327,7 +327,7 @@ export const createComplexRopeSegmentsForCementPlug = (
|
|
|
327
327
|
return [];
|
|
328
328
|
}
|
|
329
329
|
|
|
330
|
-
const nextDepth = list[index + 1]
|
|
330
|
+
const nextDepth = list[index + 1]!;
|
|
331
331
|
const diameterAtDepth = findCementPlugInnerDiameterAtDepth(attachedStrings, overlappingOuterStrings, overlappingHoles, depth);
|
|
332
332
|
|
|
333
333
|
return [{ top: depth, bottom: nextDepth, diameter: diameterAtDepth * exaggerationFactor }];
|
|
@@ -364,6 +364,10 @@ export const createHoleBaseTexture = ({ firstColor, secondColor }: HoleOptions,
|
|
|
364
364
|
canvas.height = height;
|
|
365
365
|
const canvasCtx = canvas.getContext('2d');
|
|
366
366
|
|
|
367
|
+
if (canvasCtx == null) {
|
|
368
|
+
throw Error('Could not get canvas context!');
|
|
369
|
+
}
|
|
370
|
+
|
|
367
371
|
canvasCtx.fillStyle = createGradientFill(canvas, canvasCtx, firstColor, secondColor, 0);
|
|
368
372
|
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
|
|
369
373
|
|
|
@@ -376,6 +380,9 @@ export const createScreenTexture = ({ scalingFactor }: ScreenOptions): Texture =
|
|
|
376
380
|
canvas.width = size;
|
|
377
381
|
canvas.height = size;
|
|
378
382
|
const canvasCtx = canvas.getContext('2d');
|
|
383
|
+
if (canvasCtx == null) {
|
|
384
|
+
throw Error('Could not get canvas context!');
|
|
385
|
+
}
|
|
379
386
|
|
|
380
387
|
canvasCtx.fillStyle = 'white';
|
|
381
388
|
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
|
|
@@ -401,6 +408,10 @@ export const createTubingTexture = ({ innerColor, outerColor, scalingFactor }: T
|
|
|
401
408
|
canvas.width = size;
|
|
402
409
|
canvas.height = size;
|
|
403
410
|
const canvasCtx = canvas.getContext('2d');
|
|
411
|
+
|
|
412
|
+
if (canvasCtx == null) {
|
|
413
|
+
throw Error('Could not get canvas context!');
|
|
414
|
+
}
|
|
404
415
|
const gradient = canvasCtx.createLinearGradient(0, 0, 0, size);
|
|
405
416
|
|
|
406
417
|
const innerColorStart = 0.3;
|
|
@@ -425,6 +436,10 @@ export const createCementTexture = ({ firstColor, secondColor, scalingFactor }:
|
|
|
425
436
|
canvas.height = size;
|
|
426
437
|
const canvasCtx = canvas.getContext('2d');
|
|
427
438
|
|
|
439
|
+
if (canvasCtx == null) {
|
|
440
|
+
throw Error('Could not get canvas context!');
|
|
441
|
+
}
|
|
442
|
+
|
|
428
443
|
canvasCtx.fillStyle = firstColor;
|
|
429
444
|
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
|
|
430
445
|
canvasCtx.lineWidth = lineWidth;
|
|
@@ -449,6 +464,10 @@ export const createCementPlugTexture = ({ firstColor, secondColor, scalingFactor
|
|
|
449
464
|
canvas.height = size;
|
|
450
465
|
const canvasCtx = canvas.getContext('2d');
|
|
451
466
|
|
|
467
|
+
if (canvasCtx == null) {
|
|
468
|
+
throw Error('Could not get canvas context!');
|
|
469
|
+
}
|
|
470
|
+
|
|
452
471
|
canvasCtx.fillStyle = firstColor;
|
|
453
472
|
canvasCtx.fillRect(0, 0, canvas.width, canvas.height);
|
|
454
473
|
canvasCtx.lineWidth = scalingFactor;
|
|
@@ -475,6 +494,10 @@ export const createCementSqueezeTexture = ({ firstColor, secondColor, scalingFac
|
|
|
475
494
|
canvas.height = size;
|
|
476
495
|
|
|
477
496
|
const canvasCtx = canvas.getContext('2d');
|
|
497
|
+
if (canvasCtx == null) {
|
|
498
|
+
throw Error('Could not get canvas context!');
|
|
499
|
+
}
|
|
500
|
+
|
|
478
501
|
canvasCtx.lineWidth = lineWidth;
|
|
479
502
|
canvasCtx.fillStyle = firstColor;
|
|
480
503
|
canvasCtx.strokeStyle = secondColor;
|
|
@@ -535,7 +558,7 @@ export const getCasingIntervalsWithWindows = (casing: Casing): CasingInterval[]
|
|
|
535
558
|
? createCasingInterval(nextLastBottom, casing.end)
|
|
536
559
|
: null;
|
|
537
560
|
|
|
538
|
-
const newIntervals: CasingInterval[] = [startCasingInterval, windowInterval, endCasingInterval].filter((i) => i);
|
|
561
|
+
const newIntervals: CasingInterval[] = [startCasingInterval, windowInterval, endCasingInterval].filter((i): i is CasingInterval => i != null);
|
|
539
562
|
|
|
540
563
|
return { intervals: [...intervals, ...newIntervals], lastBottom: nextLastBottom };
|
|
541
564
|
},
|
|
@@ -599,7 +622,7 @@ export const createComplexRopeSegmentsForPerforation = (
|
|
|
599
622
|
return [];
|
|
600
623
|
}
|
|
601
624
|
|
|
602
|
-
const nextDepth = list[index + 1]
|
|
625
|
+
const nextDepth = list[index + 1]!;
|
|
603
626
|
|
|
604
627
|
const diameterAtDepth = findPerforationOuterDiameterAtDepth(overlappingOuterStrings, overlappingHoles, depth, perforation.subKind);
|
|
605
628
|
|
|
@@ -769,14 +792,17 @@ const errorTexture = (errorMessage = 'Error!', existingContext?: { canvas: HTMLC
|
|
|
769
792
|
const xy: [number, number] = [0, 0];
|
|
770
793
|
const wh: [number, number] = [canvas.width, canvas.height];
|
|
771
794
|
|
|
795
|
+
if (canvasCtx == null) {
|
|
796
|
+
throw Error('Could not get canvas context!');
|
|
797
|
+
}
|
|
772
798
|
canvasCtx.fillStyle = '#ff00ff';
|
|
773
799
|
canvasCtx.fillRect(...xy, ...wh);
|
|
774
800
|
|
|
775
801
|
const texture = new Texture(
|
|
776
802
|
Texture.from(canvas, { wrapMode: WRAP_MODES.CLAMP }).baseTexture,
|
|
777
|
-
|
|
803
|
+
undefined,
|
|
778
804
|
new Rectangle(0, 0, canvas.width, canvas.height),
|
|
779
|
-
|
|
805
|
+
undefined,
|
|
780
806
|
groupD8.MIRROR_HORIZONTAL,
|
|
781
807
|
);
|
|
782
808
|
return texture;
|
|
@@ -793,15 +819,19 @@ const createPerforationCanvas = (
|
|
|
793
819
|
canvas.height = size;
|
|
794
820
|
const ctx = canvas.getContext('2d');
|
|
795
821
|
|
|
822
|
+
if (ctx == null) {
|
|
823
|
+
throw Error('Could not get canvas context!');
|
|
824
|
+
}
|
|
825
|
+
|
|
796
826
|
return { canvas, ctx };
|
|
797
827
|
};
|
|
798
828
|
|
|
799
829
|
const createPerforationTexture = (canvas: HTMLCanvasElement) => {
|
|
800
830
|
const texture = new Texture(
|
|
801
831
|
Texture.from(canvas, { wrapMode: WRAP_MODES.CLAMP }).baseTexture,
|
|
802
|
-
|
|
832
|
+
undefined,
|
|
803
833
|
new Rectangle(0, 0, canvas.width, canvas.height),
|
|
804
|
-
|
|
834
|
+
undefined,
|
|
805
835
|
groupD8.MIRROR_HORIZONTAL,
|
|
806
836
|
);
|
|
807
837
|
return texture;
|
|
@@ -44,11 +44,11 @@ export function getSeismicInfo(data: { datapoints: number[][]; yAxisValues: numb
|
|
|
44
44
|
if (!(data && data.datapoints)) {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
|
-
const minX = trajectory.reduce((acc: number, val: number[]) => Math.min(acc, val[0]), 0);
|
|
48
|
-
const maxX = trajectory.reduce((acc: number, val: number[]) => Math.max(acc, val[0]), 0);
|
|
47
|
+
const minX = trajectory.reduce((acc: number, val: number[]) => Math.min(acc, val[0]!), 0);
|
|
48
|
+
const maxX = trajectory.reduce((acc: number, val: number[]) => Math.max(acc, val[0]!), 0);
|
|
49
49
|
|
|
50
|
-
const minTvdMsl = data.yAxisValues && data.yAxisValues[0]
|
|
51
|
-
const maxTvdMsl = data.yAxisValues && data.yAxisValues[data.yAxisValues.length - 1]
|
|
50
|
+
const minTvdMsl = data.yAxisValues && data.yAxisValues[0]!;
|
|
51
|
+
const maxTvdMsl = data.yAxisValues && data.yAxisValues[data.yAxisValues.length - 1]!;
|
|
52
52
|
|
|
53
53
|
// Find value domain
|
|
54
54
|
const dp = data.datapoints || [];
|
|
@@ -117,8 +117,7 @@ export async function generateSeismicSliceImage(
|
|
|
117
117
|
difference: dmax - dmin,
|
|
118
118
|
};
|
|
119
119
|
|
|
120
|
-
const length = trajectory[0][0] - trajectory[trajectory.length - 1][0]
|
|
121
|
-
// eslint-disable-next-line no-magic-numbers
|
|
120
|
+
const length = trajectory[0]?.[0]! - trajectory[trajectory.length - 1]?.[0]!;
|
|
122
121
|
const width = Math.abs(Math.floor(length / 5));
|
|
123
122
|
const height = data.yAxisValues.length;
|
|
124
123
|
|
|
@@ -132,7 +131,7 @@ export async function generateSeismicSliceImage(
|
|
|
132
131
|
let offset = 0;
|
|
133
132
|
const colorFactor = (colorTableSize - 1) / domain.difference;
|
|
134
133
|
|
|
135
|
-
let pos = options?.isLeftToRight ? trajectory[0][0] : trajectory[trajectory.length - 1][0]
|
|
134
|
+
let pos = options?.isLeftToRight ? trajectory[0]?.[0]! : trajectory[trajectory.length - 1]?.[0]!;
|
|
136
135
|
|
|
137
136
|
const step = (length / width) * (options?.isLeftToRight ? -1 : 1);
|
|
138
137
|
|
|
@@ -147,15 +146,15 @@ export async function generateSeismicSliceImage(
|
|
|
147
146
|
for (let x = 0; x < width; x++) {
|
|
148
147
|
offset = x * 4;
|
|
149
148
|
const index = findIndexOfSample(trajectory, pos);
|
|
150
|
-
const x1 = trajectory[index][0]
|
|
151
|
-
const x2 = trajectory[index + 1][0]
|
|
149
|
+
const x1 = trajectory[index]?.[0]!;
|
|
150
|
+
const x2 = trajectory[index + 1]?.[0]!;
|
|
152
151
|
const span = x2 - x1;
|
|
153
152
|
const dx = pos - x1;
|
|
154
153
|
const ratio = dx / span;
|
|
155
154
|
|
|
156
155
|
for (let y = 0; y < height; y++) {
|
|
157
|
-
val1 = dp[y][index]
|
|
158
|
-
val2 = dp[y][index + 1]
|
|
156
|
+
val1 = dp[y]?.[index]!;
|
|
157
|
+
val2 = dp[y]?.[index + 1]!;
|
|
159
158
|
if (val1 == null || val2 == null) {
|
|
160
159
|
col = black;
|
|
161
160
|
opacity = 0;
|
|
@@ -163,11 +162,11 @@ export async function generateSeismicSliceImage(
|
|
|
163
162
|
val = val1 * (1 - ratio) + val2 * ratio;
|
|
164
163
|
i = (val - domain.min) * colorFactor;
|
|
165
164
|
i = clamp(~~i, 0, colorTableSize - 1);
|
|
166
|
-
col = colorTable[i]
|
|
165
|
+
col = colorTable[i]!;
|
|
167
166
|
opacity = 255;
|
|
168
167
|
}
|
|
169
168
|
|
|
170
|
-
d.set([col[0]
|
|
169
|
+
d.set([col[0]!, col[1]!, col[2]!, opacity], offset);
|
|
171
170
|
|
|
172
171
|
offset += width * 4;
|
|
173
172
|
}
|
|
@@ -91,7 +91,7 @@ function getSurfaceLines(mappedSurfaces: MappedSurfaces[], trajectory: number[][
|
|
|
91
91
|
label: l.name,
|
|
92
92
|
width: 2,
|
|
93
93
|
color: convertColor(l.color || 'black'),
|
|
94
|
-
data: trajectory.map((p, j) => [p[0]
|
|
94
|
+
data: trajectory.map((p, j) => [p[0]!, l.values[j]!]),
|
|
95
95
|
}));
|
|
96
96
|
|
|
97
97
|
return lines;
|
|
@@ -99,13 +99,14 @@ function getSurfaceLines(mappedSurfaces: MappedSurfaces[], trajectory: number[][
|
|
|
99
99
|
|
|
100
100
|
function generateGroupAreas(groups: MappedGroup[], trajectory: number[][]): SurfaceArea[] {
|
|
101
101
|
const groupAreas = groups.map((g: MappedGroup, i: number) => {
|
|
102
|
-
const next: MappedGroup | null = i + 1 < groups.length ? groups[i + 1] : null;
|
|
102
|
+
const next: MappedGroup | null = i + 1 < groups.length ? groups[i + 1]! : null;
|
|
103
103
|
return {
|
|
104
104
|
id: g.id,
|
|
105
105
|
color: convertColor(g.color),
|
|
106
|
-
data: trajectory.map((p: number[], j: number) => [p[0]
|
|
106
|
+
data: trajectory.map((p: number[], j: number) => [p[0]!, g.top[j]!, ...(next ? [next.top[j]!] : [])]),
|
|
107
107
|
};
|
|
108
108
|
});
|
|
109
|
+
|
|
109
110
|
return groupAreas;
|
|
110
111
|
}
|
|
111
112
|
|
|
@@ -113,7 +114,7 @@ function mapGroups(stratGroups: Map<string, StratGroup>, surfaceAreas: SurfaceAr
|
|
|
113
114
|
const groups = Array.from(stratGroups.values())
|
|
114
115
|
.sort((a: StratGroup, b: StratGroup) => a.age - b.age)
|
|
115
116
|
.filter((g: StratGroup) => {
|
|
116
|
-
const surfaces
|
|
117
|
+
const surfaces = surfaceAreas[g.name];
|
|
117
118
|
const isValid = surfaces && surfaces.length > 0;
|
|
118
119
|
if (!isValid) {
|
|
119
120
|
console.warn(`Intersection surface group '${g.name}' has no valid entries and will be discarded.`);
|
|
@@ -121,13 +122,13 @@ function mapGroups(stratGroups: Map<string, StratGroup>, surfaceAreas: SurfaceAr
|
|
|
121
122
|
return isValid;
|
|
122
123
|
})
|
|
123
124
|
.map((g: StratGroup, i: number) => {
|
|
124
|
-
const surface
|
|
125
|
-
const top = surface[0]
|
|
125
|
+
const surface = surfaceAreas[g.name]!;
|
|
126
|
+
const top = surface[0]!;
|
|
126
127
|
return {
|
|
127
128
|
id: g.name,
|
|
128
129
|
label: g.name,
|
|
129
130
|
color: unassignedColorScale(i),
|
|
130
|
-
top: top.data.map((d: number[]) => d[1]),
|
|
131
|
+
top: top.data.map((d: number[]) => d[1]!),
|
|
131
132
|
};
|
|
132
133
|
});
|
|
133
134
|
return groups;
|
|
@@ -144,11 +145,11 @@ function combineSurfacesAndStratColumn(
|
|
|
144
145
|
.filter((d: MappedSurfaces) => d.visualization === 'interval' || d.visualization === 'none')
|
|
145
146
|
.map((s: MappedSurfaces) => {
|
|
146
147
|
const path: StratUnit[] = [];
|
|
147
|
-
const stratUnit
|
|
148
|
+
const stratUnit = findStratcolumnUnit(stratColumn, s.name, path);
|
|
148
149
|
if (!stratUnit) {
|
|
149
150
|
console.warn(`No match for ${s.name} in strat column`);
|
|
150
151
|
}
|
|
151
|
-
const group
|
|
152
|
+
const group = path[0]! || stratUnit;
|
|
152
153
|
const groupName: string = (group && group.identifier) || defaultGroupName;
|
|
153
154
|
if (group && !stratGroups.has(groupName)) {
|
|
154
155
|
stratGroups.set(groupName, {
|
|
@@ -158,7 +159,7 @@ function combineSurfacesAndStratColumn(
|
|
|
158
159
|
}
|
|
159
160
|
return {
|
|
160
161
|
...s,
|
|
161
|
-
unit: stratUnit
|
|
162
|
+
unit: stratUnit!,
|
|
162
163
|
group: groupName,
|
|
163
164
|
};
|
|
164
165
|
});
|
|
@@ -201,13 +202,13 @@ function sortStratigraphies(stratigrafies: Stratigraphy[]): void {
|
|
|
201
202
|
* @param {[]} path
|
|
202
203
|
*/
|
|
203
204
|
function findStratcolumnUnit(units: StratUnit[], unitname: string, path: StratUnit[] = []): StratUnit | null {
|
|
204
|
-
const unit
|
|
205
|
+
const unit = units.find((u: StratUnit) => u.identifier.toLowerCase() === unitname.toLowerCase());
|
|
205
206
|
if (unit) {
|
|
206
207
|
// Build path
|
|
207
|
-
let temp: StratUnit = unit;
|
|
208
|
+
let temp: StratUnit | undefined = unit;
|
|
208
209
|
do {
|
|
209
210
|
path.unshift(temp);
|
|
210
|
-
temp = units.find((u: StratUnit) => u.identifier === temp
|
|
211
|
+
temp = units.find((u: StratUnit) => u.identifier === temp!.stratUnitParent);
|
|
211
212
|
} while (temp);
|
|
212
213
|
|
|
213
214
|
return unit;
|
|
@@ -247,11 +248,11 @@ const unassignedColorScale = scaleOrdinal<number, string>()
|
|
|
247
248
|
/**
|
|
248
249
|
* Find the best matching base index based on name or by values
|
|
249
250
|
*/
|
|
250
|
-
function findBestMatchingBaseIndex(top: Stratigraphy, index: number, surfaces: Stratigraphy[], stratColumn: StratUnit[]): number {
|
|
251
|
+
function findBestMatchingBaseIndex(top: Stratigraphy, index: number, surfaces: Stratigraphy[], stratColumn: StratUnit[]): number | undefined {
|
|
251
252
|
const nextIndex: number = index + 1;
|
|
252
253
|
|
|
253
254
|
if (!surfaces || nextIndex >= surfaces.length) {
|
|
254
|
-
return
|
|
255
|
+
return undefined;
|
|
255
256
|
}
|
|
256
257
|
|
|
257
258
|
// If there is a matching base by name, use that. More robust, does not rely on sorting
|
|
@@ -262,14 +263,14 @@ function findBestMatchingBaseIndex(top: Stratigraphy, index: number, surfaces: S
|
|
|
262
263
|
|
|
263
264
|
for (let i = nextIndex; i < surfaces.length; i++) {
|
|
264
265
|
const candidate = surfaces[i];
|
|
265
|
-
if (!candidate
|
|
266
|
+
if (!candidate?.isBase) {
|
|
266
267
|
return i;
|
|
267
268
|
}
|
|
268
269
|
if (isAnchestor(top, candidate, stratColumn)) {
|
|
269
270
|
return i;
|
|
270
271
|
}
|
|
271
272
|
}
|
|
272
|
-
return
|
|
273
|
+
return undefined;
|
|
273
274
|
}
|
|
274
275
|
|
|
275
276
|
function isAnchestor(descendant: Stratigraphy, candidate: Stratigraphy, stratColumn: StratUnit[]): boolean {
|
|
@@ -284,15 +285,15 @@ function generateSurfaceAreas(projection: number[][], surfaces: Stratigraphy[],
|
|
|
284
285
|
if (!acc[surface.group]) {
|
|
285
286
|
acc[surface.group] = [];
|
|
286
287
|
}
|
|
287
|
-
const baseIndex
|
|
288
|
-
acc[surface.group]
|
|
288
|
+
const baseIndex = findBestMatchingBaseIndex(surface, i, surfaces, stratColumn);
|
|
289
|
+
acc[surface.group]?.push({
|
|
289
290
|
id: surface.name,
|
|
290
291
|
label: surface.name,
|
|
291
292
|
color: (surface.unit && getColorFromUnit(surface.unit)) || WHITE,
|
|
292
293
|
exclude: surface.visualization === 'none' || !surface.unit,
|
|
293
294
|
data: projection.map((p, j) => {
|
|
294
|
-
const baseValue
|
|
295
|
-
return [p[0]
|
|
295
|
+
const baseValue = surface.values[j] != null ? getBaseValue(baseIndex, surfaces, j) : undefined;
|
|
296
|
+
return [p[0]!, surface.values[j]!, baseValue!];
|
|
296
297
|
}),
|
|
297
298
|
});
|
|
298
299
|
}
|
|
@@ -303,15 +304,15 @@ function generateSurfaceAreas(projection: number[][], surfaces: Stratigraphy[],
|
|
|
303
304
|
|
|
304
305
|
// get the value from the surface with the supplied index,
|
|
305
306
|
// iterate to next surface if value is null
|
|
306
|
-
function getBaseValue(index: number, surfaces: Stratigraphy[], datapoint: number): number {
|
|
307
|
+
function getBaseValue(index: number | undefined, surfaces: Stratigraphy[], datapoint: number): number | undefined {
|
|
307
308
|
if (!surfaces || !index || index >= surfaces.length) {
|
|
308
|
-
return
|
|
309
|
+
return undefined;
|
|
309
310
|
}
|
|
310
311
|
|
|
311
312
|
for (let i: number = index; i < surfaces.length; i++) {
|
|
312
|
-
if (surfaces[i]
|
|
313
|
-
return surfaces[i]
|
|
313
|
+
if (surfaces[i]?.values[datapoint] != null) {
|
|
314
|
+
return surfaces[i]?.values[datapoint];
|
|
314
315
|
}
|
|
315
316
|
}
|
|
316
|
-
return
|
|
317
|
+
return undefined;
|
|
317
318
|
}
|
|
@@ -15,19 +15,21 @@ const pathSteps = 10;
|
|
|
15
15
|
* Code originally developed for REP
|
|
16
16
|
* @param {[]} poslog Position log from SMDA
|
|
17
17
|
*/
|
|
18
|
-
export function generateProjectedWellborePath(poslog: SurveySample[]): number
|
|
18
|
+
export function generateProjectedWellborePath(poslog: SurveySample[]): [number, number][] {
|
|
19
19
|
if (!poslog || poslog.length === 0) {
|
|
20
20
|
return [];
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const points: number
|
|
23
|
+
const points: [number, number, number, number][] = poslog ? poslog.map((p: SurveySample) => [p.easting, p.northing, p.tvd, p.md]) : [];
|
|
24
24
|
|
|
25
|
-
const projection
|
|
26
|
-
const offset
|
|
25
|
+
const projection = simplify(projectCurtain(points));
|
|
26
|
+
const offset = projection[projection.length - 1]?.[0];
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
projection
|
|
30
|
-
|
|
28
|
+
if (offset != null) {
|
|
29
|
+
projection.forEach((p, i) => {
|
|
30
|
+
projection[i]![0] = offset - p[0];
|
|
31
|
+
});
|
|
32
|
+
}
|
|
31
33
|
|
|
32
34
|
return projection;
|
|
33
35
|
}
|
|
@@ -43,25 +45,25 @@ export function generateProjectedTrajectory(poslog: SurveySample[], defaultInter
|
|
|
43
45
|
return [];
|
|
44
46
|
}
|
|
45
47
|
|
|
46
|
-
const points: number
|
|
48
|
+
const points: [number, number, number, number][] = poslog ? poslog.map((p) => [p.easting, p.northing, p.tvd, p.md]) : [];
|
|
47
49
|
|
|
48
50
|
const interpolator: CurveInterpolator = new CurveInterpolator(points, { tension: 0.75, arcDivisions: 5000 });
|
|
49
51
|
const displacement: number = interpolator.length;
|
|
50
52
|
|
|
51
53
|
const nPoints: number = Math.round(displacement * pathSteps);
|
|
52
|
-
let path: number
|
|
54
|
+
let path: [number, number][];
|
|
53
55
|
if (nPoints > 0) {
|
|
54
56
|
const maxOffset = 0.0005;
|
|
55
57
|
const maxDistance = 10;
|
|
56
58
|
path = simplify(interpolator.getPoints(nPoints), maxOffset, maxDistance);
|
|
57
59
|
} else {
|
|
58
|
-
path = [[points[0][0], points[0][1]]];
|
|
60
|
+
path = [[points[0]![0], points[0]![1]]];
|
|
59
61
|
}
|
|
60
62
|
|
|
61
|
-
const first
|
|
62
|
-
const last
|
|
63
|
+
const first = path[0]!;
|
|
64
|
+
const last = path[path.length - 1]!;
|
|
63
65
|
const relativeDist: number = Vector2.distance(first, last);
|
|
64
|
-
let v: Vector2
|
|
66
|
+
let v: Vector2;
|
|
65
67
|
|
|
66
68
|
if (relativeDist < thresholdRelativeDist) {
|
|
67
69
|
const oneEighty = 180;
|
|
@@ -72,9 +74,9 @@ export function generateProjectedTrajectory(poslog: SurveySample[], defaultInter
|
|
|
72
74
|
}
|
|
73
75
|
const extensionLengthStart: number = Math.max(0, extensionLength - displacement);
|
|
74
76
|
const offset: number = extensionLengthStart + displacement;
|
|
75
|
-
const trajectory: number
|
|
77
|
+
const trajectory: [number, number][] = [];
|
|
76
78
|
|
|
77
|
-
let firstPoints: number
|
|
79
|
+
let firstPoints: [number, number][] = [];
|
|
78
80
|
|
|
79
81
|
// Reference to initial vector
|
|
80
82
|
const initial: number[] = v.toArray();
|
|
@@ -93,7 +95,7 @@ export function generateProjectedTrajectory(poslog: SurveySample[], defaultInter
|
|
|
93
95
|
}
|
|
94
96
|
trajectory.push(...path);
|
|
95
97
|
|
|
96
|
-
const endPoints
|
|
98
|
+
const endPoints = seqI(Math.ceil(extensionLength * stepSize))
|
|
97
99
|
.map((t) =>
|
|
98
100
|
v
|
|
99
101
|
.set(initial)
|
|
@@ -105,7 +107,7 @@ export function generateProjectedTrajectory(poslog: SurveySample[], defaultInter
|
|
|
105
107
|
|
|
106
108
|
trajectory.push(...endPoints);
|
|
107
109
|
|
|
108
|
-
const projectedTrajectory: number[][] = projectCurtain(trajectory,
|
|
110
|
+
const projectedTrajectory: number[][] = projectCurtain(trajectory, undefined, offset);
|
|
109
111
|
|
|
110
112
|
return projectedTrajectory;
|
|
111
113
|
}
|
|
@@ -124,7 +126,7 @@ function getDirectionVector(path: number[][], threshold: number): Vector2 {
|
|
|
124
126
|
|
|
125
127
|
for (let i = 0; i < path.length - 1; i++) {
|
|
126
128
|
const index = path.length - 1 - i;
|
|
127
|
-
temp.set(path[index]).sub(path[index - 1]);
|
|
129
|
+
temp.set(path[index]!).sub(path[index - 1]!);
|
|
128
130
|
res.add(temp);
|
|
129
131
|
|
|
130
132
|
len = res.magnitude;
|
|
@@ -152,25 +154,25 @@ function getDirectionVector(path: number[][], threshold: number): Vector2 {
|
|
|
152
154
|
*
|
|
153
155
|
* @return {Number[]} Simplified array
|
|
154
156
|
*/
|
|
155
|
-
function simplify(inputArr: number
|
|
157
|
+
function simplify(inputArr: [number, number][], maxOffset = 0.001, maxDistance = 10): [number, number][] {
|
|
156
158
|
if (inputArr.length <= 4) {
|
|
157
159
|
return inputArr;
|
|
158
160
|
}
|
|
159
|
-
const [o0, o1] = inputArr[0]
|
|
160
|
-
const arr = inputArr.map((d) => [d[0] - o0, d[1] - o1]);
|
|
161
|
-
let [a0, a1] = arr[0]
|
|
162
|
-
const sim
|
|
161
|
+
const [o0, o1] = inputArr[0]!;
|
|
162
|
+
const arr = inputArr.map<[number, number]>((d) => [d[0]! - o0, d[1]! - o1]);
|
|
163
|
+
let [a0, a1] = arr[0]!;
|
|
164
|
+
const sim = [inputArr[0]!];
|
|
163
165
|
|
|
164
166
|
for (let i = 1; i + 1 < arr.length; i++) {
|
|
165
|
-
const [t0, t1] = arr[i];
|
|
166
|
-
const [b0, b1] = arr[i + 1];
|
|
167
|
+
const [t0, t1] = arr[i] ?? [];
|
|
168
|
+
const [b0, b1] = arr[i + 1] ?? [];
|
|
167
169
|
|
|
168
170
|
// If t->b vector is NOT [0, 0]
|
|
169
|
-
if (b0 - t0 !== 0 || b1 - t1 !== 0) {
|
|
171
|
+
if (t0 != null && t1 != null && b0 != null && b1 != null && (b0 - t0 !== 0 || b1 - t1 !== 0)) {
|
|
170
172
|
// Proximity check
|
|
171
173
|
const proximity: number = Math.abs(a0 * b1 - a1 * b0 + b0 * t1 - b1 * t0 + a1 * t0 - a0 * t1) / Math.sqrt((b0 - a0) ** 2 + (b1 - a1) ** 2);
|
|
172
174
|
|
|
173
|
-
const dir: number
|
|
175
|
+
const dir: [number, number] = [a0 - t0, a1 - t1];
|
|
174
176
|
const len: number = Math.sqrt(dir[0] ** 2 + dir[1] ** 2);
|
|
175
177
|
|
|
176
178
|
if (proximity > maxOffset || len >= maxDistance) {
|
|
@@ -179,7 +181,7 @@ function simplify(inputArr: number[][], maxOffset = 0.001, maxDistance = 10): nu
|
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
}
|
|
182
|
-
const last
|
|
184
|
+
const last = arr[arr.length - 1]!;
|
|
183
185
|
sim.push([last[0] + o0, last[1] + o1]);
|
|
184
186
|
|
|
185
187
|
return sim;
|
|
@@ -192,15 +194,15 @@ function simplify(inputArr: number[][], maxOffset = 0.001, maxDistance = 10): nu
|
|
|
192
194
|
* @param offset
|
|
193
195
|
* @returns {array}
|
|
194
196
|
*/
|
|
195
|
-
function projectCurtain(points: number[][], origin
|
|
196
|
-
let p0
|
|
197
|
+
function projectCurtain(points: [number, number, ...number[]][], origin?: [number, number, number, number], offset = 0): [number, number][] {
|
|
198
|
+
let p0 = origin || points[0]!;
|
|
197
199
|
let l = 0;
|
|
198
|
-
const projected = points.map((p1
|
|
200
|
+
const projected = points.map<[number, number]>((p1) => {
|
|
199
201
|
const dx = p1[0] - p0[0];
|
|
200
202
|
const dy = p1[1] - p0[1];
|
|
201
203
|
l += Math.sqrt(dx ** 2 + dy ** 2);
|
|
202
204
|
p0 = p1;
|
|
203
|
-
return [offset > 0 ? offset - l : l, p1[2]
|
|
205
|
+
return [offset > 0 ? offset - l : l, p1[2] ?? 0];
|
|
204
206
|
});
|
|
205
207
|
return projected;
|
|
206
208
|
}
|
package/src/interfaces.ts
CHANGED