some files weren't removed properly...
This commit is contained in:
parent
087bb12847
commit
38defe9629
@ -1,80 +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 bugfixes
|
|
||||||
// [assorted bugfixes to Leaflet functions we use]
|
|
||||||
|
|
||||||
|
|
||||||
// return closest point on segment or distance to that point
|
|
||||||
L.LineUtil._sqClosestPointOnSegment = function (p, p1, p2, sqDist) {
|
|
||||||
var x = p1.x,
|
|
||||||
y = p1.y,
|
|
||||||
dx = p2.x - x,
|
|
||||||
dy = p2.y - y,
|
|
||||||
dot = dx * dx + dy * dy,
|
|
||||||
t;
|
|
||||||
|
|
||||||
if (dot > 0) {
|
|
||||||
t = ((p.x - x) * dx + (p.y - y) * dy) / dot;
|
|
||||||
|
|
||||||
if (t > 1) {
|
|
||||||
x = p2.x;
|
|
||||||
y = p2.y;
|
|
||||||
} else if (t > 0) {
|
|
||||||
x += dx * t;
|
|
||||||
y += dy * t;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dx = p.x - x;
|
|
||||||
dy = p.y - y;
|
|
||||||
|
|
||||||
// DS_CHANGE: modified return values
|
|
||||||
if(sqDist)
|
|
||||||
return dx*dx + dy*dy;
|
|
||||||
else {
|
|
||||||
var p = new L.Point(x,y);
|
|
||||||
p._sqDist = dx*dx + dy*dy;
|
|
||||||
return p;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// makes requestAnimFrame respect the immediate paramter -> prevents drag events after dragend events
|
|
||||||
// (alternatively: add if(!this.dragging ) return to L.Draggable._updatePosition, but must be done in leaflet.js!)
|
|
||||||
// [TODO: In Leaflet 0.4 use L.Util.cancelAnimFrame(this._animRequest) in L.Draggable._onUp() instead, also has to be done in leaflet.js!]
|
|
||||||
L.Util.requestAnimFrame = (function () {
|
|
||||||
function timeoutDefer(callback) {
|
|
||||||
window.setTimeout(callback, 1000 / 60);
|
|
||||||
}
|
|
||||||
|
|
||||||
var requestFn = window.requestAnimationFrame ||
|
|
||||||
window.webkitRequestAnimationFrame ||
|
|
||||||
window.mozRequestAnimationFrame ||
|
|
||||||
window.oRequestAnimationFrame ||
|
|
||||||
window.msRequestAnimationFrame ||
|
|
||||||
timeoutDefer;
|
|
||||||
|
|
||||||
return function (callback, context, immediate, contextEl) {
|
|
||||||
callback = context ? L.Util.bind(callback, context) : callback;
|
|
||||||
if (immediate ) { // DS_CHANGE: removed additional condition requestFn === timeoutDefer
|
|
||||||
callback();
|
|
||||||
} else {
|
|
||||||
requestFn(callback, contextEl);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}());
|
|
@ -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";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
@ -1,65 +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: MouseMarker
|
|
||||||
// [marker class that propagates modifier and button presses in mouse click events and allows for changing icons]
|
|
||||||
|
|
||||||
|
|
||||||
// extended marker class
|
|
||||||
L.MouseMarker = L.Marker.extend({
|
|
||||||
initialize: function (latlng, options) {
|
|
||||||
L.Marker.prototype.initialize.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
switchIcon: function( icon ) {
|
|
||||||
this.options.icon = icon;
|
|
||||||
|
|
||||||
if (this._map) {
|
|
||||||
this._changeIcon();
|
|
||||||
this._reset();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_changeIcon: function () {
|
|
||||||
var options = this.options;
|
|
||||||
|
|
||||||
if (this._icon) {
|
|
||||||
this._icon = options.icon.switchIcon( this._icon );
|
|
||||||
if (this.options.clickable) // TODO: only needed until Leaflet 0.4
|
|
||||||
this._icon.className += ' leaflet-clickable';
|
|
||||||
}
|
|
||||||
|
|
||||||
var panes = this._map._panes;
|
|
||||||
|
|
||||||
if (this._shadow)
|
|
||||||
panes.shadowPane.removeChild(this._shadow);
|
|
||||||
this._shadow = options.icon.createShadow();
|
|
||||||
if (this._shadow)
|
|
||||||
panes.shadowPane.appendChild(this._shadow);
|
|
||||||
},
|
|
||||||
|
|
||||||
_onMouseClick: function (e) {
|
|
||||||
L.DomEvent.stopPropagation(e);
|
|
||||||
if (this.dragging && this.dragging.moved()) { return; }
|
|
||||||
this.fire(e.type, {
|
|
||||||
altKey: e.altKey,
|
|
||||||
ctrlKey: e.ctrlKey,
|
|
||||||
shiftKey: e.shiftKey,
|
|
||||||
button: e.button
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,115 +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: SwitchableIcon
|
|
||||||
// [will be an extension of L.Icon in Leaflet 0.4, for now it is a copy with added functionality]
|
|
||||||
|
|
||||||
|
|
||||||
// icon class with functions to simply switch the icon images
|
|
||||||
L.SwitchableIcon = L.Class.extend({
|
|
||||||
options: {
|
|
||||||
/*
|
|
||||||
iconUrl: (String) (required)
|
|
||||||
iconSize: (Point) (can be set through CSS)
|
|
||||||
iconAnchor: (Point) (centered by default if size is specified, can be set in CSS with negative margins)
|
|
||||||
popupAnchor: (Point) (if not specified, popup opens in the anchor point)
|
|
||||||
shadowUrl: (Point) (no shadow by default)
|
|
||||||
shadowSize: (Point)
|
|
||||||
*/
|
|
||||||
className: ''
|
|
||||||
},
|
|
||||||
|
|
||||||
initialize: function (options) {
|
|
||||||
L.Util.setOptions(this, options);
|
|
||||||
},
|
|
||||||
|
|
||||||
createIcon: function () {
|
|
||||||
return this._createIcon('icon');
|
|
||||||
},
|
|
||||||
|
|
||||||
createShadow: function () {
|
|
||||||
return this.options.shadowUrl ? this._createIcon('shadow') : null;
|
|
||||||
},
|
|
||||||
|
|
||||||
_createIcon: function (name) {
|
|
||||||
var img = this._createImg(this.options[name + 'Url']);
|
|
||||||
this._setIconStyles(img, name);
|
|
||||||
return img;
|
|
||||||
},
|
|
||||||
|
|
||||||
_setIconStyles: function (img, name) {
|
|
||||||
var options = this.options,
|
|
||||||
size = options[name + 'Size'],
|
|
||||||
anchor = options.iconAnchor;
|
|
||||||
|
|
||||||
if (!anchor && size) {
|
|
||||||
anchor = size.divideBy(2, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (name === 'shadow' && anchor && options.shadowOffset) {
|
|
||||||
anchor._add(options.shadowOffset);
|
|
||||||
}
|
|
||||||
|
|
||||||
img.className = 'leaflet-marker-' + name + ' ' + options.className;
|
|
||||||
|
|
||||||
if (anchor) {
|
|
||||||
img.style.marginLeft = (-anchor.x) + 'px';
|
|
||||||
img.style.marginTop = (-anchor.y) + 'px';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (size) {
|
|
||||||
img.style.width = size.x + 'px';
|
|
||||||
img.style.height = size.y + 'px';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
_createImg: function (src) {
|
|
||||||
var el;
|
|
||||||
if (!L.Browser.ie6) {
|
|
||||||
el = document.createElement('img');
|
|
||||||
el.src = src;
|
|
||||||
} else {
|
|
||||||
el = document.createElement('div');
|
|
||||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
|
||||||
}
|
|
||||||
return el;
|
|
||||||
},
|
|
||||||
|
|
||||||
// new functions start here
|
|
||||||
switchIcon: function (el) {
|
|
||||||
return this._switchIcon('icon', el);
|
|
||||||
},
|
|
||||||
|
|
||||||
switchShadow: function (el) {
|
|
||||||
return this.options.shadowUrl ? this._switchIcon('shadow', el) : null;
|
|
||||||
},
|
|
||||||
|
|
||||||
_switchIcon: function (name, el) {
|
|
||||||
var img = this._switchImg(this.options[name + 'Url'], el);
|
|
||||||
this._setIconStyles(img, name);
|
|
||||||
return img;
|
|
||||||
},
|
|
||||||
|
|
||||||
_switchImg: function (src, el) {
|
|
||||||
if (!L.Browser.ie6) {
|
|
||||||
el.src = src;
|
|
||||||
} else {
|
|
||||||
el.style.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' + src + '")';
|
|
||||||
}
|
|
||||||
return el;
|
|
||||||
}
|
|
||||||
});
|
|
@ -1,114 +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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
// OSRM routing
|
|
||||||
// [handles GUI events]
|
|
||||||
|
|
||||||
|
|
||||||
OSRM.RoutingGUI = {
|
|
||||||
|
|
||||||
// click: button "reset"
|
|
||||||
resetRouting: function() {
|
|
||||||
document.getElementById('gui-input-source').value = "";
|
|
||||||
document.getElementById('gui-input-target').value = "";
|
|
||||||
|
|
||||||
OSRM.G.route.hideAll();
|
|
||||||
OSRM.G.markers.removeAll();
|
|
||||||
OSRM.G.markers.highlight.hide();
|
|
||||||
|
|
||||||
document.getElementById('information-box').innerHTML = "";
|
|
||||||
document.getElementById('information-box-header').innerHTML = "";
|
|
||||||
|
|
||||||
OSRM.JSONP.reset();
|
|
||||||
},
|
|
||||||
|
|
||||||
// click: button "reverse"
|
|
||||||
reverseRouting: function() {
|
|
||||||
// invert input boxes
|
|
||||||
var tmp = document.getElementById("gui-input-source").value;
|
|
||||||
document.getElementById("gui-input-source").value = document.getElementById("gui-input-target").value;
|
|
||||||
document.getElementById("gui-input-target").value = tmp;
|
|
||||||
|
|
||||||
// recompute route if needed
|
|
||||||
if( OSRM.G.route.isShown() ) {
|
|
||||||
OSRM.G.markers.route.reverse();
|
|
||||||
OSRM.Routing.getRoute(); // temporary route reversal for query, actual reversal done after receiving response
|
|
||||||
OSRM.G.markers.route.reverse();
|
|
||||||
OSRM.G.markers.highlight.hide();
|
|
||||||
OSRM.RoutingDescription.showSimple( OSRM.G.response );
|
|
||||||
|
|
||||||
// simply reverse markers
|
|
||||||
} else {
|
|
||||||
OSRM.G.markers.reverseMarkers();
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
// click: button "show"
|
|
||||||
showMarker: function(marker_id) {
|
|
||||||
if( OSRM.JSONP.fences["geocoder_source"] || OSRM.JSONP.fences["geocoder_target"] )
|
|
||||||
return;
|
|
||||||
|
|
||||||
if( marker_id == OSRM.C.SOURCE_LABEL && OSRM.G.markers.hasSource() )
|
|
||||||
OSRM.G.markers.route[0].centerView();
|
|
||||||
else if( marker_id == OSRM.C.TARGET_LABEL && OSRM.G.markers.hasTarget() )
|
|
||||||
OSRM.G.markers.route[OSRM.G.markers.route.length-1].centerView();
|
|
||||||
},
|
|
||||||
|
|
||||||
// changed: any inputbox (is called when enter is pressed [after] or focus is lost [before])
|
|
||||||
inputChanged: function(marker_id) {
|
|
||||||
if( marker_id == OSRM.C.SOURCE_LABEL)
|
|
||||||
OSRM.Geocoder.call(OSRM.C.SOURCE_LABEL, document.getElementById('gui-input-source').value);
|
|
||||||
else if( marker_id == OSRM.C.TARGET_LABEL)
|
|
||||||
OSRM.Geocoder.call(OSRM.C.TARGET_LABEL, document.getElementById('gui-input-target').value);
|
|
||||||
},
|
|
||||||
|
|
||||||
// click: button "open JOSM"
|
|
||||||
openJOSM: function() {
|
|
||||||
var x = OSRM.G.map.getCenterUI();
|
|
||||||
var ydelta = 0.01;
|
|
||||||
var xdelta = ydelta * 2;
|
|
||||||
var p = [ 'left=' + (x.lng - xdelta), 'bottom=' + (x.lat - ydelta), 'right=' + (x.lng + xdelta), 'top=' + (x.lat + ydelta)];
|
|
||||||
var url = 'http://localhost:8111/load_and_zoom?' + p.join('&');
|
|
||||||
|
|
||||||
var frame = L.DomUtil.create('iframe', null, document.body);
|
|
||||||
frame.style.width = frame.style.height = "0px";
|
|
||||||
frame.src = url;
|
|
||||||
frame.onload = function(e) { document.body.removeChild(frame); };
|
|
||||||
},
|
|
||||||
|
|
||||||
//click: button "open OSM Bugs"
|
|
||||||
openOSMBugs: function() {
|
|
||||||
var position = OSRM.G.map.getCenterUI();
|
|
||||||
window.open( "http://osmbugs.org/?lat="+position.lat.toFixed(6)+"&lon="+position.lng.toFixed(6)+"&zoom="+OSRM.G.map.getZoom() );
|
|
||||||
},
|
|
||||||
|
|
||||||
//click: button "delete marker"
|
|
||||||
deleteMarker: function(marker_id) {
|
|
||||||
var id = null;
|
|
||||||
if(marker_id == 'source' && OSRM.G.markers.hasSource() )
|
|
||||||
id = 0;
|
|
||||||
else if(marker_id == 'target' && OSRM.G.markers.hasTarget() )
|
|
||||||
id = OSRM.G.markers.route.length-1;
|
|
||||||
if( id == null)
|
|
||||||
return;
|
|
||||||
|
|
||||||
OSRM.G.markers.removeMarker( id );
|
|
||||||
OSRM.Routing.getRoute();
|
|
||||||
OSRM.G.markers.highlight.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
Loading…
Reference in New Issue
Block a user