The following tutorial will illustrate the behavior of various ScaleScroll Strategies. Strategy restricts well log components transformation, i.e. scaling and translation. Use the dropdown to choose the strategy.
RestrictVisibleModelLimitsStrategy: The input transformation adjustment is restricted based on the options supplied.RestrictVisibleDepthLimitsStrategy: same asRestrictVisibleModelLimitsStrategybut for depth only.RestrictDepthScaleStrategy: track container always keep specified depth scale.RestrictVisibleRangeStrategy: track container always keep specified depth range.Fit Vertical,Fit HorizontalandFit Both: Horizontal/Vertical or both part of scaling/scrolling can be blocked based on scaling modes. By default both sides is fitted.
Strategy
import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { createCurve } from "/src/code/WellLog/utils/curveData.ts";
import { RestrictVisibleDepthLimitsStrategy } from "@int/geotoolkit/welllog/widgets/RestrictVisibleDepthLimitsStrategy.ts";
import { LogAbstractVisual } from "@int/geotoolkit/welllog/LogAbstractVisual.ts";
import { LogTrack } from "@int/geotoolkit/welllog/LogTrack.ts";
import { GeometryUtil } from "@int/geotoolkit/util/GeometryUtil.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
function addTrack(widget) {
widget.addTrack({
type: TrackType.LinearTrack,
width: GeometryUtil.getVectorLengthInModel(200, 0, widget.getTrackContainer().getSceneTransform())
}).addChild([
createCurve(4500, 10, "GR", "#7cb342"),
createCurve(4500, 10, "CALI", "#ef6c00"),
createCurve(4500, 10, "SP", "#00006c")
]);
}
function deleteSelection(widget) {
const selection = widget.getToolByName("pick").getSelection();
let logVisualDeleted = false;
for (let i = selection.length - 1; i >= 0; i--) {
const node = selection[i];
if (node instanceof LogAbstractVisual && node.getParent() != null) {
node.getParent().removeChild(node);
logVisualDeleted = true;
}
if (logVisualDeleted === false && node instanceof LogTrack) {
widget.removeTrack(node);
return;
}
}
}
function createScene(htmlElement) {
new RestrictVisibleDepthLimitsStrategy();
const widget = createWellLogWidget({
"horizontalscrollable": true,
"verticalscrollable": true
}).setAxisHeaderType(HeaderType.Simple);
widget.addTrack(TrackType.IndexTrack);
addTrack(widget);
widget.setHeaderHeight("auto");
const plot = new Plot({
"divelement": htmlElement,
"root": widget,
"autosize": true
});
return {
plot,
widget
};
}
function zoomIn(widget) {
widget.scale(5 / 4);
}
function zoomOut(widget) {
widget.scale(4 / 5);
}
function fitToHeight(widget) {
widget.fitToHeight();
}
export { addTrack, createScene, deleteSelection, fitToHeight, zoomIn, zoomOut };
createScene(document.querySelector('[ref="plot"]'));