@webviz/subsurface-viewer 1.10.3 → 1.10.4
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/hooks/useMultiViewPicking/MultiViewPickingInfoAssembler.d.ts +4 -2
- package/dist/hooks/useMultiViewPicking/MultiViewPickingInfoAssembler.js +58 -37
- package/dist/hooks/useMultiViewPicking/MultiViewPickingInfoAssembler.js.map +1 -1
- package/dist/layers/types.d.ts +1 -1
- package/dist/layers/utils/layerTools.d.ts +4 -4
- package/dist/layers/utils/layerTools.js.map +1 -1
- package/dist/layers/wells/layers/wellLabelLayer.d.ts +7 -6
- package/dist/layers/wells/layers/wellLabelLayer.js +1 -2
- package/dist/layers/wells/layers/wellLabelLayer.js.map +1 -1
- package/dist/layers/wells/types.d.ts +42 -0
- package/dist/layers/wells/types.js +2 -0
- package/dist/layers/wells/types.js.map +1 -0
- package/dist/layers/wells/utils/abscissaTransform.d.ts +1 -1
- package/dist/layers/wells/utils/abscissaTransform.js.map +1 -1
- package/dist/layers/wells/utils/spline.d.ts +2 -2
- package/dist/layers/wells/utils/spline.js +1 -0
- package/dist/layers/wells/utils/spline.js.map +1 -1
- package/dist/layers/wells/utils/trajectory.d.ts +5 -4
- package/dist/layers/wells/utils/trajectory.js +5 -4
- package/dist/layers/wells/utils/trajectory.js.map +1 -1
- package/dist/layers/wells/wellsLayer.d.ts +35 -39
- package/dist/layers/wells/wellsLayer.js +138 -127
- package/dist/layers/wells/wellsLayer.js.map +1 -1
- package/package.json +1 -1
@@ -1,26 +1,35 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import type { Color, Layer, LayersList, PickingInfo, UpdateParameters } from "@deck.gl/core";
|
3
3
|
import { CompositeLayer } from "@deck.gl/core";
|
4
|
-
import type {
|
5
|
-
import type {
|
4
|
+
import type { BinaryFeatureCollection } from "@loaders.gl/schema";
|
5
|
+
import type { ColorMapFunctionType, ExtendedLayerProps } from "../utils/layerTools";
|
6
|
+
import type { Feature } from "geojson";
|
6
7
|
import type { ContinuousLegendDataType, DiscreteLegendDataType } from "../../components/ColorLegend";
|
7
8
|
import type { ReportBoundingBoxAction } from "../../components/Map";
|
8
|
-
import type { NumberPair, StyleAccessorFunction } from "../types";
|
9
9
|
import type { WellLabelLayerProps } from "./layers/wellLabelLayer";
|
10
10
|
import { WellLabelLayer } from "./layers/wellLabelLayer";
|
11
|
-
type
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
};
|
11
|
+
import type { WellFeatureCollection, WellsPickInfo, WellFeature, WellHeadStyleAccessor, LineStyleAccessor, SizeAccessor, LogCurveDataType } from "./types";
|
12
|
+
export declare enum SubLayerId {
|
13
|
+
COLORS = "colors",
|
14
|
+
SIMPLE = "simple",
|
15
|
+
OUTLINE = "outline",
|
16
|
+
HIGHLIGHT = "highlight",
|
17
|
+
HIGHLIGHT_2 = "highlight2",
|
18
|
+
LOG_CURVE = "log_curve",
|
19
|
+
SELECTION = "selection",
|
20
|
+
LABELS = "labels"
|
21
|
+
}
|
23
22
|
export interface WellsLayerProps extends ExtendedLayerProps {
|
23
|
+
/**
|
24
|
+
* Well data to render; described as a single GeoJSON feature collection, which each individual well as a distinct feature.
|
25
|
+
*
|
26
|
+
* Accepted data formats:
|
27
|
+
* * A javascript object.
|
28
|
+
* * A binary/flat GeoJSON object
|
29
|
+
* * A url string pointing to external GeoJSON data.
|
30
|
+
* * A promise returning GeoJSON data.
|
31
|
+
*/
|
32
|
+
data: string | WellFeatureCollection | BinaryFeatureCollection | Promise<WellFeatureCollection | BinaryFeatureCollection>;
|
24
33
|
pointRadiusScale: number;
|
25
34
|
lineWidthScale: number;
|
26
35
|
outline: boolean;
|
@@ -39,7 +48,7 @@ export interface WellsLayerProps extends ExtendedLayerProps {
|
|
39
48
|
*/
|
40
49
|
refine: boolean | number;
|
41
50
|
wellHeadStyle: WellHeadStyleAccessor;
|
42
|
-
colorMappingFunction:
|
51
|
+
colorMappingFunction: ColorMapFunctionType;
|
43
52
|
lineStyle: LineStyleAccessor;
|
44
53
|
/**
|
45
54
|
* @deprecated use wellLabel instead
|
@@ -80,41 +89,29 @@ export interface WellsLayerProps extends ExtendedLayerProps {
|
|
80
89
|
reportBoundingBox?: React.Dispatch<ReportBoundingBoxAction>;
|
81
90
|
wellLabel?: Partial<WellLabelLayerProps>;
|
82
91
|
}
|
83
|
-
export interface LogCurveDataType {
|
84
|
-
header: {
|
85
|
-
name: string;
|
86
|
-
well: string;
|
87
|
-
};
|
88
|
-
curves: {
|
89
|
-
name: string;
|
90
|
-
description: string;
|
91
|
-
}[];
|
92
|
-
data: number[][];
|
93
|
-
metadata_discrete: Record<string, {
|
94
|
-
attributes: unknown;
|
95
|
-
objects: Record<string, [Color, number]>;
|
96
|
-
}>;
|
97
|
-
}
|
98
|
-
export interface WellsPickInfo extends LayerPickInfo {
|
99
|
-
featureType?: string;
|
100
|
-
logName: string;
|
101
|
-
}
|
102
92
|
export declare function getSize(type: string, accessor: SizeAccessor, offset?: number): number | ((object: Feature) => number);
|
103
93
|
export default class WellsLayer extends CompositeLayer<WellsLayerProps> {
|
104
|
-
|
94
|
+
state: {
|
95
|
+
data: WellFeatureCollection | undefined;
|
96
|
+
well: string;
|
97
|
+
selectedMultiWells: string[];
|
98
|
+
selection: [number, number];
|
99
|
+
};
|
100
|
+
private recomputeDataState;
|
105
101
|
shouldUpdateState({ changeFlags }: UpdateParameters<this>): boolean;
|
106
102
|
updateState({ props, oldProps }: UpdateParameters<WellsLayer>): void;
|
107
103
|
onClick(info: WellsPickInfo): boolean;
|
108
104
|
setSelection(well: string | undefined, _selection?: [number | undefined, number | undefined]): void;
|
109
105
|
setMultiSelection(wells: string[] | undefined): void;
|
106
|
+
getWellDataState(): WellFeatureCollection | undefined;
|
110
107
|
getLegendData(value: LogCurveDataType[]): ContinuousLegendDataType | DiscreteLegendDataType | null;
|
111
108
|
setLegend(value: LogCurveDataType[]): void;
|
112
109
|
getLogLayer(): Layer;
|
113
110
|
getSelectionLayer(): Layer;
|
114
111
|
getLogCurveData(): LogCurveDataType[] | undefined;
|
115
112
|
setupLegend(): void;
|
116
|
-
protected getWellLabelPosition(): number | ((d: Feature<Geometry, GeoJsonProperties>) => number);
|
117
|
-
protected createWellLabelLayer(data:
|
113
|
+
protected getWellLabelPosition(): number | ((d: Feature<import("geojson").Geometry, import("geojson").GeoJsonProperties>) => number);
|
114
|
+
protected createWellLabelLayer(data: WellFeature[]): WellLabelLayer | null;
|
118
115
|
renderLayers(): LayersList;
|
119
116
|
getPickingInfo({ info }: {
|
120
117
|
info: PickingInfo;
|
@@ -125,4 +122,3 @@ export declare function getLogInfo(d: LogCurveDataType, logrun_name: string, log
|
|
125
122
|
name: string;
|
126
123
|
description: string;
|
127
124
|
} | undefined;
|
128
|
-
export {};
|
@@ -12,12 +12,17 @@ import { WellLabelLayer } from "./layers/wellLabelLayer";
|
|
12
12
|
import { abscissaTransform } from "./utils/abscissaTransform";
|
13
13
|
import { GetBoundingBox, checkWells, coarsenWells, invertPath, splineRefine, } from "./utils/spline";
|
14
14
|
import { getColor, getTrajectory } from "./utils/trajectory";
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
15
|
+
export var SubLayerId;
|
16
|
+
(function (SubLayerId) {
|
17
|
+
SubLayerId["COLORS"] = "colors";
|
18
|
+
SubLayerId["SIMPLE"] = "simple";
|
19
|
+
SubLayerId["OUTLINE"] = "outline";
|
20
|
+
SubLayerId["HIGHLIGHT"] = "highlight";
|
21
|
+
SubLayerId["HIGHLIGHT_2"] = "highlight2";
|
22
|
+
SubLayerId["LOG_CURVE"] = "log_curve";
|
23
|
+
SubLayerId["SELECTION"] = "selection";
|
24
|
+
SubLayerId["LABELS"] = "labels";
|
25
|
+
})(SubLayerId || (SubLayerId = {}));
|
21
26
|
const defaultProps = {
|
22
27
|
"@@type": "WellsLayer",
|
23
28
|
name: "Wells",
|
@@ -42,40 +47,11 @@ const defaultProps = {
|
|
42
47
|
wellNameColor: [0, 0, 0, 255],
|
43
48
|
wellNameSize: 10,
|
44
49
|
};
|
45
|
-
function multiply(pair, factor) {
|
46
|
-
return [pair[0] * factor, pair[1] * factor];
|
47
|
-
}
|
48
50
|
const LINE = "line";
|
49
51
|
const POINT = "point";
|
50
52
|
const DEFAULT_POINT_SIZE = 8;
|
51
53
|
const DEFAULT_LINE_WIDTH = 5;
|
52
54
|
const DEFAULT_DASH = [5, 5];
|
53
|
-
function getDashFactor(accessor, width_accessor, offset = 0) {
|
54
|
-
return (object, objectInfo) => {
|
55
|
-
let width = DEFAULT_LINE_WIDTH;
|
56
|
-
if (typeof width_accessor == "function") {
|
57
|
-
width = width_accessor(object);
|
58
|
-
}
|
59
|
-
else if (width_accessor) {
|
60
|
-
width = width_accessor;
|
61
|
-
}
|
62
|
-
const factor = width / (width + offset);
|
63
|
-
let dash = [0, 0];
|
64
|
-
if (typeof accessor == "function") {
|
65
|
-
dash = accessor(object, objectInfo);
|
66
|
-
}
|
67
|
-
else if (accessor)
|
68
|
-
dash = accessor;
|
69
|
-
else if (accessor)
|
70
|
-
dash = DEFAULT_DASH;
|
71
|
-
if (dash.length == 2) {
|
72
|
-
return multiply(dash, factor);
|
73
|
-
}
|
74
|
-
else {
|
75
|
-
return multiply(DEFAULT_DASH, factor);
|
76
|
-
}
|
77
|
-
};
|
78
|
-
}
|
79
55
|
export function getSize(type, accessor, offset = 0) {
|
80
56
|
if (typeof accessor == "function") {
|
81
57
|
return (object) => {
|
@@ -93,24 +69,28 @@ export function getSize(type, accessor, offset = 0) {
|
|
93
69
|
return 0;
|
94
70
|
}
|
95
71
|
export default class WellsLayer extends CompositeLayer {
|
96
|
-
|
97
|
-
|
72
|
+
recomputeDataState() {
|
73
|
+
const data = this.props.data;
|
98
74
|
const refine = this.props.refine;
|
99
|
-
|
75
|
+
const doRefine = typeof refine === "number" ? refine > 1 : refine;
|
76
|
+
const stepCount = typeof refine === "number" ? refine : 5;
|
77
|
+
if (!dataIsReady(data)) {
|
100
78
|
return;
|
101
79
|
}
|
80
|
+
let transformedData = data;
|
102
81
|
if (this.props.ZIncreasingDownwards) {
|
103
|
-
|
82
|
+
transformedData = invertPath(transformedData);
|
104
83
|
}
|
105
84
|
if (this.props.section) {
|
106
|
-
|
85
|
+
transformedData = abscissaTransform(transformedData);
|
107
86
|
}
|
108
|
-
|
87
|
+
// Mutate data to remove duplicates
|
88
|
+
checkWells(transformedData);
|
109
89
|
// Conditionally apply spline interpolation to refine the well path.
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
this.setState(
|
90
|
+
if (doRefine) {
|
91
|
+
transformedData = splineRefine(transformedData, stepCount);
|
92
|
+
}
|
93
|
+
this.setState({ data: transformedData });
|
114
94
|
}
|
115
95
|
shouldUpdateState({ changeFlags }) {
|
116
96
|
return (changeFlags.viewportChanged ||
|
@@ -122,10 +102,9 @@ export default class WellsLayer extends CompositeLayer {
|
|
122
102
|
!isEqual(props.ZIncreasingDownwards, oldProps.ZIncreasingDownwards) ||
|
123
103
|
!isEqual(props.refine, oldProps.refine);
|
124
104
|
if (needs_reload) {
|
125
|
-
this.
|
105
|
+
this.recomputeDataState();
|
126
106
|
}
|
127
107
|
}
|
128
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any
|
129
108
|
onClick(info) {
|
130
109
|
var _a;
|
131
110
|
// Make selection only when drawing is disabled
|
@@ -134,7 +113,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
134
113
|
}
|
135
114
|
else {
|
136
115
|
this.context.userData.setEditedData({
|
137
|
-
selectedWell: (_a = info.object
|
116
|
+
selectedWell: (_a = info.object) === null || _a === void 0 ? void 0 : _a.properties.name,
|
138
117
|
});
|
139
118
|
return false; // do not return true to allow DeckGL props.onClick to be called
|
140
119
|
}
|
@@ -154,6 +133,9 @@ export default class WellsLayer extends CompositeLayer {
|
|
154
133
|
});
|
155
134
|
}
|
156
135
|
}
|
136
|
+
getWellDataState() {
|
137
|
+
return this.state.data;
|
138
|
+
}
|
157
139
|
getLegendData(value) {
|
158
140
|
return getLegendData(value, "", this.props.logName, this.props.logColor);
|
159
141
|
}
|
@@ -213,7 +195,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
213
195
|
[GL.POLYGON_OFFSET_FILL]: true,
|
214
196
|
};
|
215
197
|
const fastDrawing = this.props.simplifiedRendering;
|
216
|
-
const wellLabelProps = this.getSubLayerProps(Object.assign(Object.assign({}, this.props.wellLabel), { data,
|
198
|
+
const wellLabelProps = this.getSubLayerProps(Object.assign(Object.assign({}, this.props.wellLabel), { id: SubLayerId.LABELS, data,
|
217
199
|
// Z is always increasing upwards at this stage
|
218
200
|
zIncreasingDownwards: false, getPositionAlongPath: this.getWellLabelPosition(), getColor: (_b = (_a = this.props.wellLabel) === null || _a === void 0 ? void 0 : _a.getColor) !== null && _b !== void 0 ? _b : this.props.wellNameColor, getAnchor: "start", getSize: (_d = (_c = this.props.wellLabel) === null || _c === void 0 ? void 0 : _c.getSize) !== null && _d !== void 0 ? _d : this.props.wellNameSize, parameters, visible: !fastDrawing, background: ((_e = this.props.wellLabel) === null || _e === void 0 ? void 0 : _e.background) ||
|
219
201
|
this.props.hideOverlappingWellNames }));
|
@@ -221,12 +203,12 @@ export default class WellsLayer extends CompositeLayer {
|
|
221
203
|
}
|
222
204
|
renderLayers() {
|
223
205
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
224
|
-
|
225
|
-
return [];
|
226
|
-
}
|
227
|
-
const data = this.state["data"];
|
206
|
+
const data = this.getWellDataState();
|
228
207
|
const positionFormat = "XYZ";
|
229
208
|
const isDashed = !!((_a = this.props.lineStyle) === null || _a === void 0 ? void 0 : _a.dash);
|
209
|
+
if (!data || !(data === null || data === void 0 ? void 0 : data.features.length)) {
|
210
|
+
return [];
|
211
|
+
}
|
230
212
|
const extensions = [
|
231
213
|
new PathStyleExtension({
|
232
214
|
dash: isDashed,
|
@@ -255,11 +237,11 @@ export default class WellsLayer extends CompositeLayer {
|
|
255
237
|
parameters,
|
256
238
|
visible: fastDrawing,
|
257
239
|
};
|
258
|
-
const colorsLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
259
|
-
const fastLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
260
|
-
const outlineLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
261
|
-
const highlightLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
262
|
-
const highlightMultiWellsLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
240
|
+
const colorsLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id: SubLayerId.COLORS, pickable: true, extensions, getDashArray: getDashFactor((_d = this.props.lineStyle) === null || _d === void 0 ? void 0 : _d.dash, getSize(LINE, (_e = this.props.lineStyle) === null || _e === void 0 ? void 0 : _e.width), -1), visible: !fastDrawing, getLineColor: getColor((_f = this.props.lineStyle) === null || _f === void 0 ? void 0 : _f.color), getFillColor: getColor((_g = this.props.wellHeadStyle) === null || _g === void 0 ? void 0 : _g.color) }));
|
241
|
+
const fastLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id: SubLayerId.SIMPLE, positionFormat, getLineColor: getColor((_h = this.props.lineStyle) === null || _h === void 0 ? void 0 : _h.color), getFillColor: getColor((_j = this.props.wellHeadStyle) === null || _j === void 0 ? void 0 : _j.color) }));
|
242
|
+
const outlineLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id: SubLayerId.OUTLINE, getLineWidth: getSize(LINE, (_k = this.props.lineStyle) === null || _k === void 0 ? void 0 : _k.width), getPointRadius: getSize(POINT, (_l = this.props.wellHeadStyle) === null || _l === void 0 ? void 0 : _l.size), extensions, getDashArray: getDashFactor((_m = this.props.lineStyle) === null || _m === void 0 ? void 0 : _m.dash), visible: this.props.outline && !fastDrawing, parameters: Object.assign(Object.assign({}, parameters), { [GL.POLYGON_OFFSET_FACTOR]: 1, [GL.POLYGON_OFFSET_UNITS]: 1 }) }));
|
243
|
+
const highlightLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id: SubLayerId.HIGHLIGHT, data: getWellObjectByName(data.features, this.props.selectedWell), getLineWidth: getSize(LINE, (_o = this.props.lineStyle) === null || _o === void 0 ? void 0 : _o.width, 2), getPointRadius: getSize(POINT, (_p = this.props.wellHeadStyle) === null || _p === void 0 ? void 0 : _p.size, 2), getLineColor: getColor((_q = this.props.lineStyle) === null || _q === void 0 ? void 0 : _q.color), getFillColor: getColor((_r = this.props.wellHeadStyle) === null || _r === void 0 ? void 0 : _r.color), visible: this.props.logCurves && !fastDrawing }));
|
244
|
+
const highlightMultiWellsLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id: SubLayerId.HIGHLIGHT_2, data: getWellObjectsByName(data.features, this.state.selectedMultiWells), getPointRadius: getSize(POINT, (_s = this.props.wellHeadStyle) === null || _s === void 0 ? void 0 : _s.size, 2), getFillColor: [255, 140, 0], getLineColor: [255, 140, 0], visible: this.props.logCurves && !fastDrawing }));
|
263
245
|
const fastLayer = new GeoJsonLayer(fastLayerProps);
|
264
246
|
const outlineLayer = new GeoJsonLayer(outlineLayerProps);
|
265
247
|
const colorsLayer = new GeoJsonLayer(colorsLayerProps);
|
@@ -268,7 +250,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
268
250
|
// Highlight the multi selected wells.
|
269
251
|
const highlightMultiWellsLayer = new GeoJsonLayer(highlightMultiWellsLayerProps);
|
270
252
|
const logLayer = new PathLayer(this.getSubLayerProps({
|
271
|
-
id:
|
253
|
+
id: SubLayerId.LOG_CURVE,
|
272
254
|
data: this.props.logData,
|
273
255
|
positionFormat,
|
274
256
|
pickable: true,
|
@@ -306,7 +288,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
306
288
|
visible: this.props.logCurves && !fastDrawing,
|
307
289
|
}));
|
308
290
|
const selectionLayer = new PathLayer(this.getSubLayerProps({
|
309
|
-
id:
|
291
|
+
id: SubLayerId.SELECTION,
|
310
292
|
data: this.props.logData,
|
311
293
|
positionFormat,
|
312
294
|
pickable: false,
|
@@ -315,16 +297,16 @@ export default class WellsLayer extends CompositeLayer {
|
|
315
297
|
miterLimit: 100,
|
316
298
|
getPath: (d) => {
|
317
299
|
var _a;
|
318
|
-
return getLogPath1(data.features, d, this.state
|
300
|
+
return getLogPath1(data.features, d, this.state.well, this.state.selection, this.props.logrunName, (_a = this.props.lineStyle) === null || _a === void 0 ? void 0 : _a.color);
|
319
301
|
},
|
320
|
-
getColor: (d) => getLogColor1(data.features, d, this.state
|
302
|
+
getColor: (d) => getLogColor1(data.features, d, this.state.well, this.state.selection, this.props.logrunName),
|
321
303
|
getWidth: (d) => this.props.logRadius * 1.5 ||
|
322
304
|
getLogWidth(d, this.props.logrunName, this.props.logName),
|
323
305
|
updateTriggers: {
|
324
306
|
getColor: [
|
325
307
|
this.props.logrunName,
|
326
|
-
this.state
|
327
|
-
this.state
|
308
|
+
this.state.well,
|
309
|
+
this.state.selection,
|
328
310
|
],
|
329
311
|
getWidth: [
|
330
312
|
this.props.logrunName,
|
@@ -334,8 +316,8 @@ export default class WellsLayer extends CompositeLayer {
|
|
334
316
|
getPath: [
|
335
317
|
positionFormat,
|
336
318
|
this.props.logrunName,
|
337
|
-
this.state
|
338
|
-
this.state
|
319
|
+
this.state.well,
|
320
|
+
this.state.selection,
|
339
321
|
],
|
340
322
|
},
|
341
323
|
onDataLoad: (value) => {
|
@@ -360,23 +342,32 @@ export default class WellsLayer extends CompositeLayer {
|
|
360
342
|
return layers;
|
361
343
|
}
|
362
344
|
getPickingInfo({ info }) {
|
363
|
-
var _a, _b;
|
345
|
+
var _a, _b, _c, _d, _e;
|
364
346
|
if (!info.object)
|
365
347
|
return Object.assign(Object.assign({}, info), { properties: [], logName: "" });
|
366
|
-
const
|
348
|
+
const features = (_b = (_a = this.getWellDataState()) === null || _a === void 0 ? void 0 : _a.features) !== null && _b !== void 0 ? _b : [];
|
349
|
+
const coordinate = info.coordinate || [0, 0, 0];
|
367
350
|
const zScale = this.props.modelMatrix ? this.props.modelMatrix[10] : 1;
|
368
351
|
if (typeof coordinate[2] !== "undefined") {
|
369
352
|
coordinate[2] /= Math.max(0.001, zScale);
|
370
353
|
}
|
371
|
-
let md_property =
|
372
|
-
|
373
|
-
|
354
|
+
let md_property = null;
|
355
|
+
let tvd_property = null;
|
356
|
+
let log_property = null;
|
357
|
+
// ! This needs to be updated if we ever change the sub-layer id!
|
358
|
+
if (((_c = info.sourceLayer) === null || _c === void 0 ? void 0 : _c.id) === `${this.props.id}-${SubLayerId.LOG_CURVE}`) {
|
359
|
+
// The user is hovering a well log entry
|
360
|
+
const logPick = info;
|
361
|
+
md_property = getLogProperty(coordinate, features, logPick.object, this.props.logrunName, "MD");
|
362
|
+
tvd_property = getLogProperty(coordinate, features, logPick.object, this.props.logrunName, "TVD");
|
363
|
+
log_property = getLogProperty(coordinate, features, info.object, this.props.logrunName, this.props.logName);
|
374
364
|
}
|
375
|
-
|
376
|
-
|
377
|
-
|
365
|
+
else {
|
366
|
+
// User is hovering a wellbore path
|
367
|
+
const wellpickInfo = info;
|
368
|
+
md_property = getMdProperty(coordinate, wellpickInfo.object, (_d = this.props.lineStyle) === null || _d === void 0 ? void 0 : _d.color, info.featureType);
|
369
|
+
tvd_property = getTvdProperty(coordinate, info.object, (_e = this.props.lineStyle) === null || _e === void 0 ? void 0 : _e.color, info.featureType);
|
378
370
|
}
|
379
|
-
const log_property = getLogProperty(coordinate, this.props.data.features, info.object, this.props.logrunName, this.props.logName);
|
380
371
|
// Patch for inverting tvd readout to fix issue #830,
|
381
372
|
// should make proper fix when handling z increase direction - issue #842
|
382
373
|
const inverted_tvd_property = tvd_property && Object.assign(Object.assign({}, tvd_property), { value: (tvd_property === null || tvd_property === void 0 ? void 0 : tvd_property.value) * -1 });
|
@@ -393,6 +384,45 @@ export default class WellsLayer extends CompositeLayer {
|
|
393
384
|
WellsLayer.layerName = "WellsLayer";
|
394
385
|
WellsLayer.defaultProps = Object.assign(Object.assign({}, defaultProps), { onDataLoad: (data, context) => onDataLoad(data, context) });
|
395
386
|
//================= Local help functions. ==================
|
387
|
+
function onDataLoad(data, context) {
|
388
|
+
const bbox = GetBoundingBox(data);
|
389
|
+
if (typeof context.layer.props.reportBoundingBox !== "undefined") {
|
390
|
+
context.layer.props.reportBoundingBox({ layerBoundingBox: bbox });
|
391
|
+
}
|
392
|
+
}
|
393
|
+
function multiply(pair, factor) {
|
394
|
+
return [pair[0] * factor, pair[1] * factor];
|
395
|
+
}
|
396
|
+
function getDashFactor(accessor, width_accessor, offset = 0) {
|
397
|
+
return (object, objectInfo) => {
|
398
|
+
let width = DEFAULT_LINE_WIDTH;
|
399
|
+
if (typeof width_accessor == "function") {
|
400
|
+
width = width_accessor(object);
|
401
|
+
}
|
402
|
+
else if (width_accessor) {
|
403
|
+
width = width_accessor;
|
404
|
+
}
|
405
|
+
const factor = width / (width + offset);
|
406
|
+
let dash = [0, 0];
|
407
|
+
if (typeof accessor == "function") {
|
408
|
+
dash = accessor(object, objectInfo);
|
409
|
+
}
|
410
|
+
else if (accessor)
|
411
|
+
dash = accessor;
|
412
|
+
else if (accessor)
|
413
|
+
dash = DEFAULT_DASH;
|
414
|
+
if (dash.length == 2) {
|
415
|
+
return multiply(dash, factor);
|
416
|
+
}
|
417
|
+
else {
|
418
|
+
return multiply(DEFAULT_DASH, factor);
|
419
|
+
}
|
420
|
+
};
|
421
|
+
}
|
422
|
+
function dataIsReady(layerData) {
|
423
|
+
// Deck.gl always shows prop.data as `[]` while external data is being loaded
|
424
|
+
return !!layerData && !isEmpty(layerData);
|
425
|
+
}
|
396
426
|
function getColumn(data, col) {
|
397
427
|
const column = [];
|
398
428
|
for (let i = 0; i < data.length; i++) {
|
@@ -426,33 +456,30 @@ function isSelectedLogRun(d, logrun_name) {
|
|
426
456
|
return d.header.name.toLowerCase() === logrun_name.toLowerCase();
|
427
457
|
}
|
428
458
|
function getWellObjectByName(wells_data, name) {
|
429
|
-
return wells_data === null || wells_data === void 0 ? void 0 : wells_data.find((item) => { var _a, _b; return ((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a
|
459
|
+
return wells_data === null || wells_data === void 0 ? void 0 : wells_data.find((item) => { var _a, _b; return ((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === (name === null || name === void 0 ? void 0 : name.toLowerCase()); });
|
430
460
|
}
|
431
461
|
function getWellObjectsByName(wells_data, name) {
|
432
462
|
const res = [];
|
433
463
|
for (let i = 0; i < (name === null || name === void 0 ? void 0 : name.length); i++) {
|
434
464
|
wells_data === null || wells_data === void 0 ? void 0 : wells_data.find((item) => {
|
435
465
|
var _a, _b, _c;
|
436
|
-
if (((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a
|
437
|
-
((_c = name[i]) === null || _c === void 0 ? void 0 : _c.toLowerCase())) {
|
466
|
+
if (((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) === ((_c = name[i]) === null || _c === void 0 ? void 0 : _c.toLowerCase()))
|
438
467
|
res.push(item);
|
439
|
-
}
|
440
468
|
});
|
441
469
|
}
|
442
470
|
return res;
|
443
471
|
}
|
444
472
|
function getPointGeometry(well_object) {
|
445
|
-
|
446
|
-
return
|
473
|
+
const geometries = well_object.geometry.geometries;
|
474
|
+
return geometries.find((item) => item.type === "Point");
|
447
475
|
}
|
448
476
|
// Return well head position from Point Geometry
|
449
477
|
function getWellHeadPosition(well_object) {
|
450
|
-
var _a;
|
451
|
-
return (_a = getPointGeometry(well_object)) === null || _a === void 0 ? void 0 : _a.coordinates;
|
478
|
+
var _a, _b;
|
479
|
+
return (_b = (_a = getPointGeometry(well_object)) === null || _a === void 0 ? void 0 : _a.coordinates) !== null && _b !== void 0 ? _b : [-1, -1, -1];
|
452
480
|
}
|
453
481
|
function getWellMds(well_object) {
|
454
|
-
|
455
|
-
return (_a = well_object.properties) === null || _a === void 0 ? void 0 : _a["md"][0];
|
482
|
+
return well_object.properties.md[0];
|
456
483
|
}
|
457
484
|
function getNeighboringMdIndices(mds, md) {
|
458
485
|
const idx = mds.findIndex((x) => x >= md);
|
@@ -495,9 +522,7 @@ function getLogIndexByNames(d, names) {
|
|
495
522
|
}
|
496
523
|
return -1;
|
497
524
|
}
|
498
|
-
function getLogColor(d, logrun_name, log_name, logColor, colorTables,
|
499
|
-
// eslint-disable-next-line
|
500
|
-
colorMappingFunction, isLog) {
|
525
|
+
function getLogColor(d, logrun_name, log_name, logColor, colorTables, colorMappingFunction, isLog) {
|
501
526
|
var _a;
|
502
527
|
const log_data = getLogValues(d, logrun_name, log_name);
|
503
528
|
const log_info = getLogInfo(d, logrun_name, log_name);
|
@@ -509,17 +534,12 @@ colorMappingFunction, isLog) {
|
|
509
534
|
const max = Math.max(...log_data);
|
510
535
|
const max_delta = max - min;
|
511
536
|
log_data.forEach((value) => {
|
537
|
+
const adjustedVal = (value - min) / max_delta;
|
512
538
|
const rgb = colorMappingFunction
|
513
|
-
? colorMappingFunction(
|
514
|
-
: rgbValues(
|
515
|
-
rgbValues(value - min / max_delta, logColor, colorTables, isLog);
|
539
|
+
? colorMappingFunction(adjustedVal)
|
540
|
+
: rgbValues(adjustedVal, logColor, colorTables, isLog);
|
516
541
|
if (rgb) {
|
517
|
-
|
518
|
-
log_color.push([rgb[0], rgb[1], rgb[2]]);
|
519
|
-
}
|
520
|
-
else {
|
521
|
-
log_color.push([rgb === null || rgb === void 0 ? void 0 : rgb.r, rgb === null || rgb === void 0 ? void 0 : rgb.g, rgb === null || rgb === void 0 ? void 0 : rgb.b]);
|
522
|
-
}
|
542
|
+
log_color.push([rgb[0], rgb[1], rgb[2]]);
|
523
543
|
}
|
524
544
|
else {
|
525
545
|
log_color.push([0, 0, 0, 0]); // push transparent for null/undefined log values
|
@@ -530,53 +550,44 @@ colorMappingFunction, isLog) {
|
|
530
550
|
// well log data set for ex : H1: Array(2)0: (4) [255, 26, 202, 255] 1: 13
|
531
551
|
const log_attributes = (_a = getDiscreteLogMetadata(d, log_name)) === null || _a === void 0 ? void 0 : _a.objects;
|
532
552
|
const logLength = Object.keys(log_attributes).length;
|
533
|
-
// eslint-disable-next-line
|
534
553
|
const attributesObject = {};
|
535
|
-
const
|
554
|
+
const categorical = true;
|
536
555
|
Object.keys(log_attributes).forEach((key) => {
|
537
556
|
// get the point from log_attributes
|
538
557
|
const point = log_attributes[key][1];
|
539
|
-
const
|
540
|
-
const
|
558
|
+
const categoricalMin = 0;
|
559
|
+
const categoricalMax = logLength - 1;
|
541
560
|
let rgb;
|
542
561
|
if (colorMappingFunction) {
|
543
|
-
rgb = colorMappingFunction(point,
|
562
|
+
rgb = colorMappingFunction(point, categorical, categoricalMin, categoricalMax);
|
544
563
|
}
|
545
564
|
else {
|
546
|
-
// if
|
565
|
+
// if color-map function is not defined
|
547
566
|
const arrayOfColors = getColors(logColor, colorTables, point);
|
548
567
|
if (!arrayOfColors.length)
|
549
|
-
console.error(
|
550
|
-
|
568
|
+
console.error(`Empty or missed '${logColor}' color table`);
|
569
|
+
else {
|
570
|
+
rgb = arrayOfColors;
|
571
|
+
}
|
551
572
|
}
|
552
573
|
if (rgb) {
|
553
|
-
if (
|
554
|
-
|
555
|
-
attributesObject[key] = [
|
556
|
-
[rgb[0], rgb[1], rgb[2]],
|
557
|
-
point,
|
558
|
-
];
|
559
|
-
}
|
560
|
-
else {
|
561
|
-
attributesObject[key] = [
|
562
|
-
[rgb[1], rgb[2], rgb[3]],
|
563
|
-
point,
|
564
|
-
];
|
565
|
-
}
|
574
|
+
if (rgb.length === 3) {
|
575
|
+
attributesObject[key] = [[rgb[0], rgb[1], rgb[2]], point];
|
566
576
|
}
|
567
577
|
else {
|
568
|
-
|
578
|
+
// ? What is the point of this? Why do we offset the index in this case, isn't the fourth value the opacity?
|
579
|
+
// (@anders2303)
|
580
|
+
attributesObject[key] = [[rgb[1], rgb[2], rgb[3]], point];
|
569
581
|
}
|
570
582
|
}
|
571
583
|
});
|
572
584
|
log_data.forEach((log_value) => {
|
573
585
|
var _a;
|
574
586
|
const dl_attrs = (_a = Object.entries(attributesObject).find(([, value]) => value[1] == log_value)) === null || _a === void 0 ? void 0 : _a[1];
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
|
579
|
-
: log_color.push([0, 0, 0, 0]); // use transparent for undefined/null log values
|
587
|
+
if (dl_attrs)
|
588
|
+
log_color.push(dl_attrs[0]);
|
589
|
+
else
|
590
|
+
log_color.push([0, 0, 0, 0]); // use transparent for undefined/null log values
|
580
591
|
});
|
581
592
|
}
|
582
593
|
return log_color;
|
@@ -735,13 +746,13 @@ function getMd(coord, feature, accessor) {
|
|
735
746
|
var _a, _b;
|
736
747
|
if (!((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a["md"]) === null || _b === void 0 ? void 0 : _b[0]) || !feature.geometry)
|
737
748
|
return null;
|
738
|
-
const measured_depths = feature.properties
|
749
|
+
const measured_depths = feature.properties.md[0];
|
739
750
|
const trajectory3D = getTrajectory(feature, accessor);
|
740
751
|
if (trajectory3D == undefined)
|
741
752
|
return null;
|
742
753
|
let trajectory;
|
743
754
|
// In 2D view coord is of type Position2D and in 3D view it's Position3D,
|
744
|
-
// so use
|
755
|
+
// so use appropriate trajectory for interpolation
|
745
756
|
if (coord.length == 2) {
|
746
757
|
const trajectory2D = trajectory3D.map((v) => {
|
747
758
|
return v.slice(0, 2);
|
@@ -840,7 +851,7 @@ function getLogProperty(coord, wells_data, log_data, logrun_name, log_name) {
|
|
840
851
|
else
|
841
852
|
return null;
|
842
853
|
}
|
843
|
-
// Return data required to build
|
854
|
+
// Return data required to build well layer legend
|
844
855
|
function getLegendData(logs, wellName, logName, logColor) {
|
845
856
|
if (!logs)
|
846
857
|
return null;
|