From cafb87cc6eba6181f74aef57895b0c374b7e03db Mon Sep 17 00:00:00 2001 From: Norbert Renner Date: Wed, 9 Jun 2021 17:04:11 +0200 Subject: [PATCH] Add basic beeline support by dummy feature --- js/plugin/Routing.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/js/plugin/Routing.js b/js/plugin/Routing.js index 8a4aee1..78782f5 100644 --- a/js/plugin/Routing.js +++ b/js/plugin/Routing.js @@ -448,4 +448,25 @@ BR.Routing = L.Routing.extend({ this._map.addLayer(this._distanceMarkers); } }, + + createBeeline: function (latLng1, latLng2) { + const layer = L.Routing.prototype.createBeeline.call(this, latLng1, latLng2); + const props = { + cost: 0, + 'filtered ascend': 0, + 'plain-ascend': 0, + 'total-energy': 0, + 'total-time': 0, + 'track-length': 0, + messages: [], + }; + layer.feature = turf.lineString( + [ + [latLng1.lng, latLng1.lat], + [latLng2.lng, latLng2.lat], + ], + props + ); + return layer; + }, });