restructured for release

This commit is contained in:
DennisSchiefer 2012-03-14 10:39:37 +01:00
parent ec27881f39
commit d92b28d2c3
19 changed files with 30 additions and 23 deletions

View File

@ -23,10 +23,6 @@ OSRM.JSONP = {
// wrap timeout function
OSRM.JSONP.timeouts[id] = function(response) {
if( OSRM.JSONP.fences[id] == undefined ){ // fence to prevent execution after timeout function (when precompiled!)
//OSRM.debug.log("x");
return;
}
timeout_function(response);
// var jsonp = document.getElementById('jsonp_'+id); // clean DOM
@ -45,10 +41,8 @@ OSRM.JSONP = {
clearTimeout(OSRM.JSONP.timers[id]); // clear timeout timer
OSRM.JSONP.timers[id] = undefined;
if( OSRM.JSONP.fences[id] == undefined ){ // fence to prevent execution after timeout function (when precompiled!)
//OSRM.debug.log("y");
return;
}
if( OSRM.JSONP.fences[id] == undefined ) // fence to prevent execution after timeout function (when precompiled!)
return;
callback_function(response); // actual wrapped callback

View File

@ -43,7 +43,8 @@ centerView: function(zooming) {
var zoom = OSRM.DEFAULTS.ZOOM_LEVEL;
if( zooming == false )
zoom = map.getZoom();
map.setView( new L.LatLng( this.position.lat, this.position.lng-0.02), zoom); // dirty hack
//map.setView( new L.LatLng( this.position.lat, this.position.lng-0.02), zoom); // dirty hack
map.setView( new L.LatLng( this.position.lat, this.position.lng), zoom);
},
toString: function() {
return "OSRM.Marker: \""+this.label+"\", "+this.position+")";
@ -94,8 +95,8 @@ onDrag: function(e) {
this.parent.setPosition( e.target.getLatLng() );
if(OSRM.dragging == true) // TODO: hack to deal with drag events after dragend event
getRoute(OSRM.NO_DESCRIPTION);
// else
// getRoute(OSRM.FULL_DESCRIPTION);
else
getRoute(OSRM.FULL_DESCRIPTION);
updateLocation( this.parent.label );
},

View File

@ -8,11 +8,20 @@ OSRM.TARGET_MARKER_LABEL = "target";
// update locations in input boxes
function updateLocation(marker_id) {
if (marker_id == OSRM.SOURCE_MARKER_LABEL) {
document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6);
document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6);
} else if (marker_id == OSRM.TARGET_MARKER_LABEL) {
document.getElementById("input-target-name").value = my_markers.route[my_markers.route.length-1].getPosition().lat.toFixed(6) + ", " + my_markers.route[my_markers.route.length-1].getPosition().lng.toFixed(6);
}
}
function updateReverseGeocoder(marker_id) {
if (marker_id == OSRM.SOURCE_MARKER_LABEL) {
document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6);
callReverseGeocoder("source", my_markers.route[0].getPosition().lat, my_markers.route[0].getPosition().lng);
} else if (marker_id == OSRM.TARGET_MARKER_LABEL) {
document.getElementById("input-target-name").value = my_markers.route[my_markers.route.length-1].getPosition().lat.toFixed(6) + ", " + my_markers.route[my_markers.route.length-1].getPosition().lng.toFixed(6);
callReverseGeocoder("target", my_markers.route[my_markers.route.length-1].getPosition().lat, my_markers.route[my_markers.route.length-1].getPosition().lng);
}
}
function updateLocations() {
if( my_markers.route[0] && my_markers.route[0].label == OSRM.SOURCE_MARKER_LABEL) {
document.getElementById("input-source-name").value = my_markers.route[0].getPosition().lat.toFixed(6) + ", " + my_markers.route[0].getPosition().lng.toFixed(6);
@ -78,6 +87,7 @@ function callGeocoder(marker_id, query) {
if(query.match(/^\s*[-+]?[0-9]*\.?[0-9]+\s*[,;]\s*[-+]?[0-9]*\.?[0-9]+\s*$/)){
var coord = query.split(/[,;]/);
onclickGeocoderResult(marker_id, coord[0], coord[1]);
// updateReverseGeocoder(marker_id);
return;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 429 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 617 B

After

Width:  |  Height:  |  Size: 447 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 592 B

After

Width:  |  Height:  |  Size: 440 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 531 B

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 294 B

After

Width:  |  Height:  |  Size: 240 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.6 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 B

After

Width:  |  Height:  |  Size: 617 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 739 B

After

Width:  |  Height:  |  Size: 530 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

@ -23,7 +23,7 @@
<script src="OSRM.base.js" type="text/javascript"></script>
<script src="OSRM.config.js" type="text/javascript"></script>
<script defer="defer" src="OSRM.debug.js" type="text/javascript"></script>
<!-- <script defer="defer" src="OSRM.debug.js" type="text/javascript"></script> -->
<script src="OSRM.Browser.js" type="text/javascript"></script>
<script src="OSRM.GUI.js" type="text/javascript"></script>

View File

@ -17,10 +17,10 @@ function init() {
// prefetch images
OSRM.images = Array();
function prefetchImages() {
var images = [ 'http://map.project-osrm.org/new/images/marker-source.png',
'http://map.project-osrm.org/new/images/marker-target.png',
'http://map.project-osrm.org/new/images/marker-via.png',
'http://map.project-osrm.org/new/images/marker-highlight.png'
var images = [ 'images/marker-source.png',
'images/marker-target.png',
'images/marker-via.png',
'images/marker-highlight.png'
];
for(var i=0; i<images.length; i++) {
@ -40,7 +40,7 @@ function prefetchIcons() {
];
for(var i=0; i<images.length; i++)
OSRM.icons[images[i]] = new L.Icon('http://map.project-osrm.org/new/images/'+images[i]+'.png');
OSRM.icons[images[i]] = new L.Icon('images/'+images[i]+'.png');
}
@ -127,13 +127,17 @@ function initMap() {
index = my_markers.setSource( e.latlng );
my_markers.route[index].show();
my_markers.route[index].centerView(false);
getRoute(OSRM.FULL_DESCRIPTION);
getRoute(OSRM.FULL_DESCRIPTION);
updateLocation("source");
// updateReverseGeocoder("source");
}
else if( !my_markers.route[my_markers.route.length-1] || my_markers.route[ my_markers.route.length-1 ].label != OSRM.TARGET_MARKER_LABEL) {
index = my_markers.setTarget( e.latlng );
my_markers.route[index].show();
my_markers.route[index].centerView(false);
getRoute(OSRM.FULL_DESCRIPTION);
getRoute(OSRM.FULL_DESCRIPTION);
updateLocation("target");
// updateReverseGeocoder("target");
}
} );
// onmousemove test
@ -203,7 +207,7 @@ function checkURL(){
getRoute(OSRM.FULL_DESCRIPTION);
var bounds = new L.LatLngBounds( positions );
bounds._southWest.lng-=1.02; // dirty hacks
//bounds._southWest.lng-=1.02; // dirty hacks
map.fitBounds( bounds );
//my_route.centerView();
}

View File

@ -90,7 +90,6 @@ function showRoute(response) {
snapRoute();
}
updateHints(response);
updateLocations();
}
function showNoRouteGeometry() {
@ -314,7 +313,6 @@ function getRoute(do_description) {
function timeoutDrag() {
my_markers.route[OSRM.dragid].hint = undefined;
getRoute(OSRM.NO_DESCRIPTION);
// OSRM.debug.log("timer");
}
function startRouting() {