From c79d6ed7c961cf0d0c4a238ac2d91be1ae1c474c Mon Sep 17 00:00:00 2001 From: Ruben Thoms Date: Thu, 5 Dec 2024 17:26:49 +0100 Subject: [PATCH] wip --- .../customDeckGlLayers/AdvancedWellsLayer.ts | 40 +++++-------------- 1 file changed, 9 insertions(+), 31 deletions(-) diff --git a/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts b/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts index 8f22d2ef6..8a1b9e5aa 100644 --- a/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts +++ b/frontend/src/modules/2DViewer/view/customDeckGlLayers/AdvancedWellsLayer.ts @@ -9,7 +9,7 @@ import { UpdateParameters, } from "@deck.gl/core"; import { GeoJsonLayer, LineLayer, TextLayer } from "@deck.gl/layers"; -import { Entity } from "@lib/utils/ForceDirectedEntityPositioning"; +import { Entity, ForceDirectedEntityPositioning } from "@lib/utils/ForceDirectedEntityPositioning"; import { Vec2, rotatePoint2Around } from "@lib/utils/vec2"; import { FeatureCollection, GeometryCollection } from "geojson"; @@ -73,18 +73,18 @@ export class AdvancedWellsLayer extends CompositeLayer { const labelCoordsMap = new Map(); for (let z = 1; z > -5; z--) { const labelCoords = precalculateLabelPositions(this.props.data as FeatureCollection, 300 * 2 ** z); - /* + const forceDirectedEntityPositioning = new ForceDirectedEntityPositioning(labelCoords, { - springRestLength: 10, - springConstant: 0.01 / 2 ** z, + springRestLength: 20, + springConstant: 0.01, chargeConstant: 100 ** -z, tolerance: 0.1, - maxIterations: 300, + maxIterations: 50, }); const adjustedLabelCoords = forceDirectedEntityPositioning.run(); - */ - labelCoordsMap.set(z, labelCoords); + + labelCoordsMap.set(z, adjustedLabelCoords); } return labelCoordsMap; @@ -239,33 +239,11 @@ export class AdvancedWellsLayer extends CompositeLayer { ) ); - layers.push( - new GeoJsonLayer( - this.getSubLayerProps({ - id: `points-zoom-${zoom}`, - data: featureCollection, - getRadius: (d: any) => { - return 3; - }, - pointRadiusUnits: "pixels", - radiusUnits: "meters", - pointRadiusMaxPixels: 4, - pickable: true, - filled: true, - stroked: false, - autoHighlight: true, - getFillColor: (d: any) => { - return [0, 0, 0]; - }, - }) - ) - ); - layers.push( new TextLayer({ id: `names-zoom-${zoom}`, data: labelCoords, - getColor: [255, 255, 255], + getColor: [0, 0, 0], getBorderColor: [0, 173, 230], getBorderWidth: 0, getPosition: (d: WellboreLabelCoords) => d.coordinates, @@ -288,7 +266,7 @@ export class AdvancedWellsLayer extends CompositeLayer { if (hoveredWellboreUuid === d.wellboreUuid) { return [255, 100, 0, 255]; } - return [0, 0, 0, 255]; + return [255, 255, 255, 200]; }, updateTriggers: { getBackgroundColor: [hoveredWellboreUuid, activeWellboreUuid],