Initial take on supporting straight line segments

This commit is contained in:
Norbert Renner 2021-04-16 19:07:52 +02:00
parent 5c70e30c13
commit acf9c59888
4 changed files with 9 additions and 7 deletions

View file

@ -267,7 +267,7 @@
exportRoute = new BR.Export(router, pois, profile); exportRoute = new BR.Export(router, pois, profile);
routing.on('routing:routeWaypointEnd routing:setWaypointsEnd', function (evt) { routing.on('routing:routeWaypointEnd routing:setWaypointsEnd routing:rerouteSegmentEnd', function (evt) {
search.clear(); search.clear();
onUpdate(evt && evt.err); onUpdate(evt && evt.err);
}); });

View file

@ -185,7 +185,9 @@ BR.Routing = L.Routing.extend({
}, },
_addSegmentCasing: function (e) { _addSegmentCasing: function (e) {
var casing = L.polyline(e.layer.getLatLngs(), this.options.styles.trackCasing); // extend layer style to inherit beeline dashArray
const casingStyle = Object.assign({}, e.layer.options, this.options.styles.trackCasing);
const casing = L.polyline(e.layer.getLatLngs(), casingStyle);
this._segmentsCasing.addLayer(casing); this._segmentsCasing.addLayer(casing);
e.layer._casing = casing; e.layer._casing = casing;
this._segments.bringToFront(); this._segments.bringToFront();
@ -308,7 +310,7 @@ BR.Routing = L.Routing.extend({
this._eachSegment(function (m1, m2, line) { this._eachSegment(function (m1, m2, line) {
// omit if null (still calculating) or error // omit if null (still calculating) or error
// NOTE: feature check specific to BRouter GeoJSON response, workaround to detect error line // NOTE: feature check specific to BRouter GeoJSON response, workaround to detect error line
if (line && line.feature) { if (line && (line.feature || m1._routing.beeline)) {
latLngs = latLngs.concat(line.getLatLngs()); latLngs = latLngs.concat(line.getLatLngs());
} }
}); });

View file

@ -68,7 +68,7 @@
"leaflet-hotline": "^0.4.0", "leaflet-hotline": "^0.4.0",
"leaflet-plugins": "~3.0.0", "leaflet-plugins": "~3.0.0",
"leaflet-providers": "^1.10.2", "leaflet-providers": "^1.10.2",
"leaflet-routing": "nrenner/leaflet-routing#e94e153", "leaflet-routing": "nrenner/leaflet-routing#9fa0cd2",
"leaflet-sidebar-v2": "nrenner/leaflet-sidebar-v2#dev", "leaflet-sidebar-v2": "nrenner/leaflet-sidebar-v2#dev",
"leaflet-triangle-marker": "^1.0.2", "leaflet-triangle-marker": "^1.0.2",
"leaflet.heightgraph": "nrenner/Leaflet.Heightgraph#0757b2a", "leaflet.heightgraph": "nrenner/Leaflet.Heightgraph#0757b2a",

View file

@ -7806,9 +7806,9 @@ leaflet-providers@^1.10.2:
resolved "https://registry.yarnpkg.com/leaflet-providers/-/leaflet-providers-1.10.2.tgz#763c8e6655f26caf1afe3a1ef4add6c3e32de663" resolved "https://registry.yarnpkg.com/leaflet-providers/-/leaflet-providers-1.10.2.tgz#763c8e6655f26caf1afe3a1ef4add6c3e32de663"
integrity sha512-1l867LObxwuFBeyPeBewip8PAXKOnvEoujq4/9y2TKTiZNHH76ksBD6dfktGjgUrOF+IdjsGHkpASPE+v2DQLw== integrity sha512-1l867LObxwuFBeyPeBewip8PAXKOnvEoujq4/9y2TKTiZNHH76ksBD6dfktGjgUrOF+IdjsGHkpASPE+v2DQLw==
leaflet-routing@nrenner/leaflet-routing#e94e153: leaflet-routing@nrenner/leaflet-routing#9fa0cd2:
version "0.1.3" version "0.1.4-alpha"
resolved "https://codeload.github.com/nrenner/leaflet-routing/tar.gz/e94e153b7574510313cb0bfefcd8776edebf627e" resolved "https://codeload.github.com/nrenner/leaflet-routing/tar.gz/9fa0cd22984a206518c6e20b7a53255531763e88"
leaflet-sidebar-v2@nrenner/leaflet-sidebar-v2#dev: leaflet-sidebar-v2@nrenner/leaflet-sidebar-v2#dev:
version "3.0.2" version "3.0.2"