From 6dce0485e3e82733fdb9c8f940cdaa723938a0c3 Mon Sep 17 00:00:00 2001 From: Siebren Weiland Date: Mon, 21 Nov 2022 14:24:34 +0100 Subject: [PATCH] changed latLong --> latLon, corrected locomotiv --> locomotive --- .../Viewer3D/WebServices/Web/Map/index.js | 24 +++++++++--------- .../Web/Map/{locomotiv.png => locomotive.png} | Bin .../Viewer3D/WebServices/WebServer.cs | 5 ++-- 3 files changed, 14 insertions(+), 15 deletions(-) rename Source/RunActivity/Viewer3D/WebServices/Web/Map/{locomotiv.png => locomotive.png} (100%) diff --git a/Source/RunActivity/Viewer3D/WebServices/Web/Map/index.js b/Source/RunActivity/Viewer3D/WebServices/Web/Map/index.js index 23b81de0aa..96ff33bae8 100644 --- a/Source/RunActivity/Viewer3D/WebServices/Web/Map/index.js +++ b/Source/RunActivity/Viewer3D/WebServices/Web/Map/index.js @@ -22,11 +22,11 @@ var xmlHttpRequestCodeDone = 4; var locomotivMarker; var map; -var latLongPrev = [0, 0]; +var latLonPrev = [0, 0]; -function MapInit(latLong) { +function MapInit(latLon) { - map = L.map('map').setView(latLong, 13); + map = L.map('map').setView(latLon, 13); L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { maxZoom: 19, attribution: 'Map data: © OpenStreetMap contributors' @@ -46,25 +46,25 @@ function ApiMap() { if (this.readyState == xmlHttpRequestCodeDone && this.status == httpCodeSuccess) { var responseText = JSON.parse(hr.responseText); if (responseText.length > 0) { - latLong = responseText.split(" "); + latLon = responseText.split(" "); if (typeof locomotivMarker !== 'undefined') { - if ((latLong[0] != latLongPrev[0]) && (latLong[1] != latLongPrev[1])) { - map.panTo(latLong); + if ((latLon[0] != latLonPrev[0]) && (latLon[1] != latLonPrev[1])) { + map.panTo(latLon); } } else { - MapInit(latLong); + MapInit(latLon); } - if ((latLong[0] != latLongPrev[0]) || (latLong[1] != latLongPrev[1])) { + if ((latLon[0] != latLonPrev[0]) || (latLon[1] != latLonPrev[1])) { if (typeof locomotivMarker !== 'undefined') { locomotivMarker.removeFrom(map); } locomotivMarker = L.marker( - latLong, + latLon, { icon: myIcon } ).addTo(map); - latLongPrev[0] = latLong[0]; - latLongPrev[1] = latLong[1]; + latLonPrev[0] = latLon[0]; + latLonPrev[1] = latLon[1]; } } } @@ -72,7 +72,7 @@ function ApiMap() { } var myIcon = L.icon({ - iconUrl: 'locomotiv.png', + iconUrl: 'locomotive.png', iconSize: [29, 24], iconAnchor: [9, 21], }) diff --git a/Source/RunActivity/Viewer3D/WebServices/Web/Map/locomotiv.png b/Source/RunActivity/Viewer3D/WebServices/Web/Map/locomotive.png similarity index 100% rename from Source/RunActivity/Viewer3D/WebServices/Web/Map/locomotiv.png rename to Source/RunActivity/Viewer3D/WebServices/Web/Map/locomotive.png diff --git a/Source/RunActivity/Viewer3D/WebServices/WebServer.cs b/Source/RunActivity/Viewer3D/WebServices/WebServer.cs index b6cecdb1be..b278ce3b55 100644 --- a/Source/RunActivity/Viewer3D/WebServices/WebServer.cs +++ b/Source/RunActivity/Viewer3D/WebServices/WebServer.cs @@ -114,7 +114,6 @@ internal class ORTSApiController : WebApiController /// The Viewer to serve train data from. /// private readonly Viewer Viewer; - private bool latLongCorrToBeRead = true; protected WorldLocation cameraLocation = new WorldLocation(); public ORTSApiController(Viewer viewer) @@ -122,7 +121,7 @@ public ORTSApiController(Viewer viewer) Viewer = viewer; } - public string getLatLong() + public string getLatLon() { double latitude = 0; double longitude = 0; @@ -275,7 +274,7 @@ IEnumerable GetValues() #region /API/MAP [Route(HttpVerbs.Get, "/MAP")] - public string LatLong() => getLatLong(); + public string LatLon() => getLatLon(); #endregion } }