From 561a44b8b6fdafcac9c9b3510fa51eb9899c4a66 Mon Sep 17 00:00:00 2001 From: Justine Fricou Date: Wed, 12 Jun 2024 17:37:21 +0200 Subject: [PATCH] Remove no longer used methods --- geotrek/core/static/core/multipath.js | 138 -------------------------- 1 file changed, 138 deletions(-) diff --git a/geotrek/core/static/core/multipath.js b/geotrek/core/static/core/multipath.js index 72ab951c9b..03b3f49e04 100644 --- a/geotrek/core/static/core/multipath.js +++ b/geotrek/core/static/core/multipath.js @@ -325,30 +325,6 @@ L.Handler.MultiPath = L.Handler.extend({ this.on('invalid_route', this.onInvalidRoute, this); }, - setState: function(state, autocompute) { - autocompute = autocompute === undefined ? true : autocompute; - var self = this; - - // Ensure we got a fresh start - this.disable(); - this.reset(); - this.enable(); - console.debug('setState('+JSON.stringify({start:{pk:state.start_layer.properties.id, - latlng:state.start_ll.toString()}, - end: {pk:state.end_layer.properties.id, - latlng:state.end_ll.toString()}})+')'); - - this._onClick({latlng: state.start_ll, layer:state.start_layer}); - this._onClick({latlng: state.end_ll, layer:state.end_layer}); - - state.via_markers && $.each(state.via_markers, function(idx, via_marker) { - console.debug('Add via marker (' + JSON.stringify({pk: via_marker.layer.properties.id, - latlng: via_marker.marker.getLatLng().toString()}) + ')'); - self.addViaStep(via_marker.marker, idx + 1); - self.forceMarkerToLayer(via_marker.marker, via_marker.layer); - }); - }, - // Reset the whole state reset: function() { var self = this; @@ -654,120 +630,6 @@ L.Handler.MultiPath = L.Handler.extend({ } }, - restoreTopology: function (topo) { - // TODO: check if this is still used - - /* - * Topo is a list of sub-topologies. - * - * X--+--+---O-------+----O--+---+--X - * - * Each sub-topoogy is a way between markers. The first marker - * of the first sub-topology is the beginning, the last of the last is the end. - * All others are intermediary points (via markers) - */ - var self = this; - - - // Only first and last positions - if (topo.length == 1 && topo[0].paths.length == 1) { - // There is only one path, both positions values are relevant - // and each one represents a marker - var topo = topo[0] - , paths = topo.paths - , positions = topo.positions; - - var first_pos = positions[0][0]; - var last_pos = positions[0][1]; - - var start_layer = this.idToLayer(paths[0]); - var end_layer = this.idToLayer(paths[paths.length - 1]); - - var start_ll = L.GeometryUtil.interpolateOnLine(this.map, start_layer, first_pos).latLng; - var end_ll = L.GeometryUtil.interpolateOnLine(this.map, end_layer, last_pos).latLng; - - var state = { - start_ll: start_ll, - end_ll: end_ll, - start_layer: start_layer, - end_layer: end_layer - }; - this.setState(state); - } - else { - var start_layer_ll = {} - , end_layer_ll = {} - , via_markers = []; - - // var pos2latlng = function (pos, layer) { - // var used_pos = pos; - // if (pos instanceof Array) { - // used_pos = pos[1]; // Default is second position (think of last path of topology) - // if (pos[0] == 0.0 && pos[1] != 1.0) - // used_pos = pos[1]; - // if (pos[0] == 1.0 && pos[1] != 0.0) - // used_pos = pos[1]; - // if (pos[0] != 1.0 && pos[1] == 0.0) - // used_pos = pos[0]; - // if (pos[0] != 0.0 && pos[1] == 1.0) - // used_pos = pos[0]; - // console.log("Chose " + used_pos + " for " + pos); - // } - // var interpolated = L.GeometryUtil.interpolateOnLine(self.map, layer, used_pos); - // if (!interpolated) { - // throw ('Could not interpolate ' + used_pos + ' on layer ' + layer.properties.id); - // } - // return interpolated.latLng; - // }; - - for (var i=0; i