diff --git a/frontend/src/framework/WorkbenchServices.ts b/frontend/src/framework/WorkbenchServices.ts index 6e1163954..c7c64642d 100644 --- a/frontend/src/framework/WorkbenchServices.ts +++ b/frontend/src/framework/WorkbenchServices.ts @@ -1,6 +1,6 @@ import React from "react"; -import { Viewport } from "@modules/_shared/components/EsvIntersection/esvIntersection"; +import { Viewport } from "@framework/components/EsvIntersection/esvIntersection"; import { isEqual } from "lodash"; diff --git a/frontend/src/modules/_shared/components/EsvIntersection/esvIntersection.tsx b/frontend/src/framework/components/EsvIntersection/esvIntersection.tsx similarity index 99% rename from frontend/src/modules/_shared/components/EsvIntersection/esvIntersection.tsx rename to frontend/src/framework/components/EsvIntersection/esvIntersection.tsx index 353ed884b..13218f6fb 100644 --- a/frontend/src/modules/_shared/components/EsvIntersection/esvIntersection.tsx +++ b/frontend/src/framework/components/EsvIntersection/esvIntersection.tsx @@ -431,7 +431,7 @@ export function EsvIntersection(props: EsvIntersectionProps): React.ReactNode { const cy = dy0 + displ / event.zFactor / event.viewportRatio / 2; setCurrentViewport([cx, cy, displ]); - timeout = setTimeout(() => onViewportChange([cx, cy, displ]), 100); + onViewportChange([cx, cy, displ]); } automaticChanges.current = false; oldOnRescaleFunction(event); @@ -492,9 +492,6 @@ export function EsvIntersection(props: EsvIntersectionProps): React.ReactNode { newEsvController.removeAllLayers(); newEsvController.destroy(); newInteractionHandler.destroy(); - if (timeout) { - clearTimeout(timeout); - } }; }, [onReadout, onViewportChange, props.intersectionThreshold] diff --git a/frontend/src/modules/_shared/components/EsvIntersection/index.ts b/frontend/src/framework/components/EsvIntersection/index.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/index.ts rename to frontend/src/framework/components/EsvIntersection/index.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/BoundingBox2D.ts b/frontend/src/framework/components/EsvIntersection/interaction/BoundingBox2D.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/BoundingBox2D.ts rename to frontend/src/framework/components/EsvIntersection/interaction/BoundingBox2D.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/BoundingSphere2D.ts b/frontend/src/framework/components/EsvIntersection/interaction/BoundingSphere2D.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/BoundingSphere2D.ts rename to frontend/src/framework/components/EsvIntersection/interaction/BoundingSphere2D.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/FanchartIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/FanchartIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/FanchartIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/FanchartIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/HighlightOverlay.ts b/frontend/src/framework/components/EsvIntersection/interaction/HighlightOverlay.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/HighlightOverlay.ts rename to frontend/src/framework/components/EsvIntersection/interaction/HighlightOverlay.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/InteractionHandler.ts b/frontend/src/framework/components/EsvIntersection/interaction/InteractionHandler.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/InteractionHandler.ts rename to frontend/src/framework/components/EsvIntersection/interaction/InteractionHandler.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/IntersectionHandler.ts b/frontend/src/framework/components/EsvIntersection/interaction/IntersectionHandler.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/IntersectionHandler.ts rename to frontend/src/framework/components/EsvIntersection/interaction/IntersectionHandler.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/LineIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/LineIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/LineIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/LineIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/LineSetIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/LineSetIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/LineSetIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/LineSetIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/PointIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/PointIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/PointIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/PointIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/PolygonIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/PolygonIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/PolygonIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/PolygonIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/PolygonsIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/PolygonsIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/PolygonsIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/PolygonsIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/RectangleIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/RectangleIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/RectangleIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/RectangleIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/interaction/WellborePathIntersectionCalculator.ts b/frontend/src/framework/components/EsvIntersection/interaction/WellborePathIntersectionCalculator.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/interaction/WellborePathIntersectionCalculator.ts rename to frontend/src/framework/components/EsvIntersection/interaction/WellborePathIntersectionCalculator.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/layers/PolylineIntersectionLayer.ts b/frontend/src/framework/components/EsvIntersection/layers/PolylineIntersectionLayer.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/layers/PolylineIntersectionLayer.ts rename to frontend/src/framework/components/EsvIntersection/layers/PolylineIntersectionLayer.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/layers/SeismicLayer.ts b/frontend/src/framework/components/EsvIntersection/layers/SeismicLayer.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/layers/SeismicLayer.ts rename to frontend/src/framework/components/EsvIntersection/layers/SeismicLayer.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/layers/SurfaceStatisticalFanchartCanvasLayer.ts b/frontend/src/framework/components/EsvIntersection/layers/SurfaceStatisticalFanchartCanvasLayer.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/layers/SurfaceStatisticalFanchartCanvasLayer.ts rename to frontend/src/framework/components/EsvIntersection/layers/SurfaceStatisticalFanchartCanvasLayer.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/types/index.ts b/frontend/src/framework/components/EsvIntersection/types/index.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/types/index.ts rename to frontend/src/framework/components/EsvIntersection/types/index.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/types/types.ts b/frontend/src/framework/components/EsvIntersection/types/types.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/types/types.ts rename to frontend/src/framework/components/EsvIntersection/types/types.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utilityComponents/ReadoutBox.tsx b/frontend/src/framework/components/EsvIntersection/utilityComponents/ReadoutBox.tsx similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utilityComponents/ReadoutBox.tsx rename to frontend/src/framework/components/EsvIntersection/utilityComponents/ReadoutBox.tsx diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utilityComponents/Toolbar.tsx b/frontend/src/framework/components/EsvIntersection/utilityComponents/Toolbar.tsx similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utilityComponents/Toolbar.tsx rename to frontend/src/framework/components/EsvIntersection/utilityComponents/Toolbar.tsx diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/geometry.ts b/frontend/src/framework/components/EsvIntersection/utils/geometry.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/geometry.ts rename to frontend/src/framework/components/EsvIntersection/utils/geometry.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/intersectionConversion.ts b/frontend/src/framework/components/EsvIntersection/utils/intersectionConversion.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/intersectionConversion.ts rename to frontend/src/framework/components/EsvIntersection/utils/intersectionConversion.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/intersectionResults.ts b/frontend/src/framework/components/EsvIntersection/utils/intersectionResults.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/intersectionResults.ts rename to frontend/src/framework/components/EsvIntersection/utils/intersectionResults.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/layerDataItems.ts b/frontend/src/framework/components/EsvIntersection/utils/layerDataItems.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/layerDataItems.ts rename to frontend/src/framework/components/EsvIntersection/utils/layerDataItems.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/layers.ts b/frontend/src/framework/components/EsvIntersection/utils/layers.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/layers.ts rename to frontend/src/framework/components/EsvIntersection/utils/layers.ts diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/readoutItemUtils.tsx b/frontend/src/framework/components/EsvIntersection/utils/readoutItemUtils.tsx similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/readoutItemUtils.tsx rename to frontend/src/framework/components/EsvIntersection/utils/readoutItemUtils.tsx diff --git a/frontend/src/modules/_shared/components/EsvIntersection/utils/surfaceStatisticalFancharts.ts b/frontend/src/framework/components/EsvIntersection/utils/surfaceStatisticalFancharts.ts similarity index 100% rename from frontend/src/modules/_shared/components/EsvIntersection/utils/surfaceStatisticalFancharts.ts rename to frontend/src/framework/components/EsvIntersection/utils/surfaceStatisticalFancharts.ts diff --git a/frontend/src/modules/3DViewer/registerModule.ts b/frontend/src/modules/3DViewer/registerModule.ts index 3dcc35a0f..2c9f9a3f3 100644 --- a/frontend/src/modules/3DViewer/registerModule.ts +++ b/frontend/src/modules/3DViewer/registerModule.ts @@ -15,7 +15,7 @@ ModuleRegistry.registerModule({ moduleName: MODULE_NAME, defaultTitle: "3D Viewer", category: ModuleCategory.MAIN, - devState: ModuleDevState.DEPRECATED, + devState: ModuleDevState.DEV, dataTagIds: [ModuleDataTagId.GRID3D, ModuleDataTagId.DRILLED_WELLS], description, preview, diff --git a/frontend/src/modules/Intersection/settings/components/layerSettings/seismicLayer.tsx b/frontend/src/modules/Intersection/settings/components/layerSettings/seismicLayer.tsx index efc4d419e..a500ebaac 100644 --- a/frontend/src/modules/Intersection/settings/components/layerSettings/seismicLayer.tsx +++ b/frontend/src/modules/Intersection/settings/components/layerSettings/seismicLayer.tsx @@ -8,6 +8,7 @@ import { WorkbenchSettings } from "@framework/WorkbenchSettings"; import { EnsembleDropdown } from "@framework/components/EnsembleDropdown"; import { isIsoStringInterval } from "@framework/utils/timestampUtils"; import { Dropdown, DropdownOption } from "@lib/components/Dropdown"; +import { Input } from "@lib/components/Input"; import { PendingWrapper } from "@lib/components/PendingWrapper"; import { RadioGroup } from "@lib/components/RadioGroup"; import { SelectOption } from "@lib/components/Select"; @@ -165,6 +166,10 @@ export const SeismicLayerSettingsComponent: React.FC props.layer.maybeUpdateSettings({ dateOrInterval: selected }); } + function handleResolutionChange(e: React.ChangeEvent) { + props.layer.maybeUpdateSettings({ resolution: parseFloat(e.target.value) }); + } + function handleColorScaleChange(newColorScale: ColorScale, areBoundariesUserDefined: boolean) { props.layer.setColorScale(newColorScale); props.layer.setUseCustomColorScaleBoundaries(areBoundariesUserDefined); @@ -269,6 +274,19 @@ export const SeismicLayerSettingsComponent: React.FC +
+
Sample resolution
+
+ +
+
Color scale
diff --git a/frontend/src/modules/Intersection/settings/components/layerSettings/surfaceLayer.tsx b/frontend/src/modules/Intersection/settings/components/layerSettings/surfaceLayer.tsx index 431ea758d..5e194c9f9 100644 --- a/frontend/src/modules/Intersection/settings/components/layerSettings/surfaceLayer.tsx +++ b/frontend/src/modules/Intersection/settings/components/layerSettings/surfaceLayer.tsx @@ -190,7 +190,7 @@ export const SurfaceLayerSettingsComponent: React.FC
-
Resolution
+
Sample resolution
); } - if (status === LayerStatus.IDLE) { - return ( -
- -
- ); - } if (status === LayerStatus.ERROR) { return (
diff --git a/frontend/src/modules/Intersection/utils/layers/GridLayer.ts b/frontend/src/modules/Intersection/utils/layers/GridLayer.ts index 3d18ecdc7..b9e1dfa92 100644 --- a/frontend/src/modules/Intersection/utils/layers/GridLayer.ts +++ b/frontend/src/modules/Intersection/utils/layers/GridLayer.ts @@ -77,7 +77,7 @@ export class GridLayer extends BaseLayer { @@ -78,12 +86,13 @@ export class SeismicLayer extends BaseLayer { this._data = data; this.notifySubscribers(LayerTopic.DATA); @@ -159,38 +195,15 @@ export class SeismicLayer extends BaseLayer Math.min(acc, val[0]!), 0) - - this._settings.extensionLength; - const xMax = - this._data.options.trajectory.reduce((acc: number, val: number[]) => Math.max(acc, val[0]!), 0) - - this._settings.extensionLength; - - const minTvdMsl = this._data.options.yAxisValues && this._data.options.yAxisValues[0]!; - const maxTvdMsl = - this._data.options.yAxisValues && - this._data.options.yAxisValues[this._data.options.yAxisValues.length - 1]!; - - return { - x: [xMin, xMax], - y: [minTvdMsl, maxTvdMsl], - z: [this._data.seismicFenceData.min_fence_depth, this._data.seismicFenceData.max_fence_depth], - }; - } - protected areSettingsValid(): boolean { return ( this._settings.ensembleIdent !== null && this._settings.realizationNum !== null && - this._settings.intersectionReferenceSystem !== null && + this._settings.polylineUtmXy !== null && this._settings.attribute !== null && this._settings.dateOrInterval !== null && - this._settings.extensionLength > 0 + this._settings.extensionLength > 0 && + this._settings.resolution > 0 ); } @@ -201,7 +214,7 @@ export class SeismicLayer extends BaseLayer { + private async generateImageAndMakeInfo(data: SeismicFenceData_trans): Promise { const datapoints = createSeismicSliceImageDatapointsArrayFromFenceData(data); const yAxisValues = createSeismicSliceImageYAxisValuesArrayFromFenceData(data); - if (this._settings.intersectionReferenceSystem === null) { - throw new Error("No intersection reference system set"); + if (this._settings.polylineUtmXy.length === 0) { + throw new Error("No polyline data available for seismic fence."); } - const trajectory = this._settings.intersectionReferenceSystem.getExtendedTrajectory( - data.num_traces, - this._settings.extensionLength, - this._settings.extensionLength - ); - const trajectoryXyProjection = IntersectionReferenceSystem.toDisplacement(trajectory.points, trajectory.offset); + // Calculate uz projection of the trajectory + const sampledPolyline = this.samplePolyline(); + const trajectoryFenceProjection: number[][] = []; + + let u = -this._settings.extensionLength; + for (const [index, point] of sampledPolyline.entries()) { + if (index > 0) { + const prevPoint = sampledPolyline[index - 1]; + u += pointDistance( + { + x: point[0], + y: point[1], + }, + { + x: prevPoint[0], + y: prevPoint[1], + } + ); + } + + // We don't care about depth/z when generatic the seismic image + trajectoryFenceProjection.push([u, 0]); + } const options: SeismicSliceImageOptions = { datapoints, yAxisValues, - trajectory: trajectoryXyProjection, + trajectory: trajectoryFenceProjection, colorScale: this.getColorScale(), }; const colormap = options.colorScale.sampleColors(options.colorScale.getNumSteps() || 10); @@ -245,26 +275,55 @@ export class SeismicLayer extends BaseLayer 0) { + const distance = pointDistance( + { x: polyline[i], y: polyline[i + 1] }, + { x: polyline[i - 2], y: polyline[i - 1] } + ); + const numPoints = Math.floor(distance / this._settings.resolution) - 1; + + for (let p = 1; p <= numPoints; p++) { + const vector: Vector2D = { + x: polyline[i] - polyline[i - 2], + y: polyline[i + 1] - polyline[i - 1], + }; + const normalizedVector = vectorNormalize(vector); + trajectory.push([ + polyline[i - 2] + normalizedVector.x * this._settings.resolution * p, + polyline[i - 1] + normalizedVector.y * this._settings.resolution * p, + ]); + } + } + + trajectory.push([polyline[i], polyline[i + 1]]); + } + + return trajectory; + } + protected async fetchData(): Promise { - const polyline = - this._settings.intersectionReferenceSystem?.getExtendedTrajectory( - 1000, - this._settings.extensionLength, - this._settings.extensionLength - ).points ?? []; + const sampledPolyline = this.samplePolyline(); const xPoints: number[] = []; const yPoints: number[] = []; - for (let i = 0; i < polyline.length; i++) { - xPoints.push(polyline[i][0]); - yPoints.push(polyline[i][1]); + for (const point of sampledPolyline) { + xPoints.push(point[0]); + yPoints.push(point[1]); } return this._queryClient @@ -276,10 +335,11 @@ export class SeismicLayer extends BaseLayer apiService.seismic.postGetSeismicFence( @@ -296,7 +356,7 @@ export class SeismicLayer extends BaseLayer transformSeismicFenceData(data)) .then(async (data) => { - return this.generateImage(data); + return this.generateImageAndMakeInfo(data); }); } } diff --git a/frontend/src/modules/Intersection/utils/layers/SurfaceLayer.ts b/frontend/src/modules/Intersection/utils/layers/SurfaceLayer.ts index e76338d46..be5416064 100644 --- a/frontend/src/modules/Intersection/utils/layers/SurfaceLayer.ts +++ b/frontend/src/modules/Intersection/utils/layers/SurfaceLayer.ts @@ -8,7 +8,7 @@ import { QueryClient } from "@tanstack/query-core"; import { isEqual } from "lodash"; -import { BaseLayer, LayerTopic } from "./BaseLayer"; +import { BaseLayer, BoundingBox, LayerTopic } from "./BaseLayer"; const STALE_TIME = 60 * 1000; const CACHE_TIME = 60 * 1000; @@ -16,10 +16,7 @@ const CACHE_TIME = 60 * 1000; export type SurfaceLayerSettings = { ensembleIdent: EnsembleIdent | null; realizationNum: number | null; - polyline: { - polylineUtmXy: number[]; - actualSectionLengths: number[]; - }; + polylineUtmXy: number[]; surfaceNames: string[]; attribute: string | null; extensionLength: number; @@ -33,10 +30,7 @@ export class SurfaceLayer extends BaseLayer 0 && this._settings.realizationNum !== null && - this._settings.polyline.polylineUtmXy.length > 0 && - this._settings.polyline.actualSectionLengths.length > 0 && + this._settings.polylineUtmXy.length > 0 && this._settings.resolution > 0 ); } @@ -78,7 +107,7 @@ export class SurfaceLayer extends BaseLayer { const promises: Promise[] = []; - const polyline = this._settings.polyline.polylineUtmXy; + const polyline = this._settings.polylineUtmXy; const xPoints: number[] = []; const yPoints: number[] = []; @@ -145,7 +174,7 @@ export class SurfaceLayer extends BaseLayer(null); - const [viewport, setViewport] = React.useState(null); + const [viewport, setViewport] = React.useState([0, 0, 2000]); const [prevLayersViewport, setPrevViewport] = React.useState(null); if (props.referenceSystem && !isEqual(prevReferenceSystem, props.referenceSystem)) { @@ -157,24 +157,17 @@ export function LayersWrapper(props: LayersWrapperProps): React.ReactNode { y: [Number.MAX_VALUE, Number.MIN_VALUE], }; let boundsSet: boolean = false; - let layersViewport: Viewport = viewport ?? [0, 0, 2000]; for (const [index, layer] of layers.toReversed().entries()) { + if (!layer.getIsVisible() || layer.getStatus() !== LayerStatus.SUCCESS) { + continue; + } + const boundingBox = layer.getBoundingBox(); if (boundingBox) { bounds.x = [Math.min(bounds.x[0], boundingBox.x[0]), Math.max(bounds.x[1], boundingBox.x[1])]; bounds.y = [Math.min(bounds.y[0], boundingBox.y[0]), Math.max(bounds.y[1], boundingBox.y[1])]; boundsSet = true; - - layersViewport = [ - bounds.x[0] + (bounds.x[1] - bounds.x[0]) / 2, - bounds.y[0] + (bounds.y[1] - bounds.y[0]) / 2, - Math.max(bounds.x[1] - bounds.x[0], bounds.y[1] - bounds.y[0]) * 1.2, - ]; - } - - if (!layer.getIsVisible() || layer.getStatus() !== LayerStatus.SUCCESS) { - continue; } esvLayerIdToNameMap[layer.getId()] = layer.getName(); @@ -241,7 +234,7 @@ export function LayersWrapper(props: LayersWrapperProps): React.ReactNode { continue; } - const seismicInfo = getSeismicInfo(data.options, data.options.trajectory); + const seismicInfo = data.seismicInfo; const colorScale = seismicLayer.getColorScale(); @@ -249,9 +242,6 @@ export function LayersWrapper(props: LayersWrapperProps): React.ReactNode { continue; } - seismicInfo.minX = seismicInfo.minX - props.intersectionExtensionLength; - seismicInfo.maxX = seismicInfo.maxX - props.intersectionExtensionLength; - if (!seismicLayer.getUseCustomColorScaleBoundaries()) { colorScale.setRangeAndMidPoint(seismicInfo.domain.min, seismicInfo.domain.max, 0); } @@ -349,11 +339,6 @@ export function LayersWrapper(props: LayersWrapperProps): React.ReactNode { } } - if (!isEqual(layersViewport, prevLayersViewport)) { - setViewport(layersViewport); - setPrevViewport(layersViewport); - } - if (!boundsSet && props.referenceSystem) { const firstPoint = props.referenceSystem.projectedPath[0]; const lastPoint = props.referenceSystem.projectedPath[props.referenceSystem.projectedPath.length - 1]; @@ -371,6 +356,17 @@ export function LayersWrapper(props: LayersWrapperProps): React.ReactNode { bounds.y = [0, 1000]; } + const newLayersViewport: [number, number, number] = [ + bounds.x[0] + (bounds.x[1] - bounds.x[0]) / 2, + bounds.y[0] + (bounds.y[1] - bounds.y[0]) / 2, + Math.max(bounds.x[1] - bounds.x[0], bounds.y[1] - bounds.y[0]) * 1.2, + ]; + + if (!isEqual(newLayersViewport, prevLayersViewport)) { + setViewport(newLayersViewport); + setPrevViewport(newLayersViewport); + } + return (