LogSinusoid visual is used to render parts of sinusoids on the track
The sinusoid is dictated by the equation: C/2 * cos(B - x) + A
Where:
- A is the centered depth of the apparent dip
- B is the azimuth of apparent dip
- C is the height of apparent dip
Also, the sample could be limited by angle range and only part of the sinusoid will be rendered.
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { LogSinusoid } from "@int/geotoolkit/welllog/LogSinusoid.ts";
import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { PointerMode } from "@int/geotoolkit/controls/tools/PointerMode.ts";
import { DepthLimitsTypes } from "@int/geotoolkit/welllog/widgets/WellLogWidget.ts";
import DATA from "/src/code/WellLog/Visuals/LogSinusoid/data.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
function createManipulator(visual) {
const hlVisual = new LogSinusoid({
"angleunit": "degree",
"linestyle": "3px red"
});
visual.getTrack().addOverlay(
hlVisual
);
visual.on(PointerMode.MouseDown, (type, node, args) => {
args.stopPropagation();
const data = node.hitTest(args.getMousePosition());
if (!data) {
return;
}
const hldata = [];
data.forEach((selected) => {
DATA.forEach((origData) => {
if (selected.getDepth() === origData.getDepth()) {
hldata.push(origData);
}
});
});
hlVisual.setData(hldata).setVisible(true);
});
return hlVisual;
}
function createScene(canvas) {
const widget = createWellLogWidget();
widget.addTrack(TrackType.IndexTrack);
const logSinusoid = new LogSinusoid({
"name": "Image orientation",
"linestyle": "2px blue",
"data": DATA,
"angleunit": "degree"
});
widget.addTrack(TrackType.LinearTrack).setWidth(400).addChild(logSinusoid);
const hlVisual = createManipulator(logSinusoid);
widget.on(PointerMode.MouseDown, () => {
if (hlVisual) {
hlVisual.setVisible(false);
}
});
const plot = new Plot({
"canvaselement": canvas,
"root": widget
});
widget.setHeaderHeight("auto").setDepthLimitsOptions({
"type": DepthLimitsTypes.Data,
"neatlimits": true,
"offset": {
"top": 5,
"bottom": 5
}
}).fitToHeight();
return plot;
}
export { createScene };
createScene(document.querySelector('[ref="plot"]'));