mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-17 00:32:21 +00:00
Draw the local GeoJSON layers through the draw port and take them off the Cesium list
The data centre and dam layers (src/data/localGeojsonCore.js) no longer load a Cesium GeoJSON data source. Each build is six draw sets: ground fills, raised fills, draped lines, pins, stems and their tip dots. A walk changes what moved or showed in place. Ground heights come from the heights query, with the globe visibility getter deciding whether terrain is a floor. The stems are sized from the camera pose, and clicks select and fly through the input and camera ports. Point-and-ask reads a draw hit's meta as the feature's context record (drawItemMeta in src/data/pickedContext.js). The drawn parts keep the loader's ids and its reading of each feature: simplestyle fill, stroke and marker colours, opacities, widths and marker sizes; polygons with heights drawn at them and outlined; 3D points standing their pin on the stem tip; ground edges along rhumb lines. Differences: a marker-symbol draws the plain pin; named CSS colours fall back to the layer colour; a raised polygon's outline is 1 px around its outer ring only, and its fill is unlit; the layer no longer sets the viewer's selectedEntity, so Cesium's stock double-click no longer follows a feature; a caller's own Cesium viewer needs gods-eye-view/render/cesium/unbound loaded first.
This commit is contained in:
1 parent
333c9b39fe
commit
b0ed9d7e90
14 files changed
+1547
-947
No files matched your search
@@ -1,8 +1,8 @@
|
||||
// Focused tests for the local-infrastructure analyst-record mapper and snapshot seam.
|
||||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import * as Cesium from 'cesium';
|
||||
import { localGeoJsonServices } from '../app/localGeojsonServices.js';
|
||||
import { bindFakeGroundRenderer } from '../testSupport/fakeGroundRenderer.mjs';
|
||||
import {
|
||||
createLocalGeoJsonLayer as createLayer,
|
||||
mapAnalystRecord,
|
||||
@@ -109,17 +109,6 @@ test('infra analyst record: output is JSON-safe (no Cesium types leak)', () => {
|
||||
assert.equal('position' in r, false);
|
||||
});
|
||||
|
||||
class MockLayerEvent {
|
||||
constructor() {
|
||||
this.listeners = new Set();
|
||||
}
|
||||
|
||||
addEventListener(listener) {
|
||||
this.listeners.add(listener);
|
||||
return () => this.listeners.delete(listener);
|
||||
}
|
||||
}
|
||||
|
||||
test('infra getAnalystRecords: enabled layer snapshots loaded stems; disable returns []', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
const originalWindow = globalThis.window;
|
||||
@@ -149,36 +138,10 @@ test('infra getAnalystRecords: enabled layer snapshots loaded stems; disable ret
|
||||
},
|
||||
}),
|
||||
});
|
||||
const viewer = {
|
||||
selectedEntity: undefined,
|
||||
dataSources: {
|
||||
add(dataSource) {
|
||||
return dataSource;
|
||||
},
|
||||
remove() {
|
||||
return true;
|
||||
},
|
||||
},
|
||||
camera: {
|
||||
positionWC: Cesium.Cartesian3.fromDegrees(-97.695, 30.205, 100_000),
|
||||
frustum: { fov: Math.PI / 3 },
|
||||
moveEnd: new MockLayerEvent(),
|
||||
flyTo() {},
|
||||
},
|
||||
scene: {
|
||||
canvas: { clientWidth: 800, clientHeight: 600 },
|
||||
preRender: new MockLayerEvent(),
|
||||
sampleHeightSupported: false,
|
||||
sampleHeight() {
|
||||
return undefined;
|
||||
},
|
||||
screenSpaceCameraController: { enableInputs: true },
|
||||
pick() {
|
||||
return null;
|
||||
},
|
||||
requestRender() {},
|
||||
},
|
||||
};
|
||||
const viewer = {};
|
||||
const fake = bindFakeGroundRenderer(viewer, {
|
||||
eye: { lon: -97.695, lat: 30.205, height: 100_000 },
|
||||
});
|
||||
const layer = createLocalGeoJsonLayer({
|
||||
id: 'local-dams',
|
||||
url: '/runtime-dam.geojsonl',
|
||||
@@ -227,6 +190,7 @@ test('infra getAnalystRecords: enabled layer snapshots loaded stems; disable ret
|
||||
'destroy releases analyst records',
|
||||
);
|
||||
globalThis.fetch = originalFetch;
|
||||
fake.unbind();
|
||||
if (originalWindow === undefined) delete globalThis.window;
|
||||
else globalThis.window = originalWindow;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user