From ccbdced86d78f3c627f5005a36a4489874150fec Mon Sep 17 00:00:00 2001 From: Sebastian Stryczek Date: Wed, 18 Dec 2024 13:17:43 +0100 Subject: [PATCH] RD-453_telemetry (#12) * Update image links + replace plugin by module (#13) * Add position indicators models * Install maptiler sdk 3 * Update 3D layer to sdk 3 * Add example * Add comments * Add offset * Make linter happy * Refactor mount everest example * Update examples to sdk v3 * Make biome happy * Remove break line * Add telemetry module registration * Make registration works for multiple map instances * Simplify telemetry * Update sdk to v3.0.0-rc.4 * Fix model position issue on projection change animation --------- Co-authored-by: Jonathan Lurie --- demos/flight.html | 4 +- demos/mountains.html | 4 +- demos/multi.html | 4 +- demos/plane.html | 101 ++++++++++++++++++++-------------- demos/point_cad_model01.html | 4 +- demos/point_cloud_NMH.html | 4 +- demos/point_cloud_dundee.html | 4 +- demos/point_cloud_shore.html | 4 +- index.html | 2 +- package-lock.json | 34 ++++++------ package.json | 2 +- src/Layer3D.ts | 14 ++++- 12 files changed, 105 insertions(+), 76 deletions(-) diff --git a/demos/flight.html b/demos/flight.html index 6b63452..7fc62b6 100644 --- a/demos/flight.html +++ b/demos/flight.html @@ -5,8 +5,8 @@ - - + + - +
@@ -94,10 +94,10 @@ map.addLayer(layer3D); // Increasing the intensity of the ambient light - layer3D.setAmbientLight({intensity: 2}); + layer3D.setAmbientLight({ intensity: 2 }); // Adding a point light - layer3D.addPointLight("point-light", {intensity: 30}); + layer3D.addPointLight("point-light", { intensity: 30 }); const gui = new lil.GUI({ width: 400 }); @@ -105,6 +105,7 @@ // Adding a mesh of a plane. const guiObj = { + projection: "mercator", heading: 0, scale: 1, altitude: 3000, @@ -115,7 +116,7 @@ layer3D.removeMesh(originalPlaneID); }, } - + const originalPlaneID = "plane"; await layer3D.addMeshFromURL( originalPlaneID, @@ -135,48 +136,66 @@ map.on("mousemove", (e) => { if (!planeCanMove) return; - layer3D.modifyMesh(originalPlaneID, {lngLat: e.lngLat}) + layer3D.modifyMesh(originalPlaneID, { lngLat: e.lngLat }) }); map.on("click", (e) => { planeCanMove = !planeCanMove; }); - gui.add( guiObj, 'heading', 0, 360, 0.1 ) - .onChange((heading) => { - layer3D.modifyMesh(originalPlaneID, {heading}); - }); - - gui.add( guiObj, 'scale', 0.01, 5, 0.01 ) - .onChange((scale) => { - layer3D.modifyMesh(originalPlaneID, {scale}); - }); - - gui.add( guiObj, 'altitude', 0, 10000, 1 ) - .onChange((altitude) => { - layer3D.modifyMesh(originalPlaneID, {altitude}); - }); - - gui.add( guiObj, 'opacity', 0, 1) - .onChange((opacity) => { - layer3D.modifyMesh(originalPlaneID, {opacity}); - }); - - - gui.add( guiObj, 'altitudeReference', ["MEAN_SEA_LEVEL", "GROUND"]) - .onChange((altRef) => { - layer3D.modifyMesh(originalPlaneID, {altitudeReference: maptiler3d.AltitudeReference[altRef]}); - }); - - gui.add( guiObj, "wireframe" ) - .onChange((wireframe) => { - layer3D.modifyMesh(originalPlaneID, {wireframe}); - }); - - gui.add( guiObj, "removePlane" ); + gui + .add(guiObj, 'projection', ["mercator", "globe"]) + .onChange((projection) => { + switch (projection) { + case "mercator": + map.enableMercatorProjection(true); + break; + + case "globe": + map.enableGlobeProjection(true); + break; + + default: + throw new Error("Unsupported projection"); + } + }); + + gui.add(guiObj, 'heading', 0, 360, 0.1) + .onChange((heading) => { + layer3D.modifyMesh(originalPlaneID, { heading }); + }); + + gui.add(guiObj, 'scale', 0.01, 1000, 0.01) + .onChange((scale) => { + layer3D.modifyMesh(originalPlaneID, { scale }); + }); + + gui.add(guiObj, 'altitude', 0, 10000, 1) + .onChange((altitude) => { + layer3D.modifyMesh(originalPlaneID, { altitude }); + }); + + gui.add(guiObj, 'opacity', 0, 1) + .onChange((opacity) => { + layer3D.modifyMesh(originalPlaneID, { opacity }); + }); + + + gui.add(guiObj, 'altitudeReference', ["MEAN_SEA_LEVEL", "GROUND"]) + .onChange((altRef) => { + layer3D.modifyMesh(originalPlaneID, { altitudeReference: maptiler3d.AltitudeReference[altRef] }); + }); + + gui.add(guiObj, "wireframe") + .onChange((wireframe) => { + layer3D.modifyMesh(originalPlaneID, { wireframe }); + }); + + gui.add(guiObj, "removePlane"); })() - + + \ No newline at end of file diff --git a/demos/point_cad_model01.html b/demos/point_cad_model01.html index 93efdc9..417f62a 100644 --- a/demos/point_cad_model01.html +++ b/demos/point_cad_model01.html @@ -5,8 +5,8 @@ - - + +