@webviz/well-log-viewer 0.0.1-alpha.1 → 0.0.1-alpha.3
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.js +3 -4
- package/dist/SyncLogViewer.js.map +1 -1
- package/dist/components/WellLogView.js +5 -5
- package/dist/components/WellLogView.js.map +1 -1
- package/dist/demo/example-data/welllog_template_2.json +167 -167
- package/dist/demo/example-data/wellpick_colors.json +1 -1
- package/dist/demo/example-data/wellpicks.json +179 -179
- package/package.json +32 -5
- package/dist/Intro.stories.mdx +0 -59
- package/dist/package.json +0 -21
- package/src/Intro.stories.mdx +0 -59
- package/src/MapAndWellLogViewer.stories.jsx +0 -147
- package/src/MapAndWellLogViewer.test.tsx +0 -26
- package/src/MapAndWellLogViewer.tsx +0 -473
- package/src/SyncLogViewer.stories.jsx +0 -361
- package/src/SyncLogViewer.test.tsx +0 -41
- package/src/SyncLogViewer.tsx +0 -1188
- package/src/WellLogViewer.png +0 -0
- package/src/WellLogViewer.stories.jsx +0 -169
- package/src/WellLogViewer.test.tsx +0 -53
- package/src/WellLogViewer.tsx +0 -439
- package/src/WellLogViewer_performance.test.tsx +0 -78
- package/src/__snapshots__/MapAndWellLogViewer.test.tsx.snap +0 -365
- package/src/__snapshots__/SyncLogViewer.test.tsx.snap +0 -510
- package/src/__snapshots__/WellLogViewer.test.tsx.snap +0 -552
- package/src/components/AxisSelector.test.tsx +0 -50
- package/src/components/AxisSelector.tsx +0 -49
- package/src/components/ColorTableTypes.ts +0 -9
- package/src/components/InfoPanel.test.tsx +0 -58
- package/src/components/InfoPanel.tsx +0 -144
- package/src/components/InfoTypes.ts +0 -17
- package/src/components/LocalMenus.tsx +0 -336
- package/src/components/PlotDialog.tsx +0 -419
- package/src/components/Scroller.stories.jsx +0 -80
- package/src/components/Scroller.test.tsx +0 -22
- package/src/components/Scroller.tsx +0 -173
- package/src/components/TrackDialog.tsx +0 -217
- package/src/components/WellLogSpacer.tsx +0 -483
- package/src/components/WellLogTemplateTypes.ts +0 -65
- package/src/components/WellLogTypes.ts +0 -53
- package/src/components/WellLogView.stories.jsx +0 -84
- package/src/components/WellLogView.test.tsx +0 -52
- package/src/components/WellLogView.tsx +0 -2063
- package/src/components/WellLogViewWithScroller.stories.jsx +0 -69
- package/src/components/WellLogViewWithScroller.test.tsx +0 -47
- package/src/components/WellLogViewWithScroller.tsx +0 -179
- package/src/components/ZoomSlider.stories.jsx +0 -52
- package/src/components/ZoomSlider.test.tsx +0 -28
- package/src/components/ZoomSlider.tsx +0 -86
- package/src/components/__snapshots__/AxisSelector.test.tsx.snap +0 -28
- package/src/components/__snapshots__/InfoPanel.test.tsx.snap +0 -103
- package/src/components/__snapshots__/Scroller.test.tsx.snap +0 -13
- package/src/components/__snapshots__/WellLogView.test.tsx.snap +0 -54
- package/src/components/__snapshots__/WellLogViewWithScroller.test.tsx.snap +0 -270
- package/src/components/__snapshots__/ZoomSlider.test.tsx.snap +0 -50
- package/src/components/styles.scss +0 -106
- package/src/custom.d.ts +0 -13
- package/src/demo/example-data/volve_logs.json +0 -689617
- package/src/demo/example-data/welllog_template_2.json +0 -196
- package/src/demo/example-data/wellpick_colors.json +0 -156
- package/src/demo/example-data/wellpicks.json +0 -186
- package/src/index.ts +0 -8
- package/src/utils/axes.ts +0 -26
- package/src/utils/color-table.ts +0 -153
- package/src/utils/deepcopy.ts +0 -3
- package/src/utils/edit-track.tsx +0 -40
- package/src/utils/fill-info.ts +0 -224
- package/src/utils/gradientfill-plot-legend.ts +0 -177
- package/src/utils/gradientfill-plot.ts +0 -203
- package/src/utils/graph/factory.ts +0 -15
- package/src/utils/legend/common.ts +0 -153
- package/src/utils/log-viewer.ts +0 -209
- package/src/utils/minmax.ts +0 -126
- package/src/utils/pattern.tsx +0 -50
- package/src/utils/stack/stack-legend.ts +0 -100
- package/src/utils/tracks.ts +0 -1559
- package/tsconfig.json +0 -8
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { render } from "@testing-library/react";
|
|
2
|
-
import "jest-styled-components";
|
|
3
|
-
import "@testing-library/jest-dom";
|
|
4
|
-
import React from "react";
|
|
5
|
-
import InfoPanel from "./InfoPanel";
|
|
6
|
-
|
|
7
|
-
describe("Test Info panel", () => {
|
|
8
|
-
it("snapshot test", () => {
|
|
9
|
-
const { container } = render(
|
|
10
|
-
<InfoPanel
|
|
11
|
-
header="Readout"
|
|
12
|
-
infos={[
|
|
13
|
-
{
|
|
14
|
-
color: "black",
|
|
15
|
-
value: 2366,
|
|
16
|
-
type: "line",
|
|
17
|
-
trackId: "",
|
|
18
|
-
name: "DVER",
|
|
19
|
-
units: "M",
|
|
20
|
-
},
|
|
21
|
-
{
|
|
22
|
-
color: "",
|
|
23
|
-
value: Number.NaN,
|
|
24
|
-
type: "separator",
|
|
25
|
-
trackId: "",
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
color: "orange",
|
|
29
|
-
value: 8.5,
|
|
30
|
-
type: "line",
|
|
31
|
-
trackId: "",
|
|
32
|
-
name: "BDIA",
|
|
33
|
-
units: "INCH",
|
|
34
|
-
},
|
|
35
|
-
]}
|
|
36
|
-
/>
|
|
37
|
-
);
|
|
38
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
39
|
-
});
|
|
40
|
-
it("snapshot test when value is infinity", () => {
|
|
41
|
-
const { container } = render(
|
|
42
|
-
<InfoPanel
|
|
43
|
-
header="Readout"
|
|
44
|
-
infos={[
|
|
45
|
-
{
|
|
46
|
-
color: "black",
|
|
47
|
-
value: Infinity,
|
|
48
|
-
type: "line",
|
|
49
|
-
trackId: "",
|
|
50
|
-
name: "DVER",
|
|
51
|
-
units: "M",
|
|
52
|
-
},
|
|
53
|
-
]}
|
|
54
|
-
/>
|
|
55
|
-
);
|
|
56
|
-
expect(container.firstChild).toMatchSnapshot();
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import React, { Component, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import { Info } from "./InfoTypes";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
header: string;
|
|
7
|
-
infos: Info[];
|
|
8
|
-
onGroupClick?: (trackId: string | number) => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function createSeparator() {
|
|
12
|
-
return (
|
|
13
|
-
<tr key={"separator"}>
|
|
14
|
-
{/* Set key prop just for react pleasure. See https://reactjs.org/link/warning-keys for more information */}
|
|
15
|
-
<td colSpan={4}>
|
|
16
|
-
{" "}
|
|
17
|
-
<hr />
|
|
18
|
-
</td>
|
|
19
|
-
</tr>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const styleGroupRow = {
|
|
24
|
-
backgroundColor: "#ededed",
|
|
25
|
-
cursor: "pointer",
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
function formatValue(value: number): string {
|
|
29
|
-
if (!Number.isFinite(value)) return "";
|
|
30
|
-
if (Number.isInteger(value)) return value.toFixed(0);
|
|
31
|
-
let v = value.toPrecision(4);
|
|
32
|
-
if (v.indexOf(".") >= 0) {
|
|
33
|
-
// cut trailing zeroes
|
|
34
|
-
for (;;) {
|
|
35
|
-
let l = v.length;
|
|
36
|
-
if (!l--) break;
|
|
37
|
-
if (v[l] !== "0") break;
|
|
38
|
-
v = v.substring(0, l);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
return v;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
class InfoPanel extends Component<Props> {
|
|
45
|
-
constructor(props: Props) {
|
|
46
|
-
super(props);
|
|
47
|
-
this.createRow = this.createRow.bind(this);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
onRowClick(
|
|
51
|
-
trackId: string | number /*,
|
|
52
|
-
ev: React.MouseEvent<HTMLTableRowElement>*/
|
|
53
|
-
): void {
|
|
54
|
-
if (!this.props.onGroupClick) return;
|
|
55
|
-
this.props.onGroupClick(trackId);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
createRow(info: Info): ReactNode {
|
|
59
|
-
if (info.type === "separator")
|
|
60
|
-
// special case
|
|
61
|
-
return createSeparator();
|
|
62
|
-
|
|
63
|
-
if (info.groupStart !== undefined) {
|
|
64
|
-
return (
|
|
65
|
-
<tr
|
|
66
|
-
style={styleGroupRow}
|
|
67
|
-
key={"_group_" + info.trackId + "." + info.name}
|
|
68
|
-
onClick={this.onRowClick.bind(this, info.trackId)}
|
|
69
|
-
>
|
|
70
|
-
<td style={{ color: info.color, fontSize: "small" }}>
|
|
71
|
-
{
|
|
72
|
-
info.collapsed
|
|
73
|
-
? "\u25BA"
|
|
74
|
-
: "\u25BC" /*right/down-pointing triangle*/
|
|
75
|
-
}
|
|
76
|
-
</td>
|
|
77
|
-
<td
|
|
78
|
-
colSpan={3}
|
|
79
|
-
style={{ fontSize: "small", fontWeight: "bold" }}
|
|
80
|
-
>
|
|
81
|
-
{info.name}
|
|
82
|
-
</td>
|
|
83
|
-
</tr>
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
let name = info.name ? info.name : "?";
|
|
88
|
-
if (name.length > 15)
|
|
89
|
-
// compress too long names
|
|
90
|
-
name = name.substring(0, 13) + "…";
|
|
91
|
-
// print long names and values with a smaller font size
|
|
92
|
-
const nameStyle: React.CSSProperties =
|
|
93
|
-
name.length > 10 ? { fontSize: "x-small" } : {};
|
|
94
|
-
let value = formatValue(info.value);
|
|
95
|
-
if (info.discrete)
|
|
96
|
-
value = info.discrete + (value ? "\xA0(" + value + ")" : "");
|
|
97
|
-
const valueStyle: React.CSSProperties = {
|
|
98
|
-
width: "90px",
|
|
99
|
-
paddingLeft: "1.5em",
|
|
100
|
-
textAlign: "right",
|
|
101
|
-
};
|
|
102
|
-
if (value.length > 10) valueStyle.fontSize = "x-small";
|
|
103
|
-
return (
|
|
104
|
-
<tr
|
|
105
|
-
key={
|
|
106
|
-
info.trackId +
|
|
107
|
-
"." +
|
|
108
|
-
info.name /*Set unique key prop just for react pleasure*/
|
|
109
|
-
}
|
|
110
|
-
>
|
|
111
|
-
{/*info.type*/}
|
|
112
|
-
<td style={{ color: info.color, fontSize: "small" }}>
|
|
113
|
-
{"\u2B24" /*big circle*/}
|
|
114
|
-
</td>
|
|
115
|
-
<td style={nameStyle}>{name}</td>
|
|
116
|
-
<td style={valueStyle}>{value}</td>
|
|
117
|
-
<td style={{ paddingLeft: "0.5em" }}>{info.units}</td>
|
|
118
|
-
</tr>
|
|
119
|
-
);
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
render(): JSX.Element {
|
|
123
|
-
return (
|
|
124
|
-
<div style={{ overflowY: "auto", overflowX: "hidden" }}>
|
|
125
|
-
<fieldset>
|
|
126
|
-
<legend>{this.props.header}</legend>
|
|
127
|
-
|
|
128
|
-
<table
|
|
129
|
-
style={{
|
|
130
|
-
borderSpacing: "0px",
|
|
131
|
-
width: "100%",
|
|
132
|
-
}}
|
|
133
|
-
>
|
|
134
|
-
<tbody>
|
|
135
|
-
{this.props.infos?.map(this.createRow.bind(this))}
|
|
136
|
-
</tbody>
|
|
137
|
-
</table>
|
|
138
|
-
</fieldset>
|
|
139
|
-
</div>
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
export default InfoPanel;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface Info {
|
|
2
|
-
name?: string;
|
|
3
|
-
units?: string;
|
|
4
|
-
color: string;
|
|
5
|
-
value: number;
|
|
6
|
-
discrete?: string /*string for discrete*/;
|
|
7
|
-
type: string; // "seperator"; "line", "linestep", "area", "dot", ...
|
|
8
|
-
trackId: number | string;
|
|
9
|
-
|
|
10
|
-
groupStart?: string; // for category
|
|
11
|
-
collapsed?: boolean; // group is collapsed
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface InfoOptions {
|
|
15
|
-
allTracks?: boolean; // show not only visible tracks
|
|
16
|
-
grouping?: string; // how group values. "" | "by_track"
|
|
17
|
-
}
|
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import React, { Component, ReactNode } from "react";
|
|
2
|
-
|
|
3
|
-
import ReactDOM from "react-dom";
|
|
4
|
-
|
|
5
|
-
import { Track, GraphTrack } from "@equinor/videx-wellog";
|
|
6
|
-
|
|
7
|
-
import { Plot } from "@equinor/videx-wellog";
|
|
8
|
-
import { DifferentialPlotLegendInfo } from "@equinor/videx-wellog/dist/plots/legend/interfaces";
|
|
9
|
-
|
|
10
|
-
import WellLogView from "./WellLogView";
|
|
11
|
-
|
|
12
|
-
import { ExtPlotOptions } from "../utils/tracks";
|
|
13
|
-
import { isScaleTrack } from "../utils/tracks";
|
|
14
|
-
|
|
15
|
-
import Menu from "@mui/material/Menu";
|
|
16
|
-
import MenuItem from "@mui/material/MenuItem";
|
|
17
|
-
|
|
18
|
-
export interface SimpleMenuProps {
|
|
19
|
-
anchorEl: HTMLElement;
|
|
20
|
-
wellLogView: WellLogView;
|
|
21
|
-
track: Track;
|
|
22
|
-
type: string;
|
|
23
|
-
plotName?: string;
|
|
24
|
-
}
|
|
25
|
-
export interface SimpleMenuState {
|
|
26
|
-
anchorEl: HTMLElement | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function getPlotTitle(plot: Plot): string {
|
|
30
|
-
let title = "";
|
|
31
|
-
const extOptions = plot.options as ExtPlotOptions;
|
|
32
|
-
const legend = extOptions.legendInfo();
|
|
33
|
-
if (legend) {
|
|
34
|
-
if (legend.label) title = legend.label;
|
|
35
|
-
const legend2 = legend as DifferentialPlotLegendInfo;
|
|
36
|
-
// DifferentialPlot - 2 names!
|
|
37
|
-
if (legend2.serie1 && legend2.serie1.label)
|
|
38
|
-
title = legend2.serie1.label;
|
|
39
|
-
if (legend2.serie2 && legend2.serie2.label)
|
|
40
|
-
title += " \u2013 " /*ndash*/ + legend2.serie2.label;
|
|
41
|
-
}
|
|
42
|
-
return title;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export class SimpleMenu extends Component<SimpleMenuProps, SimpleMenuState> {
|
|
46
|
-
addTrack: () => void;
|
|
47
|
-
editTrack: () => void;
|
|
48
|
-
removeTrack: () => void;
|
|
49
|
-
|
|
50
|
-
addPlot: () => void;
|
|
51
|
-
editPlots: () => void;
|
|
52
|
-
removePlots: () => void;
|
|
53
|
-
|
|
54
|
-
constructor(props: SimpleMenuProps) {
|
|
55
|
-
super(props);
|
|
56
|
-
this.state = { anchorEl: this.props.anchorEl };
|
|
57
|
-
|
|
58
|
-
const wellLogView = this.props.wellLogView;
|
|
59
|
-
this.addTrack = wellLogView.addTrack.bind(
|
|
60
|
-
wellLogView,
|
|
61
|
-
this.state.anchorEl,
|
|
62
|
-
this.props.track
|
|
63
|
-
);
|
|
64
|
-
this.editTrack = wellLogView.editTrack.bind(
|
|
65
|
-
wellLogView,
|
|
66
|
-
this.state.anchorEl,
|
|
67
|
-
this.props.track
|
|
68
|
-
);
|
|
69
|
-
this.removeTrack = wellLogView.removeTrack.bind(
|
|
70
|
-
wellLogView,
|
|
71
|
-
this.props.track
|
|
72
|
-
);
|
|
73
|
-
|
|
74
|
-
this.addPlot = wellLogView.addPlot.bind(
|
|
75
|
-
wellLogView,
|
|
76
|
-
this.state.anchorEl,
|
|
77
|
-
this.props.track
|
|
78
|
-
);
|
|
79
|
-
this.editPlots = editPlots.bind(
|
|
80
|
-
null,
|
|
81
|
-
this.state.anchorEl,
|
|
82
|
-
wellLogView,
|
|
83
|
-
this.props.track
|
|
84
|
-
);
|
|
85
|
-
this.removePlots = removePlots.bind(
|
|
86
|
-
null,
|
|
87
|
-
this.state.anchorEl,
|
|
88
|
-
wellLogView,
|
|
89
|
-
this.props.track
|
|
90
|
-
);
|
|
91
|
-
}
|
|
92
|
-
componentDidUpdate(prevProps: SimpleMenuProps): void {
|
|
93
|
-
if (this.props.anchorEl !== prevProps.anchorEl) {
|
|
94
|
-
this.setState((_state, props) => {
|
|
95
|
-
return { anchorEl: props.anchorEl };
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
closeMenu(): void {
|
|
101
|
-
this.setState({ anchorEl: null });
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
handleContextMenu(ev: React.MouseEvent<HTMLElement>): void {
|
|
105
|
-
ev.preventDefault();
|
|
106
|
-
this.closeMenu();
|
|
107
|
-
}
|
|
108
|
-
handleCloseMenu(/*ev: React.MouseEvent<HTMLElement>*/): void {
|
|
109
|
-
this.closeMenu();
|
|
110
|
-
}
|
|
111
|
-
handleClickItem(action?: () => void): void {
|
|
112
|
-
if (action) action();
|
|
113
|
-
this.closeMenu();
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
createRemovePlotMenuItem(title: string, plot: Plot): ReactNode {
|
|
117
|
-
return (
|
|
118
|
-
<MenuItem
|
|
119
|
-
key={plot.id}
|
|
120
|
-
onClick={() =>
|
|
121
|
-
this.handleClickItem(
|
|
122
|
-
this.props.wellLogView.removeTrackPlot.bind(
|
|
123
|
-
this.props.wellLogView,
|
|
124
|
-
this.props.track as GraphTrack,
|
|
125
|
-
plot
|
|
126
|
-
)
|
|
127
|
-
)
|
|
128
|
-
}
|
|
129
|
-
>
|
|
130
|
-
{title}
|
|
131
|
-
</MenuItem>
|
|
132
|
-
);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
menuRemovePlotItems(): ReactNode[] {
|
|
136
|
-
const nodes: ReactNode[] = [];
|
|
137
|
-
const welllog = this.props.wellLogView.props.welllog;
|
|
138
|
-
if (welllog) {
|
|
139
|
-
const track = this.props.track;
|
|
140
|
-
const plots = (track as GraphTrack).plots;
|
|
141
|
-
const curves = welllog.curves;
|
|
142
|
-
for (const plot of plots) {
|
|
143
|
-
const iCurve = plot.id as number;
|
|
144
|
-
const title = getPlotTitle(plot) || curves[iCurve].name;
|
|
145
|
-
nodes.push(this.createRemovePlotMenuItem(title, plot));
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return nodes;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
createEditPlotMenuItem(title: string, plot: Plot): ReactNode {
|
|
152
|
-
return (
|
|
153
|
-
<MenuItem
|
|
154
|
-
key={plot.id}
|
|
155
|
-
onClick={() =>
|
|
156
|
-
this.handleClickItem(
|
|
157
|
-
this.props.wellLogView.editPlot.bind(
|
|
158
|
-
this.props.wellLogView,
|
|
159
|
-
this.state.anchorEl,
|
|
160
|
-
this.props.track,
|
|
161
|
-
plot
|
|
162
|
-
)
|
|
163
|
-
)
|
|
164
|
-
}
|
|
165
|
-
>
|
|
166
|
-
{title}
|
|
167
|
-
</MenuItem>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
menuEditPlotItems(): ReactNode[] {
|
|
172
|
-
const nodes: ReactNode[] = [];
|
|
173
|
-
const welllog = this.props.wellLogView.props.welllog;
|
|
174
|
-
if (welllog) {
|
|
175
|
-
const track = this.props.track;
|
|
176
|
-
const plots = (track as GraphTrack).plots;
|
|
177
|
-
const curves = welllog.curves;
|
|
178
|
-
for (const plot of plots) {
|
|
179
|
-
const iCurve = plot.id as number;
|
|
180
|
-
const title = getPlotTitle(plot) || curves[iCurve].name;
|
|
181
|
-
nodes.push(this.createEditPlotMenuItem(title, plot));
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
return nodes;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
createMenuItem(title: string, action?: () => void): ReactNode {
|
|
188
|
-
return (
|
|
189
|
-
<MenuItem key={title} onClick={() => this.handleClickItem(action)}>
|
|
190
|
-
{title}
|
|
191
|
-
</MenuItem>
|
|
192
|
-
);
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
render(): JSX.Element {
|
|
196
|
-
if (this.props.type == "removePlots") {
|
|
197
|
-
return (
|
|
198
|
-
<div>
|
|
199
|
-
<Menu
|
|
200
|
-
id="simple-menu"
|
|
201
|
-
anchorEl={this.state.anchorEl}
|
|
202
|
-
keepMounted
|
|
203
|
-
open={Boolean(this.state.anchorEl)}
|
|
204
|
-
onClose={this.handleCloseMenu.bind(this)}
|
|
205
|
-
onContextMenu={this.handleContextMenu.bind(this)}
|
|
206
|
-
>
|
|
207
|
-
{this.menuRemovePlotItems()}
|
|
208
|
-
</Menu>
|
|
209
|
-
</div>
|
|
210
|
-
);
|
|
211
|
-
} else if (this.props.type == "editPlots") {
|
|
212
|
-
return (
|
|
213
|
-
<div>
|
|
214
|
-
<Menu
|
|
215
|
-
id="simple-menu"
|
|
216
|
-
anchorEl={this.state.anchorEl}
|
|
217
|
-
keepMounted
|
|
218
|
-
open={Boolean(this.state.anchorEl)}
|
|
219
|
-
onClose={this.handleCloseMenu.bind(this)}
|
|
220
|
-
onContextMenu={this.handleContextMenu.bind(this)}
|
|
221
|
-
>
|
|
222
|
-
{this.menuEditPlotItems()}
|
|
223
|
-
</Menu>
|
|
224
|
-
</div>
|
|
225
|
-
);
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (this.props.type == "title") {
|
|
229
|
-
return (
|
|
230
|
-
<div>
|
|
231
|
-
<Menu
|
|
232
|
-
id="simple-menu"
|
|
233
|
-
anchorEl={this.state.anchorEl}
|
|
234
|
-
open={Boolean(this.state.anchorEl)}
|
|
235
|
-
onClose={this.handleCloseMenu.bind(this)}
|
|
236
|
-
onContextMenu={this.handleContextMenu.bind(this)}
|
|
237
|
-
>
|
|
238
|
-
{this.createMenuItem("Add track", this.addTrack)}
|
|
239
|
-
{this.createMenuItem("Edit track", this.editTrack)}
|
|
240
|
-
{this.createMenuItem("Remove track", this.removeTrack)}
|
|
241
|
-
</Menu>
|
|
242
|
-
</div>
|
|
243
|
-
);
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
// For this.props.type == "legends" or this.props.type == "container"
|
|
247
|
-
|
|
248
|
-
const track = this.props.track;
|
|
249
|
-
const plots = (track as GraphTrack).plots;
|
|
250
|
-
|
|
251
|
-
const createMenuItem = (track: GraphTrack): React.ReactNode => {
|
|
252
|
-
if ((track as GraphTrack).options.plotFactory) {
|
|
253
|
-
return [this.createMenuItem("Add plot", this.addPlot)];
|
|
254
|
-
} else if (!isScaleTrack(track)) {
|
|
255
|
-
return [this.createMenuItem("Edit track", this.editTrack)];
|
|
256
|
-
}
|
|
257
|
-
return [];
|
|
258
|
-
};
|
|
259
|
-
|
|
260
|
-
return (
|
|
261
|
-
<div>
|
|
262
|
-
<Menu
|
|
263
|
-
id="simple-menu"
|
|
264
|
-
anchorEl={this.state.anchorEl}
|
|
265
|
-
keepMounted
|
|
266
|
-
open={Boolean(this.state.anchorEl)}
|
|
267
|
-
onClose={this.handleCloseMenu.bind(this)}
|
|
268
|
-
onContextMenu={this.handleContextMenu.bind(this)}
|
|
269
|
-
>
|
|
270
|
-
{createMenuItem(track as GraphTrack)}
|
|
271
|
-
{plots && plots.length
|
|
272
|
-
? [
|
|
273
|
-
this.createMenuItem("Edit plot", this.editPlots),
|
|
274
|
-
this.createMenuItem(
|
|
275
|
-
"Remove plot",
|
|
276
|
-
this.removePlots
|
|
277
|
-
),
|
|
278
|
-
]
|
|
279
|
-
: []}
|
|
280
|
-
</Menu>
|
|
281
|
-
</div>
|
|
282
|
-
);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
export function editPlots(
|
|
287
|
-
parent: HTMLElement | null,
|
|
288
|
-
wellLogView: WellLogView,
|
|
289
|
-
track: Track
|
|
290
|
-
): void {
|
|
291
|
-
const plots = (track as GraphTrack).plots;
|
|
292
|
-
if (plots && plots.length <= 1) {
|
|
293
|
-
if (plots.length === 1) wellLogView.editPlot(parent, track, plots[0]);
|
|
294
|
-
return;
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
const el: HTMLElement = document.createElement("div");
|
|
298
|
-
el.style.width = "10px";
|
|
299
|
-
el.style.height = "13px";
|
|
300
|
-
if (parent) parent.appendChild(el);
|
|
301
|
-
ReactDOM.render(
|
|
302
|
-
<SimpleMenu
|
|
303
|
-
type="editPlots"
|
|
304
|
-
anchorEl={el}
|
|
305
|
-
wellLogView={wellLogView}
|
|
306
|
-
track={track}
|
|
307
|
-
/>,
|
|
308
|
-
el
|
|
309
|
-
);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export function removePlots(
|
|
313
|
-
parent: HTMLElement | null,
|
|
314
|
-
wellLogView: WellLogView,
|
|
315
|
-
track: Track
|
|
316
|
-
): void {
|
|
317
|
-
const plots = (track as GraphTrack).plots;
|
|
318
|
-
if (plots && plots.length <= 1) {
|
|
319
|
-
if (plots.length === 1) wellLogView.removeTrackPlot(track, plots[0]);
|
|
320
|
-
return;
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
const el: HTMLElement = document.createElement("div");
|
|
324
|
-
el.style.width = "10px";
|
|
325
|
-
el.style.height = "13px";
|
|
326
|
-
if (parent) parent.appendChild(el);
|
|
327
|
-
ReactDOM.render(
|
|
328
|
-
<SimpleMenu
|
|
329
|
-
type="removePlots"
|
|
330
|
-
anchorEl={el}
|
|
331
|
-
wellLogView={wellLogView}
|
|
332
|
-
track={track}
|
|
333
|
-
/>,
|
|
334
|
-
el
|
|
335
|
-
);
|
|
336
|
-
}
|