summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-03 11:27:33 +0200
committerÉtienne Loks <etienne.loks@iggdrasil.net>2017-04-03 11:27:33 +0200
commit1baf6219afd8f2041fabe139580ec0f05eb5d417 (patch)
tree7a1b40174de165273ce6d12543ff8b2da7b8ecf0
parent9fe2f4b93167a1cb5a68486e2756635d16e867a4 (diff)
downloadChimère-1baf6219afd8f2041fabe139580ec0f05eb5d417.tar.bz2
Chimère-1baf6219afd8f2041fabe139580ec0f05eb5d417.zip
JS: manage routing form
-rw-r--r--chimere/static/chimere/css/styles.css1
-rw-r--r--chimere/static/chimere/js/jquery.chimere.js45
-rw-r--r--chimere/static/chimere/js/routing-widget.js4
-rw-r--r--version.py2
4 files changed, 18 insertions, 34 deletions
diff --git a/chimere/static/chimere/css/styles.css b/chimere/static/chimere/css/styles.css
index 49cfed7..ed66f57 100644
--- a/chimere/static/chimere/css/styles.css
+++ b/chimere/static/chimere/css/styles.css
@@ -349,6 +349,7 @@ ul#action-2 {
font-weight:bold;
}
+#search_routing:hover,
#close-detail:hover{
cursor:pointer;
}
diff --git a/chimere/static/chimere/js/jquery.chimere.js b/chimere/static/chimere/js/jquery.chimere.js
index fd1787d..1eea767 100644
--- a/chimere/static/chimere/js/jquery.chimere.js
+++ b/chimere/static/chimere/js/jquery.chimere.js
@@ -2242,37 +2242,20 @@ function transformCoordToLonLat(coord) {
},
routingInputChange: function(nominatim_id){
$('#map_menu_clear').show();
+ var geom = ol.proj.transform(
+ [Math.round($('#' + nominatim_id + '_lon').val() * 1000) / 1000,
+ Math.round($('#' + nominatim_id + '_lat').val() * 1000) / 1000],
+ EPSG_DISPLAY_PROJECTION,
+ EPSG_PROJECTION);
switch(nominatim_id){
case 'nominatim_start':
- settings.routing_start = new OpenLayers.Marker(
- new OpenLayers.LonLat(
- $('#'+nominatim_id+'_lon').val(),
- $('#'+nominatim_id+'_lat').val()
- ).transform(EPSG_DISPLAY_PROJECTION,
- settings.map.getProjectionObject()),
- settings.icon_start);
- settings.layerRouteMarker.addMarker(settings.routing_start);
+ methods.routingFrom(geom, false);
break;
case 'nominatim_end':
- settings.routing_end = new OpenLayers.Marker(
- new OpenLayers.LonLat(
- $('#'+nominatim_id+'_lon').val(),
- $('#'+nominatim_id+'_lat').val()
- ).transform(EPSG_DISPLAY_PROJECTION,
- settings.map.getProjectionObject()),
- settings.icon_end);
- settings.layerRouteMarker.addMarker(settings.routing_end);
+ methods.routingTo(geom, false);
break;
default:
- settings.routing_steps.push(new OpenLayers.Marker(
- new OpenLayers.LonLat(
- $('#'+nominatim_id+'_lon').val(),
- $('#'+nominatim_id+'_lat').val()
- ).transform(EPSG_DISPLAY_PROJECTION,
- settings.map.getProjectionObject()),
- settings.icon_step.clone()));
- settings.layerRouteMarker.addMarker(
- settings.routing_steps[settings.routing_steps.length-1]);
+ methods.routingAddStep(geom, false);
break;
}
if (settings.routing_end && settings.routing_start
@@ -2290,7 +2273,7 @@ function transformCoordToLonLat(coord) {
}
},
// set the start point for routing
- routingFrom: function(obj){
+ routingFrom: function(obj, auto){
$('#chimere_map_menu').hide();
if (!settings.mobile){
settings.routing_panel_open();
@@ -2335,7 +2318,7 @@ function transformCoordToLonLat(coord) {
'start_label');
}
- if (settings.routing_end) methods.route();
+ if (settings.routing_end && auto) methods.route();
// Added for mobile - START //
//iOS
methods.connectWebViewJavascriptBridge(
@@ -2406,7 +2389,7 @@ function transformCoordToLonLat(coord) {
},
// Added for mobile - END //
// add a step point for routing
- routingAddStep: function(obj){
+ routingAddStep: function(obj, auto){
if (!settings.mobile){
settings.routing_panel_open();
$('.map_menu_clear').show();
@@ -2448,7 +2431,7 @@ function transformCoordToLonLat(coord) {
transformCoordToLonLat(coordinates),
'step_'+current_itinerary_number+'_label');
}
- if (settings.routing_end && settings.routing_start) methods.route();
+ if (settings.routing_end && settings.routing_start && auto) methods.route();
},
// change routing speed
routingChangeSpeed: function(speed){
@@ -2491,7 +2474,7 @@ function transformCoordToLonLat(coord) {
},
// set the finish point for routing
- routingTo: function(obj){
+ routingTo: function(obj, auto){
if (!settings.mobile){
settings.routing_panel_open();
$('.map_menu_clear').show();
@@ -2536,7 +2519,7 @@ function transformCoordToLonLat(coord) {
'end_label');
}
- if (settings.routing_start) methods.route();
+ if (settings.routing_start && auto) methods.route();
// Added for mobile - START //
// iOS
diff --git a/chimere/static/chimere/js/routing-widget.js b/chimere/static/chimere/js/routing-widget.js
index 34ca46c..12ec094 100644
--- a/chimere/static/chimere/js/routing-widget.js
+++ b/chimere/static/chimere/js/routing-widget.js
@@ -16,10 +16,10 @@ $(document).ready(function() {
$('#chimere_itinerary_form').show();
});
$('#chimere_itinerary_new').click(function(){
- $('#map').chimere('routingClear');
+ $('#main-map').chimere('routingClear');
});
$('#search_routing').click(function(){
- $('#map').chimere('route');
+ $('#main-map').chimere('route');
});
var detached_speeds = Array();
diff --git a/version.py b/version.py
index b0b850b..fcace13 100644
--- a/version.py
+++ b/version.py
@@ -1,4 +1,4 @@
-VERSION = (2, 99, 9)
+VERSION = (2, 99, 10)
def get_version():