diff --git a/WebContent/base/OSRM.HistoryRoutes.js b/WebContent/base/OSRM.HistoryRoutes.js index f2a00610c..a0c82db15 100644 --- a/WebContent/base/OSRM.HistoryRoutes.js +++ b/WebContent/base/OSRM.HistoryRoutes.js @@ -21,15 +21,15 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.HistoryRoute = function() { // style and count of history routes - this._history_styles = [{dashed:false, color:'#FFFFFF', opacity:0.5, weight:5}, - {dashed:false, color:'#0000DD', opacity:0.45, weight:5}, - {dashed:false, color:'#0000BB', opacity:0.40, weight:5}, - {dashed:false, color:'#000099', opacity:0.35, weight:5}, - {dashed:false, color:'#000077', opacity:0.30, weight:5}, - {dashed:false, color:'#000055', opacity:0.25, weight:5}, - {dashed:false, color:'#000033', opacity:0.20, weight:5}, - {dashed:false, color:'#000011', opacity:0.15, weight:5}, - {dashed:false, color:'#000000', opacity:0.10, weight:5} + this._history_styles = [{color:'#FFFFFF', opacity:0.5, weight:5}, + {color:'#0000DD', opacity:0.45, weight:5}, + {color:'#0000BB', opacity:0.40, weight:5}, + {color:'#000099', opacity:0.35, weight:5}, + {color:'#000077', opacity:0.30, weight:5}, + {color:'#000055', opacity:0.25, weight:5}, + {color:'#000033', opacity:0.20, weight:5}, + {color:'#000011', opacity:0.15, weight:5}, + {color:'#000000', opacity:0.10, weight:5} ]; this._history_length = this._history_styles.length; @@ -37,7 +37,7 @@ OSRM.HistoryRoute = function() { this._history = []; for(var i=0, size=this._history_length; i routes are not hidden during zoom - fadeAnimation: false + zoomAnimation: true, // remove animations -> routes are not hidden during zoom + fadeAnimation: true }); // add layer control @@ -80,10 +80,10 @@ initPosition: function() { // map event handlers zoomed: function(e) { - if(OSRM.G.dragging) + /*if(OSRM.G.dragging) OSRM.Routing.getRoute_Dragging(); else - OSRM.Routing.getRoute_Redraw({keepAlternative:true}); + OSRM.Routing.getRoute_Redraw({keepAlternative:true});*/ }, contextmenu: function(e) {;}, mousemove: function(e) { },//OSRM.Via.drawDragMarker(e); }, diff --git a/WebContent/base/OSRM.Routes.js b/WebContent/base/OSRM.Routes.js index 527d0e304..3ac00cee8 100644 --- a/WebContent/base/OSRM.Routes.js +++ b/WebContent/base/OSRM.Routes.js @@ -20,18 +20,18 @@ or see http://www.gnu.org/licenses/agpl.txt. OSRM.Route = function() { - this._current_route = new OSRM.SimpleRoute("current" , {dashed:false} ); - this._alternative_route = new OSRM.SimpleRoute("alternative" , {dashed:false} ); - this._old_route = new OSRM.SimpleRoute("old", {dashed:false,color:"#123"} ); + this._current_route = new OSRM.SimpleRoute("current" , {} ); + this._alternative_route = new OSRM.SimpleRoute("alternative" , {} ); + this._old_route = new OSRM.SimpleRoute("old", {color:"#123"} ); this._unnamed_route = new OSRM.MultiRoute("unnamed"); - this._current_route_style = {dashed:false,color:'#0033FF', weight:5}; - this._current_noroute_style = {dashed:true, color:'#222222', weight:2}; - this._old_route_style = {dashed:false,color:'#112233', weight:5}; - this._old_noroute_style = {dashed:true, color:'#000000', weight:2}; - this._unnamed_route_style = {dashed:false, color:'#FF00FF', weight:10}; - this._old_unnamed_route_style = {dashed:false, color:'#990099', weight:10}; - this._alternative_route_style = {dashed:false,color:'#770033', weight:5, opacity:0.6}; + this._current_route_style = {color:'#0033FF', weight:5}; + this._current_noroute_style = {color:'#222222', weight:2, dashArray:"8,6"}; + this._old_route_style = {color:'#112233', weight:5}; + this._old_noroute_style = {color:'#000000', weight:2, dashArray:"8,6"}; + this._unnamed_route_style = {color:'#FF00FF', weight:10}; + this._old_unnamed_route_style = {color:'#990099', weight:10}; + this._alternative_route_style = {color:'#770033', weight:5, opacity:0.6}; this._noroute = OSRM.Route.ROUTE; this._history = new OSRM.HistoryRoute(); diff --git a/WebContent/base/leaflet/L.DashedPolyline.js b/WebContent/base/leaflet/L.DashedPolyline.js deleted file mode 100644 index 875d89ce6..000000000 --- a/WebContent/base/leaflet/L.DashedPolyline.js +++ /dev/null @@ -1,60 +0,0 @@ -/* -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU AFFERO General Public License as published by -the Free Software Foundation; either version 3 of the License, or -any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU Affero General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -or see http://www.gnu.org/licenses/agpl.txt. -*/ - -// Leaflet extension: Dashed Polyline -// [adds dashed optionally dashed lines when using SVG or VML rendering] - - -// dashed polyline class -L.DashedPolyline = L.Polyline.extend({ - initialize: function(latlngs, options) { - L.Polyline.prototype.initialize.call(this, latlngs, options); - }, - - options: { - dashed: true - } -}); - - -// svg rendering -L.DashedPolyline = !L.Browser.svg ? L.DashedPolyline : L.DashedPolyline.extend({ - _updateStyle: function () { - L.Polyline.prototype._updateStyle.call(this); - if (this.options.stroke) { - if (this.options.dashed == true) - this._path.setAttribute('stroke-dasharray', '8,6'); - else - this._path.setAttribute('stroke-dasharray', ''); - } - } -}); - - -// vml rendering -L.DashedPolyline = L.Browser.svg || !L.Browser.vml ? L.DashedPolyline : L.DashedPolyline.extend({ - _updateStyle: function () { - L.Polyline.prototype._updateStyle.call(this); - if (this.options.stroke) { - if (this.options.dashed == true) - this._stroke.dashstyle = "dash"; - else - this._stroke.dashstyle = "solid"; - } - } - -}); diff --git a/WebContent/base/osrm/OSRM.Route.js b/WebContent/base/osrm/OSRM.Route.js index 6ad1f230b..ef5d2795d 100644 --- a/WebContent/base/osrm/OSRM.Route.js +++ b/WebContent/base/osrm/OSRM.Route.js @@ -22,10 +22,7 @@ or see http://www.gnu.org/licenses/agpl.txt. // simple route class (wraps Leaflet Polyline) OSRM.SimpleRoute = function (label, style) { this.label = (label ? label : "route"); - this.route = new L.DashedPolyline(); - this.route.setLatLngs( [] ); - if(style) this.route.setStyle( style ); - + this.route = new L.Polyline( [], style ); this.shown = false; }; OSRM.extend( OSRM.SimpleRoute,{ @@ -82,7 +79,7 @@ isShown: function() { return this.shown; }, addRoute: function(positions) { - var line = new L.DashedPolyline( positions ); + var line = new L.Polyline( positions ); line.on('click', function(e) { OSRM.G.route.fire('click',e); }); this.route.addLayer( line ); }, diff --git a/WebContent/main.html b/WebContent/main.html index f6a49d902..1c4cdc326 100644 --- a/WebContent/main.html +++ b/WebContent/main.html @@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt. - diff --git a/WebContent/main.js b/WebContent/main.js index 7f8a1d1ad..7e90575e0 100644 --- a/WebContent/main.js +++ b/WebContent/main.js @@ -27,7 +27,7 @@ OSRM.init = function() { OSRM.GUI.init(); OSRM.Map.init(); -// OSRM.Printing.init(); + OSRM.Printing.init(); // OSRM.Routing.init(); // OSRM.RoutingAlternatives.init(); OSRM.Localization.init(); @@ -42,6 +42,12 @@ OSRM.init = function() { // // only init default position / geolocation position if GET parameters do not specify a different one // if( OSRM.G.initial_position_override == false ) // OSRM.Map.initPosition(); + + + //var polyline = L.polyline([ [51.509, -0.08], [51.503, -0.06], [51.51, -0.047] ], {dashArray:"8,6"}).addTo( OSRM.G.map ); + var route = new OSRM.SimpleRoute("test", {dashArray:"8,5"}); + route.setPositions( [ [51.509, -0.08], [51.503, -0.06], [51.51, -0.047] ] ); + route.show(); }; diff --git a/WebContent/printing/printing.html b/WebContent/printing/printing.html index ec38f5ccf..aea9f649d 100644 --- a/WebContent/printing/printing.html +++ b/WebContent/printing/printing.html @@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt. - diff --git a/WebContent/printing/printing.js b/WebContent/printing/printing.js index a7bea0587..591cd67ef 100644 --- a/WebContent/printing/printing.js +++ b/WebContent/printing/printing.js @@ -92,9 +92,9 @@ OSRM.drawMarkers = function( markers ) { // manage route OSRM.drawRoute = function( positions ) { if( OSRM.G.route == undefined ) - OSRM.G.route = new L.DashedPolyline(); + OSRM.G.route = new L.Polyline(); OSRM.G.route.setLatLngs( positions ); - OSRM.G.route.setStyle( {dashed:false,clickable:false,color:'#0033FF', weight:5} ); + OSRM.G.route.setStyle( {clickable:false,color:'#0033FF', weight:5} ); OSRM.G.map.addLayer( OSRM.G.route ); }; OSRM.updateRoute = function( positions ) {