From fe1db574149ee73e4fb3f665b4f9ea31d90871fe Mon Sep 17 00:00:00 2001 From: portree_kid Date: Tue, 10 Mar 2020 08:38:29 +0100 Subject: [PATCH] Wrong orientation of Parkings --- src/renderer/loaders/ParkingSpot.js | 6 +++--- src/renderer/loaders/groundnet_writer.js | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/renderer/loaders/ParkingSpot.js b/src/renderer/loaders/ParkingSpot.js index db5083e..f59196d 100644 --- a/src/renderer/loaders/ParkingSpot.js +++ b/src/renderer/loaders/ParkingSpot.js @@ -12,7 +12,7 @@ L.ParkingSpot = L.Circle.extend({ var start = this._latlng; var options = { units: 'kilometers' }; - var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading - 180, options); + var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading, options); // Resize, since leaflet is wrong var rad2 = start.distanceTo(this.turfToLatLng(end), options); console.debug('Dist ', start, [start.lng, start.lat], end.geometry.coordinates, this.options.attributes.radius, rad2); @@ -63,7 +63,7 @@ L.ParkingSpot = L.Circle.extend({ if (this.editEnabled()) { var start = this._latlng; var options = { units: 'kilometers' }; - var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading - 180, options); + var end = turf.destination([start.lng, start.lat], this.options.attributes.radius / 1000, this.options.attributes.heading, options); // Resize, since leaflet is wrong var rad2 = start.distanceTo(this.turfToLatLng(end), options); this.setRadius(rad2); @@ -78,7 +78,7 @@ L.ParkingSpot = L.Circle.extend({ var start = this._latlng; var end = this.editor._resizeLatLng.__vertex.getLatLng(); var heading = turf.bearing([start.lng, start.lat], [end.lng, end.lat]); - this.options.attributes.heading = heading + 180; + this.options.attributes.heading = heading; const counts = [7.5, 12, 18, 26, 32.5, 40]; const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev); diff --git a/src/renderer/loaders/groundnet_writer.js b/src/renderer/loaders/groundnet_writer.js index d9f3cc2..2a8835c 100644 --- a/src/renderer/loaders/groundnet_writer.js +++ b/src/renderer/loaders/groundnet_writer.js @@ -107,7 +107,7 @@ var mapParkings = function (o) { var lat = convertLat(o.getLatLng()); var lon = convertLon(o.getLatLng()); // - return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading), '@radius': String(o.options.attributes.radius) }; + return { '@index': String(o['id']), '@type': o.options.attributes.type, '@name': o.options.attributes.name, '@lat': lat, '@lon': lon, '@heading': Number(o.options.attributes.heading+180), '@radius': String(o.options.attributes.radius) }; } }