Skip to content

Commit

Permalink
Automatic merge of T1.5-111-g71c1114b7 and 14 pull requests
Browse files Browse the repository at this point in the history
- Pull request #652 at 918fdb1: Add button functions to Raildriver
- Pull request #706 at 570ab21: Extended door functionality
- Pull request #713 at 6ca89da: https://blueprints.launchpad.net/or/+spec/cruise-control 
- Pull request #719 at 13a1638: Upgraded to MonoGame 3.8.0 (+ small update for other libraries)
- Pull request #722 at fb9079e: Fix Windows Forms deprecations in ActivityEditor
- Pull request #732 at 9cffa6d: Improvements for air brakes
- Pull request #733 at 72947b0: Fixed battery switch sound being repeted
- Pull request #734 at 8f8484c: Fixed battery switch timer not working properly
- Pull request #740 at b3e66ca: Refactored the circuit breaker and the traction cut-off relay in order to use the same design pattern as the C# signal scripts (compatible with current scripts)
- Pull request #741 at 2dd56ad: Fixed brake controller script not being loaded in timetable mode
- Pull request #744 at 3c2dc07: Fixed and improved cabview control conditions related to power supply state
- Pull request #746 at 0857d9b: Website release 1.5
- Pull request #748 at 4f0e878: latitude/longitude fix for bug 1393111
- Pull request #749 at 2220414: OpenRailway Map
  • Loading branch information
openrails-bot committed Nov 21, 2022
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
24 changes: 12 additions & 12 deletions Source/RunActivity/Viewer3D/WebServices/Web/Map/index.js
Expand Up @@ -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: &copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors'
Expand All @@ -46,33 +46,33 @@ 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];
}
}
}
}
}

var myIcon = L.icon({
iconUrl: 'locomotiv.png',
iconUrl: 'locomotive.png',
iconSize: [29, 24],
iconAnchor: [9, 21],
})
5 changes: 2 additions & 3 deletions Source/RunActivity/Viewer3D/WebServices/WebServer.cs
Expand Up @@ -114,15 +114,14 @@ internal class ORTSApiController : WebApiController
/// The Viewer to serve train data from.
/// </summary>
private readonly Viewer Viewer;
private bool latLongCorrToBeRead = true;
protected WorldLocation cameraLocation = new WorldLocation();

public ORTSApiController(Viewer viewer)
{
Viewer = viewer;
}

public string getLatLong()
public string getLatLon()
{
double latitude = 0;
double longitude = 0;
Expand Down Expand Up @@ -275,7 +274,7 @@ IEnumerable<string> GetValues()

#region /API/MAP
[Route(HttpVerbs.Get, "/MAP")]
public string LatLong() => getLatLong();
public string LatLon() => getLatLon();
#endregion
}
}

0 comments on commit 7a6e6c6

Please sign in to comment.