@webviz/subsurface-viewer 1.10.2 → 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 +140 -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,18 +195,20 @@ 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), {
|
198
|
+
const wellLabelProps = this.getSubLayerProps(Object.assign(Object.assign({}, this.props.wellLabel), { id: SubLayerId.LABELS, data,
|
199
|
+
// Z is always increasing upwards at this stage
|
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) ||
|
217
201
|
this.props.hideOverlappingWellNames }));
|
218
202
|
return new WellLabelLayer(wellLabelProps);
|
219
203
|
}
|
220
204
|
renderLayers() {
|
221
205
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s;
|
222
|
-
|
223
|
-
return [];
|
224
|
-
}
|
225
|
-
const data = this.state["data"];
|
206
|
+
const data = this.getWellDataState();
|
226
207
|
const positionFormat = "XYZ";
|
227
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
|
+
}
|
228
212
|
const extensions = [
|
229
213
|
new PathStyleExtension({
|
230
214
|
dash: isDashed,
|
@@ -253,11 +237,11 @@ export default class WellsLayer extends CompositeLayer {
|
|
253
237
|
parameters,
|
254
238
|
visible: fastDrawing,
|
255
239
|
};
|
256
|
-
const colorsLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
257
|
-
const fastLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
258
|
-
const outlineLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
259
|
-
const highlightLayerProps = this.getSubLayerProps(Object.assign(Object.assign({}, defaultLayerProps), { id:
|
260
|
-
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 }));
|
261
245
|
const fastLayer = new GeoJsonLayer(fastLayerProps);
|
262
246
|
const outlineLayer = new GeoJsonLayer(outlineLayerProps);
|
263
247
|
const colorsLayer = new GeoJsonLayer(colorsLayerProps);
|
@@ -266,7 +250,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
266
250
|
// Highlight the multi selected wells.
|
267
251
|
const highlightMultiWellsLayer = new GeoJsonLayer(highlightMultiWellsLayerProps);
|
268
252
|
const logLayer = new PathLayer(this.getSubLayerProps({
|
269
|
-
id:
|
253
|
+
id: SubLayerId.LOG_CURVE,
|
270
254
|
data: this.props.logData,
|
271
255
|
positionFormat,
|
272
256
|
pickable: true,
|
@@ -304,7 +288,7 @@ export default class WellsLayer extends CompositeLayer {
|
|
304
288
|
visible: this.props.logCurves && !fastDrawing,
|
305
289
|
}));
|
306
290
|
const selectionLayer = new PathLayer(this.getSubLayerProps({
|
307
|
-
id:
|
291
|
+
id: SubLayerId.SELECTION,
|
308
292
|
data: this.props.logData,
|
309
293
|
positionFormat,
|
310
294
|
pickable: false,
|
@@ -313,16 +297,16 @@ export default class WellsLayer extends CompositeLayer {
|
|
313
297
|
miterLimit: 100,
|
314
298
|
getPath: (d) => {
|
315
299
|
var _a;
|
316
|
-
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);
|
317
301
|
},
|
318
|
-
getColor: (d) => getLogColor1(data.features, d, this.state
|
302
|
+
getColor: (d) => getLogColor1(data.features, d, this.state.well, this.state.selection, this.props.logrunName),
|
319
303
|
getWidth: (d) => this.props.logRadius * 1.5 ||
|
320
304
|
getLogWidth(d, this.props.logrunName, this.props.logName),
|
321
305
|
updateTriggers: {
|
322
306
|
getColor: [
|
323
307
|
this.props.logrunName,
|
324
|
-
this.state
|
325
|
-
this.state
|
308
|
+
this.state.well,
|
309
|
+
this.state.selection,
|
326
310
|
],
|
327
311
|
getWidth: [
|
328
312
|
this.props.logrunName,
|
@@ -332,8 +316,8 @@ export default class WellsLayer extends CompositeLayer {
|
|
332
316
|
getPath: [
|
333
317
|
positionFormat,
|
334
318
|
this.props.logrunName,
|
335
|
-
this.state
|
336
|
-
this.state
|
319
|
+
this.state.well,
|
320
|
+
this.state.selection,
|
337
321
|
],
|
338
322
|
},
|
339
323
|
onDataLoad: (value) => {
|
@@ -358,23 +342,32 @@ export default class WellsLayer extends CompositeLayer {
|
|
358
342
|
return layers;
|
359
343
|
}
|
360
344
|
getPickingInfo({ info }) {
|
361
|
-
var _a, _b;
|
345
|
+
var _a, _b, _c, _d, _e;
|
362
346
|
if (!info.object)
|
363
347
|
return Object.assign(Object.assign({}, info), { properties: [], logName: "" });
|
364
|
-
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];
|
365
350
|
const zScale = this.props.modelMatrix ? this.props.modelMatrix[10] : 1;
|
366
351
|
if (typeof coordinate[2] !== "undefined") {
|
367
352
|
coordinate[2] /= Math.max(0.001, zScale);
|
368
353
|
}
|
369
|
-
let md_property =
|
370
|
-
|
371
|
-
|
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);
|
372
364
|
}
|
373
|
-
|
374
|
-
|
375
|
-
|
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);
|
376
370
|
}
|
377
|
-
const log_property = getLogProperty(coordinate, this.props.data.features, info.object, this.props.logrunName, this.props.logName);
|
378
371
|
// Patch for inverting tvd readout to fix issue #830,
|
379
372
|
// should make proper fix when handling z increase direction - issue #842
|
380
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 });
|
@@ -391,6 +384,45 @@ export default class WellsLayer extends CompositeLayer {
|
|
391
384
|
WellsLayer.layerName = "WellsLayer";
|
392
385
|
WellsLayer.defaultProps = Object.assign(Object.assign({}, defaultProps), { onDataLoad: (data, context) => onDataLoad(data, context) });
|
393
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
|
+
}
|
394
426
|
function getColumn(data, col) {
|
395
427
|
const column = [];
|
396
428
|
for (let i = 0; i < data.length; i++) {
|
@@ -424,33 +456,30 @@ function isSelectedLogRun(d, logrun_name) {
|
|
424
456
|
return d.header.name.toLowerCase() === logrun_name.toLowerCase();
|
425
457
|
}
|
426
458
|
function getWellObjectByName(wells_data, name) {
|
427
|
-
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()); });
|
428
460
|
}
|
429
461
|
function getWellObjectsByName(wells_data, name) {
|
430
462
|
const res = [];
|
431
463
|
for (let i = 0; i < (name === null || name === void 0 ? void 0 : name.length); i++) {
|
432
464
|
wells_data === null || wells_data === void 0 ? void 0 : wells_data.find((item) => {
|
433
465
|
var _a, _b, _c;
|
434
|
-
if (((_b = (_a = item.properties) === null || _a === void 0 ? void 0 : _a
|
435
|
-
((_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()))
|
436
467
|
res.push(item);
|
437
|
-
}
|
438
468
|
});
|
439
469
|
}
|
440
470
|
return res;
|
441
471
|
}
|
442
472
|
function getPointGeometry(well_object) {
|
443
|
-
|
444
|
-
return
|
473
|
+
const geometries = well_object.geometry.geometries;
|
474
|
+
return geometries.find((item) => item.type === "Point");
|
445
475
|
}
|
446
476
|
// Return well head position from Point Geometry
|
447
477
|
function getWellHeadPosition(well_object) {
|
448
|
-
var _a;
|
449
|
-
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];
|
450
480
|
}
|
451
481
|
function getWellMds(well_object) {
|
452
|
-
|
453
|
-
return (_a = well_object.properties) === null || _a === void 0 ? void 0 : _a["md"][0];
|
482
|
+
return well_object.properties.md[0];
|
454
483
|
}
|
455
484
|
function getNeighboringMdIndices(mds, md) {
|
456
485
|
const idx = mds.findIndex((x) => x >= md);
|
@@ -493,9 +522,7 @@ function getLogIndexByNames(d, names) {
|
|
493
522
|
}
|
494
523
|
return -1;
|
495
524
|
}
|
496
|
-
function getLogColor(d, logrun_name, log_name, logColor, colorTables,
|
497
|
-
// eslint-disable-next-line
|
498
|
-
colorMappingFunction, isLog) {
|
525
|
+
function getLogColor(d, logrun_name, log_name, logColor, colorTables, colorMappingFunction, isLog) {
|
499
526
|
var _a;
|
500
527
|
const log_data = getLogValues(d, logrun_name, log_name);
|
501
528
|
const log_info = getLogInfo(d, logrun_name, log_name);
|
@@ -507,17 +534,12 @@ colorMappingFunction, isLog) {
|
|
507
534
|
const max = Math.max(...log_data);
|
508
535
|
const max_delta = max - min;
|
509
536
|
log_data.forEach((value) => {
|
537
|
+
const adjustedVal = (value - min) / max_delta;
|
510
538
|
const rgb = colorMappingFunction
|
511
|
-
? colorMappingFunction(
|
512
|
-
: rgbValues(
|
513
|
-
rgbValues(value - min / max_delta, logColor, colorTables, isLog);
|
539
|
+
? colorMappingFunction(adjustedVal)
|
540
|
+
: rgbValues(adjustedVal, logColor, colorTables, isLog);
|
514
541
|
if (rgb) {
|
515
|
-
|
516
|
-
log_color.push([rgb[0], rgb[1], rgb[2]]);
|
517
|
-
}
|
518
|
-
else {
|
519
|
-
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]);
|
520
|
-
}
|
542
|
+
log_color.push([rgb[0], rgb[1], rgb[2]]);
|
521
543
|
}
|
522
544
|
else {
|
523
545
|
log_color.push([0, 0, 0, 0]); // push transparent for null/undefined log values
|
@@ -528,53 +550,44 @@ colorMappingFunction, isLog) {
|
|
528
550
|
// well log data set for ex : H1: Array(2)0: (4) [255, 26, 202, 255] 1: 13
|
529
551
|
const log_attributes = (_a = getDiscreteLogMetadata(d, log_name)) === null || _a === void 0 ? void 0 : _a.objects;
|
530
552
|
const logLength = Object.keys(log_attributes).length;
|
531
|
-
// eslint-disable-next-line
|
532
553
|
const attributesObject = {};
|
533
|
-
const
|
554
|
+
const categorical = true;
|
534
555
|
Object.keys(log_attributes).forEach((key) => {
|
535
556
|
// get the point from log_attributes
|
536
557
|
const point = log_attributes[key][1];
|
537
|
-
const
|
538
|
-
const
|
558
|
+
const categoricalMin = 0;
|
559
|
+
const categoricalMax = logLength - 1;
|
539
560
|
let rgb;
|
540
561
|
if (colorMappingFunction) {
|
541
|
-
rgb = colorMappingFunction(point,
|
562
|
+
rgb = colorMappingFunction(point, categorical, categoricalMin, categoricalMax);
|
542
563
|
}
|
543
564
|
else {
|
544
|
-
// if
|
565
|
+
// if color-map function is not defined
|
545
566
|
const arrayOfColors = getColors(logColor, colorTables, point);
|
546
567
|
if (!arrayOfColors.length)
|
547
|
-
console.error(
|
548
|
-
|
568
|
+
console.error(`Empty or missed '${logColor}' color table`);
|
569
|
+
else {
|
570
|
+
rgb = arrayOfColors;
|
571
|
+
}
|
549
572
|
}
|
550
573
|
if (rgb) {
|
551
|
-
if (
|
552
|
-
|
553
|
-
attributesObject[key] = [
|
554
|
-
[rgb[0], rgb[1], rgb[2]],
|
555
|
-
point,
|
556
|
-
];
|
557
|
-
}
|
558
|
-
else {
|
559
|
-
attributesObject[key] = [
|
560
|
-
[rgb[1], rgb[2], rgb[3]],
|
561
|
-
point,
|
562
|
-
];
|
563
|
-
}
|
574
|
+
if (rgb.length === 3) {
|
575
|
+
attributesObject[key] = [[rgb[0], rgb[1], rgb[2]], point];
|
564
576
|
}
|
565
577
|
else {
|
566
|
-
|
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];
|
567
581
|
}
|
568
582
|
}
|
569
583
|
});
|
570
584
|
log_data.forEach((log_value) => {
|
571
585
|
var _a;
|
572
586
|
const dl_attrs = (_a = Object.entries(attributesObject).find(([, value]) => value[1] == log_value)) === null || _a === void 0 ? void 0 : _a[1];
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
: 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
|
578
591
|
});
|
579
592
|
}
|
580
593
|
return log_color;
|
@@ -733,13 +746,13 @@ function getMd(coord, feature, accessor) {
|
|
733
746
|
var _a, _b;
|
734
747
|
if (!((_b = (_a = feature.properties) === null || _a === void 0 ? void 0 : _a["md"]) === null || _b === void 0 ? void 0 : _b[0]) || !feature.geometry)
|
735
748
|
return null;
|
736
|
-
const measured_depths = feature.properties
|
749
|
+
const measured_depths = feature.properties.md[0];
|
737
750
|
const trajectory3D = getTrajectory(feature, accessor);
|
738
751
|
if (trajectory3D == undefined)
|
739
752
|
return null;
|
740
753
|
let trajectory;
|
741
754
|
// In 2D view coord is of type Position2D and in 3D view it's Position3D,
|
742
|
-
// so use
|
755
|
+
// so use appropriate trajectory for interpolation
|
743
756
|
if (coord.length == 2) {
|
744
757
|
const trajectory2D = trajectory3D.map((v) => {
|
745
758
|
return v.slice(0, 2);
|
@@ -838,7 +851,7 @@ function getLogProperty(coord, wells_data, log_data, logrun_name, log_name) {
|
|
838
851
|
else
|
839
852
|
return null;
|
840
853
|
}
|
841
|
-
// Return data required to build
|
854
|
+
// Return data required to build well layer legend
|
842
855
|
function getLegendData(logs, wellName, logName, logColor) {
|
843
856
|
if (!logs)
|
844
857
|
return null;
|