removed dashed polyine

This commit is contained in:
DennisSchiefer 2012-08-13 14:46:26 +01:00
parent b792d44b4e
commit f004a65db1
9 changed files with 35 additions and 94 deletions

View File

@ -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<size; i++) {
var history = {};
history.route = new OSRM.SimpleRoute("current" , {dashed:false} );
history.route = new OSRM.SimpleRoute("current" , {} );
history.markers = [];
history.checksum = null;
this._history.push(history);

View File

@ -51,8 +51,8 @@ init: function() {
center: new L.LatLng(OSRM.DEFAULTS.ONLOAD_LATITUDE, OSRM.DEFAULTS.ONLOAD_LONGITUDE),
zoom: OSRM.DEFAULTS.ONLOAD_ZOOM_LEVEL,
layers: [base_maps[tile_servers[0].display_name]],
zoomAnimation: false, // remove animations -> 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); },

View File

@ -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();

View File

@ -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";
}
}
});

View File

@ -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 );
},

View File

@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
<script src="leaflet/leaflet-src.js" type="text/javascript"></script>
<script src="base/leaflet/L.Bugfixes.js" type="text/javascript"></script>
<script src="base/leaflet/L.Control.QueryableLayers.js" type="text/javascript"></script>
<script src="base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
<script src="base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
<script src="base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
<script src="base/leaflet/L.BingLayer.js" type="text/javascript"></script>

View File

@ -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();
};

View File

@ -38,7 +38,6 @@ or see http://www.gnu.org/licenses/agpl.txt.
<!-- scripts -->
<script src="../leaflet/leaflet-src.js" type="text/javascript"></script>
<script src="printing.js" type="text/javascript"></script>
<script src="../base/leaflet/L.DashedPolyline.js" type="text/javascript"></script>
<script src="../base/leaflet/L.MouseMarker.js" type="text/javascript"></script>
<script src="../base/leaflet/L.SwitchableIcon.js" type="text/javascript"></script>
<script src="../base/leaflet/L.BingLayer.js" type="text/javascript"></script>

View File

@ -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 ) {