Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
HansKallekleiv committed Sep 6, 2023
1 parent 7d7c703 commit 6514a53
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
4 changes: 2 additions & 2 deletions frontend/src/modules/Intersection/IntersectionController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Check warning on line 154 in frontend/src/modules/Intersection/IntersectionController.ts

View workflow job for this annotation

GitHub Actions / frontend

'hMid' is assigned a value but never used

this.controller.setViewport(hMid, 1750, 5000);
// this.controller.setViewport(hMid, 1750, 5000);

this.controller.adjustToSize(width, height);
this.controller.zoomPanHandler.zFactor = zScale;
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/modules/Intersection/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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 [];
}
Expand Down
21 changes: 16 additions & 5 deletions frontend/src/modules/TopographicMap/_utils/subsurfaceMap.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -132,26 +133,34 @@ function surfacePolygonsToGeojson(surfacePolygon: PolygonData_api): Record<strin
};
return data;
}
export function createWellboreTrajectoryLayer(wellTrajectories: WellBoreTrajectory_api[]): Record<string, unknown> {
export function createWellboreTrajectoryLayer(
wellTrajectories: WellBoreTrajectory_api[],
selectedWellBore: Wellbore | null
): Record<string, unknown> {
const features: Record<string, unknown>[] = wellTrajectories.map((wellTrajectory) => {
return wellTrajectoryToGeojson(wellTrajectory);
return wellTrajectoryToGeojson(wellTrajectory, selectedWellBore);
});
const data: Record<string, unknown> = {
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<string, unknown> {
function wellTrajectoryToGeojson(
wellTrajectory: WellBoreTrajectory_api,
selectedWellBore: Wellbore | null
): Record<string, unknown> {
const point: Record<string, unknown> = {
type: "Point",
coordinates: [wellTrajectory.easting_arr[0], wellTrajectory.northing_arr[0], -wellTrajectory.tvd_msl_arr[0]],
Expand All @@ -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<string, unknown> = {
type: "Feature",
geometry: {
Expand All @@ -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],
},
};
Expand Down
9 changes: 8 additions & 1 deletion frontend/src/modules/TopographicMap/view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -158,11 +159,16 @@ export function view({ moduleContext, workbenchServices, workbenchSettings }: Mo
const polygonsLayer: Record<string, unknown> = 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<string, unknown> = createWellboreTrajectoryLayer(wellTrajectories);

const wellTrajectoryLayer: Record<string, unknown> = createWellboreTrajectoryLayer(
wellTrajectories,
clickedWellbore
);
const wellBoreHeaderLayer: Record<string, unknown> = createWellBoreHeaderLayer(wellTrajectories);
newLayers.push(wellTrajectoryLayer);
newLayers.push(wellBoreHeaderLayer);
Expand All @@ -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]);
Expand Down

0 comments on commit 6514a53

Please sign in to comment.