aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets/javascripts
diff options
context:
space:
mode:
authorLuc Donnet2014-08-20 11:26:15 +0200
committerLuc Donnet2014-08-20 11:26:15 +0200
commitbf8c646de5b0a908ba89a2f0ce40c29407feb79a (patch)
treee8e8921582ce74232a1f14b612b210e3ff631de4 /app/assets/javascripts
parent3bc81cb294d1453326d6e8fc86183ba651c5307c (diff)
parent32b0c11f377205168e4006efa46e31303a0e0cf5 (diff)
downloadchouette-core-bf8c646de5b0a908ba89a2f0ce40c29407feb79a.tar.bz2
Merge branch 'sismo' of github.com:afimb/chouette2 into sismo
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r--app/assets/javascripts/access_points.js.coffee49
-rw-r--r--app/assets/javascripts/stop_areas/edit.js.coffee48
2 files changed, 48 insertions, 49 deletions
diff --git a/app/assets/javascripts/access_points.js.coffee b/app/assets/javascripts/access_points.js.coffee
index 5cff80b7c..ee5e89def 100644
--- a/app/assets/javascripts/access_points.js.coffee
+++ b/app/assets/javascripts/access_points.js.coffee
@@ -1,34 +1,33 @@
jQuery ->
x_y_change = (event) ->
- if referential_projection != undefined
- referential_point = new OpenLayers.Geometry.Point($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
-
- $('input#access_point_projection_x').val(referential_point.x)
- $('input#access_point_projection_y').val(referential_point.y)
-
- feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
- google_point = new OpenLayers.LonLat($('input#access_point_longitude').val(), $('input#access_point_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
+ c = $('input#access_point_coordinates').val().split(",")
+ if c.length == 2
+ if referential_projection != undefined
+ referential_point = new OpenLayers.Geometry.Point(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
+
+ $('input#access_point_projection_xy').val(referential_point.x.toString()+","+referential_point.y.toString())
+
+ feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
+ google_point = new OpenLayers.LonLat(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
- $('input#access_point_longitude').change(x_y_change)
- $('input#access_point_latitude').change(x_y_change)
+ $('input#access_point_coordinates').change(x_y_change)
lon_lat_change = (event) ->
- if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point($('input#access_point_projection_x').val(), $('input#access_point_projection_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
-
- $('input#access_point_longitude').val( wgs84_point.x)
- $('input#access_point_latitude').val( wgs84_point.y)
-
- feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#access_point_id').val())
- google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#access_point_projection_x').change(lon_lat_change)
- $('input#access_point_projection_y').change(lon_lat_change)
+ c = $('input#access_point_projection_xy').val().split(",")
+ if c.length == 2
+ if referential_projection != undefined
+ wgs84_point = new OpenLayers.Geometry.Point(c[0], c[1]).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
+
+ $('input#access_point_coordinates').val( wgs84_point.y.toString()+","+wgs84_point.x)
+ feature = map.getLayersByName("access_point")[0].getFeatureByFid($('input#access_point_id').val())
+ google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
+
+ $('input#access_point_projection_xy').change(lon_lat_change)
# switch visibility of access_links
switch_generics = (event) ->
diff --git a/app/assets/javascripts/stop_areas/edit.js.coffee b/app/assets/javascripts/stop_areas/edit.js.coffee
index 44f6da982..d1d945ebf 100644
--- a/app/assets/javascripts/stop_areas/edit.js.coffee
+++ b/app/assets/javascripts/stop_areas/edit.js.coffee
@@ -1,31 +1,31 @@
$(".stop_areas.edit").ready ->
x_y_change = (event) ->
- if referential_projection != undefined
- referential_point = new OpenLayers.Geometry.Point($('input#stop_area_longitude').val(), $('input#stop_area_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
-
- $('input#stop_area_projection_x').val(referential_point.x)
- $('input#stop_area_projection_y').val(referential_point.y)
-
- feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
- google_point = new OpenLayers.LonLat($('input#stop_area_longitude').val(), $('input#stop_area_latitude').val()).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
+ c = $('input#stop_area_coordinates').val().split(",")
+ if c.length == 2
+ if referential_projection != undefined
+ referential_point = new OpenLayers.Geometry.Point(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), referential_projection )
+
+ $('input#stop_area_projection_xy').val(referential_point.x.toString()+","+referential_point.y.toString())
+
+ feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
+ google_point = new OpenLayers.LonLat(c[1], c[0]).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
- $('input#stop_area_longitude').change(x_y_change)
- $('input#stop_area_latitude').change(x_y_change)
+ $('input#stop_area_coordinates').change(x_y_change)
lon_lat_change = (event) ->
- if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point($('input#stop_area_projection_x').val(), $('input#stop_area_projection_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
-
- $('input#stop_area_longitude').val( wgs84_point.x)
- $('input#stop_area_latitude').val( wgs84_point.y)
+ c = $('input#stop_area_projection_xy').val().split(",")
+ if c.length == 2
+ if referential_projection != undefined
+ wgs84_point = new OpenLayers.Geometry.Point(c[0], c[1]).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
+
+ $('input#stop_area_coordinates').val( wgs84_point.y.toString()+","+wgs84_point.x)
+
+ feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
+ google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
+ feature.move(google_point)
+ map.setCenter(google_point, 16, false, true)
- feature = map.getLayersByName("stop_area")[0].getFeatureByFid($('input#stop_area_id').val())
- google_point = new OpenLayers.LonLat(wgs84_point.x, wgs84_point.y).transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject())
- feature.move(google_point)
- map.setCenter(google_point, 16, false, true)
-
- $('input#stop_area_projection_x').change(lon_lat_change)
- $('input#stop_area_projection_y').change(lon_lat_change)
+ $('input#stop_area_projection_xy').change(lon_lat_change)