-
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.
feat(#10): ✨ coordinates possible to see on scene
- Loading branch information
Showing
3 changed files
with
33 additions
and
3 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
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 +1,17 @@ | ||
| /* Empty for now, add logic later */ | ||
| // EPSG:32633 (WGS84 / UTM zone 33N) → WGS84 (lon/lat) | ||
| const utm33 = "+proj=utm +zone=33 +datum=WGS84 +units=m +no_defs"; //UTM zone 33N | ||
| const wgs84 = "+proj=longlat +datum=WGS84 +no_defs"; //Current standard for GPS coordinates | ||
|
|
||
| const posCanvas = document.getElementById('camera-pos'); | ||
| const context = posCanvas.getContext('2d'); | ||
|
|
||
| function updateCameraOverlay() { | ||
| const cam = window.viewer.scene.view.position; | ||
| const [lon, lat] = proj4(utm33, wgs84, [cam.x, cam.y]); // Conversion using proj4js library | ||
|
|
||
| context.clearRect(0, 0, posCanvas.width, posCanvas.height); | ||
| context.fillStyle = 'white'; | ||
| context.font = '20px Times New Roman'; | ||
| context.fillText(`lat=${lat.toFixed(2)}˚ lon=${lon.toFixed(2)}˚`, 10, 40); | ||
| } | ||
| viewer.addEventListener("update", updateCameraOverlay); |
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 +1,10 @@ | ||
| /* Empty for now, add styles later */ | ||
|
|
||
| #camera-pos { | ||
| position: absolute; | ||
| left: 10px; | ||
| bottom: 10px; | ||
| width: 300px; | ||
| height: 60px; | ||
| pointer-events: none; | ||
| z-index: 10; | ||
| } |