@webviz/well-log-viewer 2.3.2 → 2.3.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/SyncLogViewer.d.ts +4 -5
- package/dist/SyncLogViewer.js +14 -59
- package/dist/SyncLogViewer.js.map +1 -1
- package/dist/WellLogViewer.js +2 -1
- package/dist/WellLogViewer.js.map +1 -1
- package/dist/components/WellLogAxesPanel.js +1 -1
- package/dist/components/WellLogAxesPanel.js.map +1 -1
- package/dist/components/WellLogSpacer.d.ts +1 -1
- package/dist/components/WellLogView.d.ts +17 -19
- package/dist/components/WellLogView.js +96 -142
- package/dist/components/WellLogView.js.map +1 -1
- package/dist/components/WellLogViewWithScroller.js +0 -14
- package/dist/components/WellLogViewWithScroller.js.map +1 -1
- package/dist/utils/arrays.d.ts +64 -0
- package/dist/utils/arrays.js +117 -0
- package/dist/utils/arrays.js.map +1 -0
- package/dist/utils/axes.d.ts +7 -0
- package/dist/utils/axes.js +3 -0
- package/dist/utils/axes.js.map +1 -1
- package/dist/{components/ColorMapFunction.d.ts → utils/color-function.d.ts} +2 -1
- package/dist/utils/color-function.js +20 -0
- package/dist/utils/color-function.js.map +1 -0
- package/dist/utils/color-table.d.ts +1 -1
- package/dist/utils/color-table.js +1 -1
- package/dist/utils/color-table.js.map +1 -1
- package/dist/utils/fill-info.js +1 -1
- package/dist/utils/fill-info.js.map +1 -1
- package/dist/utils/generateColor.d.ts +1 -0
- package/dist/utils/generateColor.js +15 -0
- package/dist/utils/generateColor.js.map +1 -0
- package/dist/utils/gradientfill-plot-legend.js +1 -1
- package/dist/utils/gradientfill-plot-legend.js.map +1 -1
- package/dist/utils/gradientfill-plot.d.ts +1 -1
- package/dist/utils/gradientfill-plot.js +2 -2
- package/dist/utils/gradientfill-plot.js.map +1 -1
- package/dist/utils/log-viewer.d.ts +174 -19
- package/dist/utils/log-viewer.js +311 -68
- package/dist/utils/log-viewer.js.map +1 -1
- package/dist/utils/plots.d.ts +109 -0
- package/dist/utils/plots.js +344 -0
- package/dist/utils/plots.js.map +1 -0
- package/dist/utils/template.d.ts +25 -0
- package/dist/utils/template.js +124 -0
- package/dist/utils/template.js.map +1 -0
- package/dist/utils/trackFactory.d.ts +39 -0
- package/dist/utils/trackFactory.js +79 -0
- package/dist/utils/trackFactory.js.map +1 -0
- package/dist/utils/tracks.d.ts +100 -52
- package/dist/utils/tracks.js +323 -935
- package/dist/utils/tracks.js.map +1 -1
- package/dist/utils/well-log.d.ts +14 -2
- package/dist/utils/well-log.js +102 -0
- package/dist/utils/well-log.js.map +1 -1
- package/package.json +2 -2
- package/dist/components/ColorMapFunction.js +0 -6
- package/dist/components/ColorMapFunction.js.map +0 -1
|
@@ -1,21 +1,176 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for modifying the videx log controller
|
|
3
|
+
*/
|
|
4
|
+
import type { LogViewer as VidexLogViewer, ScaleInterpolator, Track } from "@equinor/videx-wellog";
|
|
5
|
+
import type { TrackOptions } from "@equinor/videx-wellog/dist/tracks/interfaces";
|
|
6
|
+
import type { AxesInfo } from "./axes";
|
|
7
|
+
import type { ColorMapFunction } from "./color-function";
|
|
8
|
+
import type { TemplateTrack } from "../components/WellLogTemplateTypes";
|
|
9
|
+
import type { WellLogSet } from "../components/WellLogTypes";
|
|
10
|
+
/**
|
|
11
|
+
* Sets a log viewer's base domain.
|
|
12
|
+
* @param logViewer A videx log view controller
|
|
13
|
+
* @param domain The domain to change to
|
|
14
|
+
* @returns `true` if the base domain was changed, otherwise `false`.
|
|
15
|
+
*/
|
|
16
|
+
export declare function setContentBaseDomain(logViewer: VidexLogViewer, domain: [number, number]): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Expands a log viewer's base domain so that a given range exists within it.
|
|
19
|
+
* @param logViewer A videx log view controller
|
|
20
|
+
* @param range A number range to scale to
|
|
21
|
+
*/
|
|
22
|
+
export declare function expandDomainToFitRange(logViewer: VidexLogViewer, range: [number, number]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Removes a log viewer's overlay.
|
|
25
|
+
* @param logViewer A videx log view controller
|
|
26
|
+
*/
|
|
27
|
+
export declare function removeOverlay(logViewer: VidexLogViewer): void;
|
|
28
|
+
/**
|
|
29
|
+
* Checks if a videx track is visible.
|
|
30
|
+
* @param track A videx track
|
|
31
|
+
* @returns `true` if the track is visible, `false` otherwise.
|
|
32
|
+
*/
|
|
6
33
|
export declare function isTrackVisible(track: Track): boolean;
|
|
34
|
+
/**
|
|
35
|
+
* Sets the visibility of a videx track element (using CSS)
|
|
36
|
+
* @param track - A videx log track.
|
|
37
|
+
* @param visible - Whether the track should be visible (`true`) or hidden (`false`).
|
|
38
|
+
* @returns `true` if the visibility was changed, otherwise `false`.
|
|
39
|
+
*/
|
|
7
40
|
export declare function showTrack(track: Track, visible: boolean): boolean;
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export declare function
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Checks if a videx track is currently selected
|
|
43
|
+
* @param _logViewer A videx controller.
|
|
44
|
+
* @param track A videx log track.
|
|
45
|
+
* @returns `true` if the track is selected, otherwise `false`.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isTrackSelected(_logViewer: VidexLogViewer, track: Track): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Selects or deselects a track in a videx log viewer. A selected track get added a "selected" class.
|
|
50
|
+
* @param logViewer A videx log view controller
|
|
51
|
+
* @param track A videx log track
|
|
52
|
+
* @param selected Whether the track should be selected or not
|
|
53
|
+
* @returns `true` if the selection was changed, otherwise `false`.
|
|
54
|
+
*/
|
|
55
|
+
export declare function selectTrack(logViewer: VidexLogViewer, track: Track, selected: boolean): boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Returns all indices of a log log viewer's selected tracks.
|
|
58
|
+
* @param logViewer A videx log view controller.
|
|
59
|
+
* @returns An array of indices of selected tracks.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getSelectedTrackIndices(logViewer?: VidexLogViewer): number[];
|
|
62
|
+
/**
|
|
63
|
+
* Finds the index of a track in a videx log viewer.
|
|
64
|
+
* @param logViewer A videx log view controller.
|
|
65
|
+
* @param track A videx track.
|
|
66
|
+
* @returns The index of the track in the log controller. -1 if the track is not found.
|
|
67
|
+
*/
|
|
68
|
+
export declare function getTrackIndex(logViewer: VidexLogViewer, track: Track): number;
|
|
69
|
+
/**
|
|
70
|
+
* Sets the zoom scale of a videx log viewer to a given scale.
|
|
71
|
+
* @param logViewer A videx log view controller
|
|
72
|
+
* @param zoom The zoom scale to set. If not provided, the zoom scale will be set to 1.0.
|
|
73
|
+
* @returns `true` if the zoom scale was changed, otherwise `false`.
|
|
74
|
+
*/
|
|
75
|
+
export declare function zoomContent(logViewer: VidexLogViewer, zoom: number): boolean;
|
|
76
|
+
/**
|
|
77
|
+
* Scrolls the log viewers content so that a given fraction of it is visible.
|
|
78
|
+
* @param logViewer A videx log view controller
|
|
79
|
+
* @param fraction The fraction of the content to be visible. 0 shows the start of the content, 1 shows the end.
|
|
80
|
+
* @returns `true` if the content was scrolled, otherwise `false`.
|
|
81
|
+
*/
|
|
82
|
+
export declare function scrollContentTo(logViewer: VidexLogViewer, fraction: number): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Updates a videx log viewer to show a given domain.
|
|
85
|
+
* @param logViewer A videx log view controller
|
|
86
|
+
* @param domain The target domain that should be shown
|
|
87
|
+
* @returns `true` if the content was zoomed, otherwise `false`.
|
|
88
|
+
*/
|
|
89
|
+
export declare function zoomContentTo(logViewer: VidexLogViewer, domain: [number, number]): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* Returns the base domain of a videx log viewer.
|
|
92
|
+
* @param logViewer A videx log view controller
|
|
93
|
+
* @returns The base domain as a two-element tuple.
|
|
94
|
+
*/
|
|
95
|
+
export declare function getContentBaseDomain(logViewer: VidexLogViewer): [number, number];
|
|
96
|
+
/**
|
|
97
|
+
* Returns the domain of the currently visible content of a videx log viewer.
|
|
98
|
+
* @param logViewer A videx log view controller
|
|
99
|
+
* @returns The domain as a two-element tuple.
|
|
100
|
+
*/
|
|
101
|
+
export declare function getContentDomain(logViewer: VidexLogViewer): [number, number];
|
|
102
|
+
/**
|
|
103
|
+
* Returns the zoom level (0 - 1) of a videx log viewer.
|
|
104
|
+
* @param logViewer A videx log view controller
|
|
105
|
+
* @returns The zoom level
|
|
106
|
+
*/
|
|
107
|
+
export declare function getContentZoom(logViewer: VidexLogViewer): number;
|
|
108
|
+
/**
|
|
109
|
+
* Changes the visibliity of a range of tracks in a videx log viewer, so that the given range is visible.
|
|
110
|
+
* Scale tracks are untouched.
|
|
111
|
+
* @param logViewer A videx log view controller
|
|
112
|
+
* @param iFrom The index of the first track that should be visible
|
|
113
|
+
* @param iTo The index of the last track that should be visible
|
|
114
|
+
* @returns `true` if the visibility was changed, otherwise `false`.
|
|
115
|
+
*/
|
|
116
|
+
export declare function scrollTracksTo(logViewer: VidexLogViewer, iFrom: number, iTo: number): boolean;
|
|
117
|
+
/**
|
|
118
|
+
* Finds the index of the first visible track in a videx log viewer.
|
|
119
|
+
* @param logViewer A videx log view controller
|
|
120
|
+
* @returns The index of the first visible track in the log viewer.
|
|
121
|
+
*/
|
|
122
|
+
export declare function getFirstVisibleTrack(logViewer: VidexLogViewer): number;
|
|
123
|
+
/**
|
|
124
|
+
* Sets a list of tracks in a videx log viewer as selected.
|
|
125
|
+
* @param logViewer A videx log view controller
|
|
126
|
+
* @param selectedTrackIndices A list of track indices to select
|
|
127
|
+
* @returns `true` if the selection was changed, otherwise `false`.
|
|
128
|
+
*/
|
|
129
|
+
export declare function setSelectedTrackIndices(logViewer: VidexLogViewer | undefined, selectedTrackIndices: number[]): boolean;
|
|
130
|
+
/**
|
|
131
|
+
* Adjusts various log viewer internals to fit a track.
|
|
132
|
+
* @param logViewer A videx log view controller
|
|
133
|
+
* @param modifiedTrack A videx track
|
|
134
|
+
*/
|
|
135
|
+
export declare function adjustControllerToModifiedTrack(logViewer: VidexLogViewer, modifiedTrack?: Track): void;
|
|
136
|
+
/**
|
|
137
|
+
* Updates the legend rows of a videx log view
|
|
138
|
+
* @param logViewer A videx log view controller
|
|
139
|
+
*/
|
|
140
|
+
export declare function updateLegendRows(logViewer: VidexLogViewer): void;
|
|
141
|
+
/**
|
|
142
|
+
* Creates a new well-log track, and adds it to a videx log viewer at a specified position.
|
|
143
|
+
* @param logViewer A videx log view controller
|
|
144
|
+
* @param template A template config for the new track
|
|
145
|
+
* @param position The new track's position in the log viewer
|
|
146
|
+
* @param axesInfo Information about the axis curves in the log
|
|
147
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
148
|
+
* @param colorMapFunctions An array of color map functions to apply to the track
|
|
149
|
+
* @returns The new track if successful, otherwise `null`
|
|
150
|
+
*/
|
|
151
|
+
export declare function createNewViewTrack(logViewer: VidexLogViewer, template: TemplateTrack, position: number, axesInfo: AxesInfo, wellLogSets: WellLogSet[], colorMapFunctions?: ColorMapFunction[]): Track<TrackOptions> | null;
|
|
152
|
+
/**
|
|
153
|
+
* Modifies a videx track with a new template configuration.
|
|
154
|
+
* @param logViewer A videx log view controller
|
|
155
|
+
* @param track A videx track to modify
|
|
156
|
+
* @param template A modified template config to apply to the track
|
|
157
|
+
* @param axesInfo Information about the axis curves in the log
|
|
158
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
159
|
+
* @param colorMapFunctions An array of color map functions to apply to the track
|
|
160
|
+
* @returns The modified track
|
|
161
|
+
*/
|
|
162
|
+
export declare function editViewTrack(logViewer: VidexLogViewer, track: Track, newTemplate: TemplateTrack, axesInfo: AxesInfo, wellLogSets: WellLogSet[], colorMapFunctions?: ColorMapFunction[]): Track;
|
|
163
|
+
/**
|
|
164
|
+
* Removes a videx track from a log viewer.
|
|
165
|
+
* @param logViewer A videx log view controller
|
|
166
|
+
* @param track A videx track to modify
|
|
167
|
+
*/
|
|
168
|
+
export declare function removeViewTrack(logViewer: VidexLogViewer, track: Track): void;
|
|
169
|
+
/**
|
|
170
|
+
* Sets up a scale interpolator for a well log viewer that has multiple axes, and adds it to the view-controller
|
|
171
|
+
* @param logViewer A videx log view controller
|
|
172
|
+
* @param axesInfo Information about the axis curves in the log
|
|
173
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
174
|
+
* @returns The scale interpolator that was created
|
|
175
|
+
*/
|
|
176
|
+
export declare function setUpScaleInterpolator(logViewer: VidexLogViewer, wellLogSet: WellLogSet, axesInfo: AxesInfo): ScaleInterpolator;
|
package/dist/utils/log-viewer.js
CHANGED
|
@@ -1,28 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
if (
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
return true;
|
|
19
|
-
|
|
20
|
-
return
|
|
1
|
+
import { InterpolatedScaleHandler } from "@equinor/videx-wellog";
|
|
2
|
+
import { getAxisIndices } from "./well-log";
|
|
3
|
+
import { checkMinMax } from "./minmax";
|
|
4
|
+
import { createTrack, isScaleTrack, editTrack } from "../utils/tracks";
|
|
5
|
+
import { isEqDomains } from "./arrays";
|
|
6
|
+
/**
|
|
7
|
+
* Sets a log viewer's base domain.
|
|
8
|
+
* @param logViewer A videx log view controller
|
|
9
|
+
* @param domain The domain to change to
|
|
10
|
+
* @returns `true` if the base domain was changed, otherwise `false`.
|
|
11
|
+
*/
|
|
12
|
+
export function setContentBaseDomain(logViewer, domain) {
|
|
13
|
+
const [b1, b2] = logViewer.scaleHandler.baseDomain();
|
|
14
|
+
if (b1 !== domain[0] || b2 !== domain[1]) {
|
|
15
|
+
logViewer.domain = domain;
|
|
16
|
+
// logViewer.scaleHandler.baseDomain(domain);
|
|
17
|
+
// logViewer.rescale();
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Expands a log viewer's base domain so that a given range exists within it.
|
|
24
|
+
* @param logViewer A videx log view controller
|
|
25
|
+
* @param range A number range to scale to
|
|
26
|
+
*/
|
|
27
|
+
export function expandDomainToFitRange(logViewer, range) {
|
|
28
|
+
const baseDomain = logViewer.scaleHandler.baseDomain();
|
|
29
|
+
checkMinMax(baseDomain, range);
|
|
30
|
+
logViewer.rescale();
|
|
21
31
|
}
|
|
32
|
+
/**
|
|
33
|
+
* Removes a log viewer's overlay.
|
|
34
|
+
* @param logViewer A videx log view controller
|
|
35
|
+
*/
|
|
22
36
|
export function removeOverlay(logViewer) {
|
|
23
37
|
logViewer.container.select(".overlay").remove();
|
|
24
|
-
//
|
|
38
|
+
// ? Why is this commented out? (@anders2303)
|
|
39
|
+
// logViewer.overlay = null;
|
|
25
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Checks if a videx track is visible.
|
|
43
|
+
* @param track A videx track
|
|
44
|
+
* @returns `true` if the track is visible, `false` otherwise.
|
|
45
|
+
*/
|
|
26
46
|
export function isTrackVisible(track) {
|
|
27
47
|
if (track.elm) {
|
|
28
48
|
const elm = track.elm.parentElement;
|
|
@@ -32,53 +52,85 @@ export function isTrackVisible(track) {
|
|
|
32
52
|
}
|
|
33
53
|
return false;
|
|
34
54
|
}
|
|
55
|
+
/**
|
|
56
|
+
* Sets the visibility of a videx track element (using CSS)
|
|
57
|
+
* @param track - A videx log track.
|
|
58
|
+
* @param visible - Whether the track should be visible (`true`) or hidden (`false`).
|
|
59
|
+
* @returns `true` if the visibility was changed, otherwise `false`.
|
|
60
|
+
*/
|
|
61
|
+
// ? It's only used locally here, should this be exported? (@anders2303)
|
|
35
62
|
export function showTrack(track, visible) {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return true; // visibility is changed
|
|
43
|
-
}
|
|
44
|
-
}
|
|
63
|
+
var _a;
|
|
64
|
+
const newDisplayValue = visible ? "flex" : "none";
|
|
65
|
+
const trackParentElm = (_a = track.elm) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
66
|
+
if (trackParentElm && trackParentElm.style.display !== newDisplayValue) {
|
|
67
|
+
trackParentElm.style.display = newDisplayValue;
|
|
68
|
+
return true; // visibility is changed
|
|
45
69
|
}
|
|
46
70
|
return false; // visibility is not changed
|
|
47
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Checks if a videx track is currently selected
|
|
74
|
+
* @param _logViewer A videx controller.
|
|
75
|
+
* @param track A videx log track.
|
|
76
|
+
* @returns `true` if the track is selected, otherwise `false`.
|
|
77
|
+
*/
|
|
48
78
|
export function isTrackSelected(_logViewer, track) {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
return false;
|
|
79
|
+
var _a;
|
|
80
|
+
const trackParentElm = (_a = track.elm) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
81
|
+
if (!trackParentElm)
|
|
82
|
+
return false;
|
|
83
|
+
return trackParentElm.classList.contains("selected");
|
|
56
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Selects or deselects a track in a videx log viewer. A selected track get added a "selected" class.
|
|
87
|
+
* @param logViewer A videx log view controller
|
|
88
|
+
* @param track A videx log track
|
|
89
|
+
* @param selected Whether the track should be selected or not
|
|
90
|
+
* @returns `true` if the selection was changed, otherwise `false`.
|
|
91
|
+
*/
|
|
57
92
|
export function selectTrack(logViewer, track, selected) {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
return true; // selection is changed
|
|
64
|
-
}
|
|
65
|
-
}
|
|
93
|
+
var _a;
|
|
94
|
+
const trackParentElm = (_a = track.elm) === null || _a === void 0 ? void 0 : _a.parentElement;
|
|
95
|
+
if (trackParentElm && isTrackSelected(logViewer, track) !== selected) {
|
|
96
|
+
trackParentElm.classList.toggle("selected");
|
|
97
|
+
return true; // selection is changed
|
|
66
98
|
}
|
|
67
99
|
return false; // selection is not changed
|
|
68
100
|
}
|
|
101
|
+
/**
|
|
102
|
+
* Returns all indices of a log log viewer's selected tracks.
|
|
103
|
+
* @param logViewer A videx log view controller.
|
|
104
|
+
* @returns An array of indices of selected tracks.
|
|
105
|
+
*/
|
|
69
106
|
export function getSelectedTrackIndices(logViewer) {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
selectedTrackIndices.push(iTrack);
|
|
76
|
-
iTrack++;
|
|
107
|
+
if (!logViewer)
|
|
108
|
+
return [];
|
|
109
|
+
return logViewer.tracks.reduce((indices, track, idx) => {
|
|
110
|
+
if (isTrackSelected(logViewer, track)) {
|
|
111
|
+
return [...indices, idx];
|
|
77
112
|
}
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
else {
|
|
114
|
+
return indices;
|
|
115
|
+
}
|
|
116
|
+
}, []);
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* Finds the index of a track in a videx log viewer.
|
|
120
|
+
* @param logViewer A videx log view controller.
|
|
121
|
+
* @param track A videx track.
|
|
122
|
+
* @returns The index of the track in the log controller. -1 if the track is not found.
|
|
123
|
+
*/
|
|
124
|
+
export function getTrackIndex(logViewer, track) {
|
|
125
|
+
return logViewer.tracks.findIndex((t) => t.id === track.id);
|
|
80
126
|
}
|
|
81
127
|
///////////////////////
|
|
128
|
+
/**
|
|
129
|
+
* Sets the zoom scale of a videx log viewer to a given scale.
|
|
130
|
+
* @param logViewer A videx log view controller
|
|
131
|
+
* @param zoom The zoom scale to set. If not provided, the zoom scale will be set to 1.0.
|
|
132
|
+
* @returns `true` if the zoom scale was changed, otherwise `false`.
|
|
133
|
+
*/
|
|
82
134
|
export function zoomContent(logViewer, zoom) {
|
|
83
135
|
if (!zoom)
|
|
84
136
|
zoom = 1.0;
|
|
@@ -102,16 +154,29 @@ export function zoomContent(logViewer, zoom) {
|
|
|
102
154
|
}
|
|
103
155
|
return false;
|
|
104
156
|
}
|
|
105
|
-
|
|
157
|
+
/**
|
|
158
|
+
* Scrolls the log viewers content so that a given fraction of it is visible.
|
|
159
|
+
* @param logViewer A videx log view controller
|
|
160
|
+
* @param fraction The fraction of the content to be visible. 0 shows the start of the content, 1 shows the end.
|
|
161
|
+
* @returns `true` if the content was scrolled, otherwise `false`.
|
|
162
|
+
*/
|
|
163
|
+
export function scrollContentTo(logViewer, fraction) {
|
|
106
164
|
const [b1, b2] = logViewer.scaleHandler.baseDomain();
|
|
107
165
|
const [d1, d2] = logViewer.domain;
|
|
108
166
|
const d = d2 - d1; // width of visible part of content
|
|
109
167
|
const w = b2 - b1 - d; // width of not visible part of content
|
|
110
|
-
const c = b1 +
|
|
168
|
+
const c = b1 + fraction * w;
|
|
111
169
|
const domain = [c, c + d];
|
|
112
170
|
return zoomContentTo(logViewer, domain);
|
|
113
171
|
}
|
|
172
|
+
/**
|
|
173
|
+
* Updates a videx log viewer to show a given domain.
|
|
174
|
+
* @param logViewer A videx log view controller
|
|
175
|
+
* @param domain The target domain that should be shown
|
|
176
|
+
* @returns `true` if the content was zoomed, otherwise `false`.
|
|
177
|
+
*/
|
|
114
178
|
export function zoomContentTo(logViewer, domain) {
|
|
179
|
+
// ? Why do we need to retry multiple times here? (@anders2303)
|
|
115
180
|
if (!isEqDomains(logViewer.domain, domain)) {
|
|
116
181
|
logViewer.zoomTo(domain);
|
|
117
182
|
if (!isEqDomains(logViewer.domain, domain)) {
|
|
@@ -131,31 +196,44 @@ export function zoomContentTo(logViewer, domain) {
|
|
|
131
196
|
}
|
|
132
197
|
return false;
|
|
133
198
|
}
|
|
134
|
-
export function setContentBaseDomain(logViewer, domain) {
|
|
135
|
-
const [b1, b2] = logViewer.scaleHandler.baseDomain();
|
|
136
|
-
if (b1 !== domain[0] || b2 !== domain[1]) {
|
|
137
|
-
logViewer.domain = domain;
|
|
138
|
-
// logViewer.scaleHandler.baseDomain(domain);
|
|
139
|
-
// logViewer.rescale();
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
199
|
////////// utilities
|
|
200
|
+
/**
|
|
201
|
+
* Returns the base domain of a videx log viewer.
|
|
202
|
+
* @param logViewer A videx log view controller
|
|
203
|
+
* @returns The base domain as a two-element tuple.
|
|
204
|
+
*/
|
|
145
205
|
export function getContentBaseDomain(logViewer) {
|
|
146
206
|
const [b1, b2] = logViewer.scaleHandler.baseDomain();
|
|
147
207
|
return [b1, b2];
|
|
148
208
|
}
|
|
209
|
+
/**
|
|
210
|
+
* Returns the domain of the currently visible content of a videx log viewer.
|
|
211
|
+
* @param logViewer A videx log view controller
|
|
212
|
+
* @returns The domain as a two-element tuple.
|
|
213
|
+
*/
|
|
149
214
|
export function getContentDomain(logViewer) {
|
|
150
215
|
const [d1, d2] = logViewer.domain; // same as logViewer.scale.domain()
|
|
151
216
|
return [d1, d2];
|
|
152
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* Returns the zoom level (0 - 1) of a videx log viewer.
|
|
220
|
+
* @param logViewer A videx log view controller
|
|
221
|
+
* @returns The zoom level
|
|
222
|
+
*/
|
|
153
223
|
export function getContentZoom(logViewer) {
|
|
154
224
|
// see also zoomContent(logViewer)
|
|
155
225
|
const [b1, b2] = logViewer.scaleHandler.baseDomain();
|
|
156
226
|
const [d1, d2] = logViewer.domain;
|
|
157
227
|
return Math.abs(b2 - b1) / Math.abs(d2 - d1);
|
|
158
228
|
}
|
|
229
|
+
/**
|
|
230
|
+
* Changes the visibliity of a range of tracks in a videx log viewer, so that the given range is visible.
|
|
231
|
+
* Scale tracks are untouched.
|
|
232
|
+
* @param logViewer A videx log view controller
|
|
233
|
+
* @param iFrom The index of the first track that should be visible
|
|
234
|
+
* @param iTo The index of the last track that should be visible
|
|
235
|
+
* @returns `true` if the visibility was changed, otherwise `false`.
|
|
236
|
+
*/
|
|
159
237
|
export function scrollTracksTo(logViewer, iFrom, iTo) {
|
|
160
238
|
let visibilityIsChanged = false;
|
|
161
239
|
let iTrack = 0; // non-scale (graph) tracks counter
|
|
@@ -171,6 +249,11 @@ export function scrollTracksTo(logViewer, iFrom, iTo) {
|
|
|
171
249
|
logViewer.updateTracks();
|
|
172
250
|
return visibilityIsChanged;
|
|
173
251
|
}
|
|
252
|
+
/**
|
|
253
|
+
* Finds the index of the first visible track in a videx log viewer.
|
|
254
|
+
* @param logViewer A videx log view controller
|
|
255
|
+
* @returns The index of the first visible track in the log viewer.
|
|
256
|
+
*/
|
|
174
257
|
export function getFirstVisibleTrack(logViewer) {
|
|
175
258
|
let iTrack = 0; // non-scale (graph) tracks counter
|
|
176
259
|
for (const track of logViewer.tracks) {
|
|
@@ -182,6 +265,12 @@ export function getFirstVisibleTrack(logViewer) {
|
|
|
182
265
|
}
|
|
183
266
|
return -1;
|
|
184
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* Sets a list of tracks in a videx log viewer as selected.
|
|
270
|
+
* @param logViewer A videx log view controller
|
|
271
|
+
* @param selectedTrackIndices A list of track indices to select
|
|
272
|
+
* @returns `true` if the selection was changed, otherwise `false`.
|
|
273
|
+
*/
|
|
185
274
|
export function setSelectedTrackIndices(logViewer, selectedTrackIndices) {
|
|
186
275
|
let changed = false;
|
|
187
276
|
if (logViewer && selectedTrackIndices) {
|
|
@@ -195,9 +284,163 @@ export function setSelectedTrackIndices(logViewer, selectedTrackIndices) {
|
|
|
195
284
|
}
|
|
196
285
|
return changed;
|
|
197
286
|
}
|
|
287
|
+
/**
|
|
288
|
+
* Adjusts various log viewer internals to fit a track.
|
|
289
|
+
* @param logViewer A videx log view controller
|
|
290
|
+
* @param modifiedTrack A videx track
|
|
291
|
+
*/
|
|
292
|
+
export function adjustControllerToModifiedTrack(logViewer, modifiedTrack) {
|
|
293
|
+
if (!modifiedTrack)
|
|
294
|
+
return;
|
|
295
|
+
// const newTrackRange = getTrackIndexRange(modifiedTrack);
|
|
296
|
+
// expandDomainToFitRange(logViewer, newTrackRange);
|
|
297
|
+
updateLegendRows(logViewer);
|
|
298
|
+
logViewer.updateTracks();
|
|
299
|
+
// logViewer.refresh();
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Updates the legend rows of a videx log view
|
|
303
|
+
* @param logViewer A videx log view controller
|
|
304
|
+
*/
|
|
198
305
|
export function updateLegendRows(logViewer) {
|
|
199
|
-
// access protected member function
|
|
200
|
-
// eslint-disable-next-line
|
|
306
|
+
// @ts-expect-error ts2445 - Need to access a protected member function
|
|
201
307
|
logViewer.updateLegendRows();
|
|
202
308
|
}
|
|
309
|
+
function addTrackAtIndex(logViewer, track, position) {
|
|
310
|
+
const newTracks = [...logViewer.tracks];
|
|
311
|
+
// Inject the new track at position
|
|
312
|
+
newTracks.splice(position, 0, track);
|
|
313
|
+
logViewer.setTracks(newTracks);
|
|
314
|
+
logViewer.updateTracks();
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Creates a new well-log track, and adds it to a videx log viewer at a specified position.
|
|
318
|
+
* @param logViewer A videx log view controller
|
|
319
|
+
* @param template A template config for the new track
|
|
320
|
+
* @param position The new track's position in the log viewer
|
|
321
|
+
* @param axesInfo Information about the axis curves in the log
|
|
322
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
323
|
+
* @param colorMapFunctions An array of color map functions to apply to the track
|
|
324
|
+
* @returns The new track if successful, otherwise `null`
|
|
325
|
+
*/
|
|
326
|
+
export function createNewViewTrack(logViewer, template, position, axesInfo, wellLogSets, colorMapFunctions = []) {
|
|
327
|
+
const newTrack = createTrack(wellLogSets, axesInfo, template, colorMapFunctions);
|
|
328
|
+
if (!newTrack)
|
|
329
|
+
return null;
|
|
330
|
+
addTrackAtIndex(logViewer, newTrack, position);
|
|
331
|
+
// Update scale to fit the new track
|
|
332
|
+
// ! Thinking about it, I don't know if this actually matters, since new tracks are created with no plots?
|
|
333
|
+
adjustControllerToModifiedTrack(logViewer, newTrack);
|
|
334
|
+
return newTrack;
|
|
335
|
+
}
|
|
336
|
+
/**
|
|
337
|
+
* Modifies a videx track with a new template configuration.
|
|
338
|
+
* @param logViewer A videx log view controller
|
|
339
|
+
* @param track A videx track to modify
|
|
340
|
+
* @param template A modified template config to apply to the track
|
|
341
|
+
* @param axesInfo Information about the axis curves in the log
|
|
342
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
343
|
+
* @param colorMapFunctions An array of color map functions to apply to the track
|
|
344
|
+
* @returns The modified track
|
|
345
|
+
*/
|
|
346
|
+
export function editViewTrack(logViewer, track, newTemplate, axesInfo, wellLogSets, colorMapFunctions = []) {
|
|
347
|
+
editTrack(track, newTemplate, wellLogSets, axesInfo, colorMapFunctions);
|
|
348
|
+
adjustControllerToModifiedTrack(logViewer, track);
|
|
349
|
+
return track;
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* Removes a videx track from a log viewer.
|
|
353
|
+
* @param logViewer A videx log view controller
|
|
354
|
+
* @param track A videx track to modify
|
|
355
|
+
*/
|
|
356
|
+
export function removeViewTrack(logViewer, track) {
|
|
357
|
+
logViewer.removeTrack(track);
|
|
358
|
+
// ? Should there not be any scale adjustments and such here? (@anders2303)
|
|
359
|
+
}
|
|
360
|
+
function createInterpolator(from, to) {
|
|
361
|
+
// 'from' array could be non monotonous (TVD) so we could not use binary search!
|
|
362
|
+
// Calculate linear interpolation factor between the nodes
|
|
363
|
+
const mul = new Float32Array(from.length);
|
|
364
|
+
const n = from.length;
|
|
365
|
+
for (let i = 0; i < n; i++) {
|
|
366
|
+
if (!i)
|
|
367
|
+
mul[i] = 0;
|
|
368
|
+
else {
|
|
369
|
+
const d = from[i] - from[i - 1];
|
|
370
|
+
mul[i] = d ? (to[i] - to[i - 1]) / d : 1.0;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
return (x, expand) => {
|
|
374
|
+
for (let i = 0; i < n; i++) {
|
|
375
|
+
if (x < from[i]) {
|
|
376
|
+
if (!i)
|
|
377
|
+
return expand ? to[0] : Number.NaN;
|
|
378
|
+
return (x - from[i]) * mul[i] + to[i];
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return expand ? to[n ? n - 1 : 0] : Number.NaN;
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
function createScaleInterpolator(primaries, secondaries) {
|
|
385
|
+
const primary2secondary = createInterpolator(primaries, secondaries);
|
|
386
|
+
const secondary2primary = createInterpolator(secondaries, primaries);
|
|
387
|
+
const forward = (v) => {
|
|
388
|
+
// SecondaryAxis => PrimaryAxis
|
|
389
|
+
return secondary2primary(v, false);
|
|
390
|
+
};
|
|
391
|
+
const reverse = (v) => {
|
|
392
|
+
// PrimaryAxis => SecondaryAxis
|
|
393
|
+
return primary2secondary(v, false);
|
|
394
|
+
};
|
|
395
|
+
return {
|
|
396
|
+
forward,
|
|
397
|
+
reverse,
|
|
398
|
+
forwardInterpolatedDomain: (domain) => domain.map((v) => secondary2primary(v, true)),
|
|
399
|
+
reverseInterpolatedDomain: (domain) => domain.map((v) => primary2secondary(v, true)),
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
function computeInterpolationArrays(wellLogSet, axesInfo) {
|
|
403
|
+
var _a;
|
|
404
|
+
const axisIndices = getAxisIndices((_a = wellLogSet === null || wellLogSet === void 0 ? void 0 : wellLogSet.curves) !== null && _a !== void 0 ? _a : [], axesInfo);
|
|
405
|
+
const idxPrimary = axisIndices.primary;
|
|
406
|
+
const idxSecondary = axisIndices.secondary;
|
|
407
|
+
// Interpolation is only relevant if there's multiple axes
|
|
408
|
+
if (idxPrimary < 0 || idxSecondary < 0) {
|
|
409
|
+
return {
|
|
410
|
+
primaries: new Float32Array(0),
|
|
411
|
+
secondaries: new Float32Array(0),
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
let entryCount = 0;
|
|
415
|
+
let primaries = new Float32Array(wellLogSet.data.length);
|
|
416
|
+
let secondaries = new Float32Array(wellLogSet.data.length);
|
|
417
|
+
for (const row of wellLogSet.data) {
|
|
418
|
+
const primary = row[idxPrimary];
|
|
419
|
+
const secondary = row[idxSecondary];
|
|
420
|
+
if (primary !== null && secondary !== null) {
|
|
421
|
+
secondaries[entryCount] = secondary;
|
|
422
|
+
primaries[entryCount] = primary;
|
|
423
|
+
entryCount++;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
if (entryCount < primaries.length) {
|
|
427
|
+
// resize arrays to actual size used
|
|
428
|
+
primaries = primaries.subarray(0, entryCount);
|
|
429
|
+
secondaries = secondaries.subarray(0, entryCount);
|
|
430
|
+
}
|
|
431
|
+
return { primaries, secondaries };
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Sets up a scale interpolator for a well log viewer that has multiple axes, and adds it to the view-controller
|
|
435
|
+
* @param logViewer A videx log view controller
|
|
436
|
+
* @param axesInfo Information about the axis curves in the log
|
|
437
|
+
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
438
|
+
* @returns The scale interpolator that was created
|
|
439
|
+
*/
|
|
440
|
+
export function setUpScaleInterpolator(logViewer, wellLogSet, axesInfo) {
|
|
441
|
+
const { primaries, secondaries } = computeInterpolationArrays(wellLogSet, axesInfo);
|
|
442
|
+
const scaleInterpolator = createScaleInterpolator(primaries, secondaries);
|
|
443
|
+
logViewer.scaleHandler = new InterpolatedScaleHandler(scaleInterpolator);
|
|
444
|
+
return scaleInterpolator;
|
|
445
|
+
}
|
|
203
446
|
//# sourceMappingURL=log-viewer.js.map
|