From 6514a53e108e9fbfdfd315419c83be7f525546d6 Mon Sep 17 00:00:00 2001 From: Hans Kallekleiv <16436291+HansKallekleiv@users.noreply.github.com> Date: Wed, 6 Sep 2023 11:50:04 +0200 Subject: [PATCH] wip --- .../Intersection/IntersectionController.ts | 4 ++-- .../src/modules/Intersection/settings.tsx | 5 +++++ .../TopographicMap/_utils/subsurfaceMap.ts | 21 ++++++++++++++----- frontend/src/modules/TopographicMap/view.tsx | 9 +++++++- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/frontend/src/modules/Intersection/IntersectionController.ts b/frontend/src/modules/Intersection/IntersectionController.ts index dac9c9946..5e0345828 100644 --- a/frontend/src/modules/Intersection/IntersectionController.ts +++ b/frontend/src/modules/Intersection/IntersectionController.ts @@ -36,7 +36,7 @@ export class ControllerHandler { this.controller.addLayer(new GridLayer("grid")); this.controller.setBounds([0, 1000], [0, 3000]); - this.controller.setViewport(1000, 1750, 5000); + this.controller.setViewport(1000, 1650, 6000); this.controller.zoomPanHandler.zFactor = zScale; } @@ -153,7 +153,7 @@ export class ControllerHandler { // Need to calculate y... const hMid: number = curtain ? (curtain[0][0] + curtain[curtain.length - 1][0]) / 2 - extension : 1000; - this.controller.setViewport(hMid, 1750, 5000); + // this.controller.setViewport(hMid, 1750, 5000); this.controller.adjustToSize(width, height); this.controller.zoomPanHandler.zFactor = zScale; diff --git a/frontend/src/modules/Intersection/settings.tsx b/frontend/src/modules/Intersection/settings.tsx index 034e1b5e9..df6e822e2 100644 --- a/frontend/src/modules/Intersection/settings.tsx +++ b/frontend/src/modules/Intersection/settings.tsx @@ -117,6 +117,9 @@ export function settings({ moduleContext, workbenchSession, workbenchServices }: const computedSurfaceAttribute = fixupStringValueFromList(selectedSurfaceAttribute, availableSurfaceAttributes); const computedSurfaceNames: string[] = fixupCompareTwoLists(selectedSurfaceNames, surfaceDirProvider.getNames()); console.log(computedSurfaceNames); + if (computedSurfaceNames?.length == 0 && selectedSurfaceNames && selectedSurfaceNames?.length > 0) { + setSelectedSurfaceNames(computedSurfaceNames); + } if (computedSurfaceNames && computedSurfaceNames.length > 0) { if (!selectedSurfaceNames || !selectedSurfaceNames.every((name) => computedSurfaceNames.includes(name))) { console.log(selectedSurfaceNames); @@ -286,6 +289,8 @@ export function settings({ moduleContext, workbenchSession, workbenchServices }: return legalValues[0]; } function fixupCompareTwoLists(currValues: string[] | null, legalValues: string[] | null): string[] { + console.log(legalValues, "legal"); + console.log(currValues, "curr"); if (!legalValues || legalValues.length == 0) { return []; } diff --git a/frontend/src/modules/TopographicMap/_utils/subsurfaceMap.ts b/frontend/src/modules/TopographicMap/_utils/subsurfaceMap.ts index a201ea2c3..fbd61a98a 100644 --- a/frontend/src/modules/TopographicMap/_utils/subsurfaceMap.ts +++ b/frontend/src/modules/TopographicMap/_utils/subsurfaceMap.ts @@ -1,5 +1,6 @@ import { PolygonData_api, WellBoreTrajectory_api } from "@api"; import { colorTablesObj } from "@emerson-eps/color-tables"; +import { Wellbore } from "@framework/Wellbore"; import { ColorScale } from "@lib/utils/ColorScale"; import { formatRgb } from "culori"; @@ -132,26 +133,34 @@ function surfacePolygonsToGeojson(surfacePolygon: PolygonData_api): Record { +export function createWellboreTrajectoryLayer( + wellTrajectories: WellBoreTrajectory_api[], + selectedWellBore: Wellbore | null +): Record { const features: Record[] = wellTrajectories.map((wellTrajectory) => { - return wellTrajectoryToGeojson(wellTrajectory); + return wellTrajectoryToGeojson(wellTrajectory, selectedWellBore); }); const data: Record = { type: "FeatureCollection", unit: "m", features: features, }; + console.log(data); return { "@@type": "WellsLayer", id: "wells-layer", data: data, refine: false, - lineStyle: { width: 2 }, + outline: false, + lineStyle: { width: 4 }, wellHeadStyle: { size: 1 }, pickable: true, }; } -function wellTrajectoryToGeojson(wellTrajectory: WellBoreTrajectory_api): Record { +function wellTrajectoryToGeojson( + wellTrajectory: WellBoreTrajectory_api, + selectedWellBore: Wellbore | null +): Record { const point: Record = { type: "Point", coordinates: [wellTrajectory.easting_arr[0], wellTrajectory.northing_arr[0], -wellTrajectory.tvd_msl_arr[0]], @@ -160,6 +169,8 @@ function wellTrajectoryToGeojson(wellTrajectory: WellBoreTrajectory_api): Record type: "LineString", coordinates: zipCoords(wellTrajectory.easting_arr, wellTrajectory.northing_arr, wellTrajectory.tvd_msl_arr), }; + const selectedUuid = selectedWellBore?.uuid; + console.log(selectedUuid, wellTrajectory.wellbore_uuid === selectedUuid); const geometryCollection: Record = { type: "Feature", geometry: { @@ -171,7 +182,7 @@ function wellTrajectoryToGeojson(wellTrajectory: WellBoreTrajectory_api): Record name: wellTrajectory.unique_wellbore_identifier, uwi: wellTrajectory.unique_wellbore_identifier, - color: [0, 0, 0, 100], + color: wellTrajectory.wellbore_uuid === selectedUuid ? [255, 0, 0, 255] : [0, 0, 0, 255], md: [wellTrajectory.md_arr], }, }; diff --git a/frontend/src/modules/TopographicMap/view.tsx b/frontend/src/modules/TopographicMap/view.tsx index 76404d1b0..700db1336 100644 --- a/frontend/src/modules/TopographicMap/view.tsx +++ b/frontend/src/modules/TopographicMap/view.tsx @@ -103,6 +103,7 @@ export function view({ moduleContext, workbenchServices, workbenchSettings }: Mo const colorTables = colorScaleToSubsurfaceMapColorScale(surfaceColorScale); // Mesh data query should only trigger update if the property surface address is not set or if the property surface data is loaded + if (meshSurfDataQuery.data && !propertySurfAddr) { const newMeshData = jsonParseWithUndefined(meshSurfDataQuery.data.mesh_data); @@ -158,11 +159,16 @@ export function view({ moduleContext, workbenchServices, workbenchSettings }: Mo const polygonsLayer: Record = createSurfacePolygonsLayer(polygonsData); newLayers.push(polygonsLayer); } + const clickedWellbore = syncHelper.useValue(SyncSettingKey.WELLBORE, "global.syncValue.wellBore"); if (wellTrajectoriesQuery.data) { const wellTrajectories: WellBoreTrajectory_api[] = wellTrajectoriesQuery.data.filter((well) => selectedWellUuids.includes(well.wellbore_uuid) ); - const wellTrajectoryLayer: Record = createWellboreTrajectoryLayer(wellTrajectories); + + const wellTrajectoryLayer: Record = createWellboreTrajectoryLayer( + wellTrajectories, + clickedWellbore + ); const wellBoreHeaderLayer: Record = createWellBoreHeaderLayer(wellTrajectories); newLayers.push(wellTrajectoryLayer); newLayers.push(wellBoreHeaderLayer); @@ -188,6 +194,7 @@ export function view({ moduleContext, workbenchServices, workbenchSettings }: Mo }); } }); + if (clickedUWIs.length > 0) { // Publish the first selected well bore syncHelper.publishValue(SyncSettingKey.WELLBORE, "global.syncValue.wellBore", clickedUWIs[0]);