Wrong orientation of Parkings
This commit is contained in:
parent
62823feedd
commit
fe1db57414
@ -12,7 +12,7 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
var start = this._latlng;
|
var start = this._latlng;
|
||||||
var options = { units: 'kilometers' };
|
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
|
// Resize, since leaflet is wrong
|
||||||
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
|
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
|
||||||
console.debug('Dist ', start, [start.lng, start.lat], end.geometry.coordinates, this.options.attributes.radius, rad2);
|
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()) {
|
if (this.editEnabled()) {
|
||||||
var start = this._latlng;
|
var start = this._latlng;
|
||||||
var options = { units: 'kilometers' };
|
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
|
// Resize, since leaflet is wrong
|
||||||
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
|
var rad2 = start.distanceTo(this.turfToLatLng(end), options);
|
||||||
this.setRadius(rad2);
|
this.setRadius(rad2);
|
||||||
@ -78,7 +78,7 @@ L.ParkingSpot = L.Circle.extend({
|
|||||||
var start = this._latlng;
|
var start = this._latlng;
|
||||||
var end = this.editor._resizeLatLng.__vertex.getLatLng();
|
var end = this.editor._resizeLatLng.__vertex.getLatLng();
|
||||||
var heading = turf.bearing([start.lng, start.lat], [end.lng, end.lat]);
|
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 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);
|
const output = counts.reduce((prev, curr) => Math.abs(curr - this._mRadius) < Math.abs(prev - this._mRadius) ? curr : prev);
|
||||||
|
@ -107,7 +107,7 @@ var mapParkings = function (o) {
|
|||||||
var lat = convertLat(o.getLatLng());
|
var lat = convertLat(o.getLatLng());
|
||||||
var lon = convertLon(o.getLatLng());
|
var lon = convertLon(o.getLatLng());
|
||||||
// <Parking index="0" type="gate" name="GA_Parking" lat="S9 25.739923" lon="E160 2.927602" heading="67" radius="44" airlineCodes="" />
|
// <Parking index="0" type="gate" name="GA_Parking" lat="S9 25.739923" lon="E160 2.927602" heading="67" radius="44" airlineCodes="" />
|
||||||
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) };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user