-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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 <[email protected]>
- Loading branch information
1 parent
47c133e
commit ccbdced
Showing
12 changed files
with
105 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,8 +10,8 @@ | |
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://mrdoob.github.io/stats.js/build/stats.min.js"></script> | ||
|
||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet"/> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet"/> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
|
||
<script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>MapTiler 3D Models</title> | ||
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
@@ -45,12 +46,11 @@ | |
z-index: 2; | ||
backdrop-filter: blur(10px); | ||
} | ||
|
||
</style> | ||
</head> | ||
|
||
<body> | ||
|
||
|
||
<div id="map"></div> | ||
<div id="info"> | ||
|
@@ -94,17 +94,18 @@ | |
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 }); | ||
|
||
// 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"); | ||
|
||
})() | ||
|
||
</script> | ||
</body> | ||
</html> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,8 @@ | |
<meta charset="utf-8" /> | ||
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no" /> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]"></script> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.2/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.umd.min.js"></script> | ||
<link href="https://cdn.maptiler.com/maptiler-sdk-js/v3.0.0-rc.4/maptiler-sdk.css" rel="stylesheet" /> | ||
<script src="../build/maptiler-3d.umd.js"></script> | ||
<style> | ||
body { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters