aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.md15
-rw-r--r--Gemfile6
-rw-r--r--Gemfile.lock54
-rw-r--r--app/assets/javascripts/access_points.js.coffee10
-rw-r--r--app/assets/javascripts/stop_areas.js.coffee10
-rw-r--r--app/maps/access_point_map.rb4
-rw-r--r--app/maps/stop_area_map.rb4
-rw-r--r--app/models/referential.rb111
-rw-r--r--app/views/access_points/_form.html.erb4
-rw-r--r--app/views/access_points/show.html.erb14
-rw-r--r--app/views/api/kml/stop_areas/_stop_area.kml.erb6
-rw-r--r--app/views/api/v1/access_points/show.rabl2
-rw-r--r--app/views/api/v1/stop_areas/show.rabl2
-rw-r--r--app/views/stop_areas/_form.html.erb4
-rw-r--r--app/views/stop_areas/show.html.erb14
-rw-r--r--config/environment.rb2
-rw-r--r--config/locales/access_points.yml12
-rw-r--r--config/locales/stop_areas.yml12
-rw-r--r--db/migrate/20130628130527_remove_projection_from_stop_areas.ninoxe_engine.rb14
-rw-r--r--db/migrate/20130628130528_remove_projection_from_access_points.ninoxe_engine.rb14
-rw-r--r--db/schema.rb48
-rw-r--r--spec/models/referential_spec.rb56
22 files changed, 292 insertions, 126 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index c6eda254d..ca9fdcd68 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,4 +1,11 @@
-# V2.0.3
+# V2.1.0 (en cours)
+
+* suppression des coordonnées projetées en base
+** les données sont produites à la volée pour l'export et l'affichage à partir de la projection fixée dans le référentiel
+* consolidation de l'import GTFS
+* ajout d'un export KML
+
+# V2.0.3 (27/05/13)
* Ajout des imports/export NeTex
* Fonctionnement sous windows
@@ -6,12 +13,12 @@
* Reprise des logs d'import Neptune
* Intégration des cartes du géoportail (IGN)
-# V2.0.2
+# V2.0.2 (28/01/13)
* Ajout de l'import GTFS (expérimental, ne traite pas les stations)
* Ajout d'API Rest pour accéder aux données depuis une autre application
-# V2.0.1
+# V2.0.1 (17/12/12)
* Ajout de la gestion des groupes de lignes
* Ajout de la gestion des accès et des relations arrêts-accès
@@ -19,7 +26,7 @@
* Améliorations ergonomiques et cartographiques
* L'import Neptune accepte les principaux formats d'encodage : ISO-8859-1, UTF-8, ...
-# V2.0.0
+# V2.0.0 (10/09/12)
* refonte de l'interface graphique
* ajout d'une gestion simplifiée d'utilisateurs :
diff --git a/Gemfile b/Gemfile
index 3b610aba0..7bf8dd7ab 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,8 @@ gem 'devise_invitable'
# Map, Geolocalization
gem "map_layers", "0.0.4"
-gem "georuby-ext", "0.0.2"
+gem "georuby-ext", :git => 'git://github.com/dryade/georuby-ext.git'
+#gem "georuby-ext", "0.0.2"
# User interface
gem 'user_interface', "0.0.3"
@@ -45,7 +46,8 @@ gem 'inherited_resources'
gem 'will_paginate', '~> 3.0'
gem 'ransack'
gem 'squeel'
-gem 'ninoxe', '0.1.2'
+gem 'ninoxe', :git => 'git://github.com/dryade/ninoxe.git'
+#gem 'ninoxe', '0.1.2'
gem 'acts_as_list', '0.1.6'
gem "acts_as_tree-1.8", '1.1.0', :require => "acts_as_tree"
diff --git a/Gemfile.lock b/Gemfile.lock
index 7673f4495..cfb7ca0ba 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -1,3 +1,28 @@
+GIT
+ remote: git://github.com/dryade/georuby-ext.git
+ revision: 014bb8903d08bdf9fb946e06ac757c8213158b88
+ specs:
+ georuby-ext (0.0.2)
+ activesupport
+ dbf
+ dr-ffi-proj4 (= 0.0.1)
+ ffi-geos (= 0.1.1)
+ geokit
+ georuby (= 1.9.8)
+ json_pure
+ nokogiri (= 1.5.10)
+ rgeo (= 0.3.20)
+
+GIT
+ remote: git://github.com/dryade/ninoxe.git
+ revision: 6aeb68e174b35f70c368997282923f95f0d31299
+ specs:
+ ninoxe (0.1.2)
+ activerecord (~> 3.1)
+ acts_as_list (~> 0.1.6)
+ foreigner (= 1.4.0)
+ georuby-ext (= 0.0.2)
+
GEM
remote: http://rubygems.org/
specs:
@@ -75,7 +100,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.3.3)
- dbf (2.0.3)
+ dbf (2.0.4)
fastercsv (~> 1.5.4)
delayed_job (3.0.3)
activesupport (~> 3.0)
@@ -115,16 +140,6 @@ GEM
geokit (1.6.5)
multi_json
georuby (1.9.8)
- georuby-ext (0.0.2)
- activesupport
- dbf
- dr-ffi-proj4 (= 0.0.1)
- ffi-geos (= 0.1.1)
- geokit
- georuby (= 1.9.8)
- json_pure
- nokogiri
- rgeo (= 0.3.20)
gravatar_image_tag (1.1.3)
guard (1.3.2)
listen (>= 0.4.2)
@@ -152,7 +167,7 @@ GEM
jruby-rack (>= 1.1.1)
json (1.7.7)
json (1.7.7-java)
- json_pure (1.7.7)
+ json_pure (1.8.0)
launchy (2.1.0)
addressable (~> 2.2.6)
launchy (2.1.0-java)
@@ -173,7 +188,7 @@ GEM
map_layers (0.0.4)
mime-types (1.19)
modernizr-rails (2.0.6)
- multi_json (1.7.2)
+ multi_json (1.7.7)
net-scp (1.0.4)
net-ssh (>= 1.99.1)
net-sftp (2.0.5)
@@ -181,13 +196,8 @@ GEM
net-ssh (2.6.2)
net-ssh-gateway (1.1.0)
net-ssh (>= 1.99.1)
- ninoxe (0.1.2)
- activerecord (>= 3.1.3)
- acts_as_list (= 0.1.6)
- foreigner (= 1.4.0)
- georuby-ext (= 0.0.2)
- nokogiri (1.5.9)
- nokogiri (1.5.9-java)
+ nokogiri (1.5.10)
+ nokogiri (1.5.10-java)
open4 (1.3.0)
orm_adapter (0.4.0)
pg (0.11.0)
@@ -338,7 +348,7 @@ DEPENDENCIES
dr-apartment
factory_girl_rails (= 1.7)
formtastic
- georuby-ext (= 0.0.2)
+ georuby-ext!
gravatar_image_tag
guard
guard-rspec
@@ -350,7 +360,7 @@ DEPENDENCIES
launchy
map_layers (= 0.0.4)
modernizr-rails (~> 2.0.6)
- ninoxe (= 0.1.2)
+ ninoxe!
pg (~> 0.11.0)
rabl
rails (= 3.2.6)
diff --git a/app/assets/javascripts/access_points.js.coffee b/app/assets/javascripts/access_points.js.coffee
index 74c5e926f..5cff80b7c 100644
--- a/app/assets/javascripts/access_points.js.coffee
+++ b/app/assets/javascripts/access_points.js.coffee
@@ -3,8 +3,8 @@ jQuery ->
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_x').val(referential_point.x)
- $('input#access_point_y').val(referential_point.y)
+ $('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())
@@ -16,7 +16,7 @@ jQuery ->
lon_lat_change = (event) ->
if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point($('input#access_point_x').val(), $('input#access_point_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
+ 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)
@@ -26,8 +26,8 @@ jQuery ->
feature.move(google_point)
map.setCenter(google_point, 16, false, true)
- $('input#access_point_x').change(lon_lat_change)
- $('input#access_point_y').change(lon_lat_change)
+ $('input#access_point_projection_x').change(lon_lat_change)
+ $('input#access_point_projection_y').change(lon_lat_change)
# switch visibility of access_links
diff --git a/app/assets/javascripts/stop_areas.js.coffee b/app/assets/javascripts/stop_areas.js.coffee
index aae8d4885..255c4c707 100644
--- a/app/assets/javascripts/stop_areas.js.coffee
+++ b/app/assets/javascripts/stop_areas.js.coffee
@@ -3,8 +3,8 @@ jQuery ->
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_x').val(referential_point.x)
- $('input#stop_area_y').val(referential_point.y)
+ $('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())
@@ -16,7 +16,7 @@ jQuery ->
lon_lat_change = (event) ->
if referential_projection != undefined
- wgs84_point = new OpenLayers.Geometry.Point($('input#stop_area_x').val(), $('input#stop_area_y').val()).transform(referential_projection, new OpenLayers.Projection("EPSG:4326"))
+ 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)
@@ -26,8 +26,8 @@ jQuery ->
feature.move(google_point)
map.setCenter(google_point, 16, false, true)
- $('input#stop_area_x').change(lon_lat_change)
- $('input#stop_area_y').change(lon_lat_change)
+ $('input#stop_area_projection_x').change(lon_lat_change)
+ $('input#stop_area_projection_y').change(lon_lat_change)
# switch visibility of access_links
switch_generics = (event) ->
diff --git a/app/maps/access_point_map.rb b/app/maps/access_point_map.rb
index bf763e6c6..8cacdc8c0 100644
--- a/app/maps/access_point_map.rb
+++ b/app/maps/access_point_map.rb
@@ -36,8 +36,8 @@ class AccessPointMap < ApplicationMap
if(referential_projection != undefined)
{
projection_geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), referential_projection );
- $('#access_point_x').val(projection_geometry.x);
- $('#access_point_y').val(projection_geometry.y); }
+ $('#access_point_projection_x').val(projection_geometry.x);
+ $('#access_point_projection_y').val(projection_geometry.y); }
}
});
EOF
diff --git a/app/maps/stop_area_map.rb b/app/maps/stop_area_map.rb
index ab254bf73..b2e04779a 100644
--- a/app/maps/stop_area_map.rb
+++ b/app/maps/stop_area_map.rb
@@ -40,8 +40,8 @@ class StopAreaMap < ApplicationMap
if(referential_projection != undefined)
{
projection_geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), referential_projection );
- $('#stop_area_x').val(projection_geometry.x);
- $('#stop_area_y').val(projection_geometry.y); }
+ $('#stop_area_projection_x').val(projection_geometry.x);
+ $('#stop_area_projection_y').val(projection_geometry.y); }
}
});
EOF
diff --git a/app/models/referential.rb b/app/models/referential.rb
index 2e49e844b..608b0c8fc 100644
--- a/app/models/referential.rb
+++ b/app/models/referential.rb
@@ -192,6 +192,9 @@ Rails.application.config.after_initialize do
Chouette::StopArea
class Chouette::StopArea
+
+ attr_accessible :projection_x,:projection_y
+
# override default_position method to add referential envelope when no stoparea is positioned
def default_position
# for first StopArea ... the bounds is nil , set to referential center
@@ -206,24 +209,59 @@ Rails.application.config.after_initialize do
else
self.long_lat_type = nil
end
- if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty?
- if ! self.x.nil? && ! self.y.nil?
- self.projection_type = referential.projection_type_label
- else
- self.projection_type = nil
- end
+# if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty?
+# if ! self.x.nil? && ! self.y.nil?
+# self.projection_type = referential.projection_type_label
+# else
+# self.projection_type = nil
+# end
+# else
+# self.projection_type = nil
+# self.x = nil
+# self.y = nil
+# end
+ end
+
+ def projection
+ if self.referential.projection_type.nil? || self.referential.projection_type.empty?
+ nil
else
- self.projection_type = nil
- self.x = nil
- self.y = nil
+ self.referential.projection_type
end
end
+ @point = nil
+
+ def projection_x
+ if self.long_lat_type.nil? || self.projection.nil?
+ nil
+ else
+ @point ||= GeoRuby::SimpleFeatures::Point::from_lat_lng(Geokit::LatLng.new(self.latitude,self.longitude)).project_to(self.projection.to_i)
+
+ @point.x
+ end
+ end
+ def projection_y
+ if self.long_lat_type.nil? || self.projection.nil?
+ nil
+ else
+ @point ||= GeoRuby::SimpleFeatures::Point::from_lat_lng(Geokit::LatLng.new(self.latitude,self.longitude)).project_to(self.projection.to_i)
+ @point.y
+ end
+ end
+ def projection_x=(dummy)
+ # dummy method
+ end
+ def projection_y=(dummy)
+ # dummy method
+ end
+
end
Chouette::AccessPoint
class Chouette::AccessPoint
-
+ attr_accessible :projection_x,:projection_y
+
# add projection_type set on pre-insert and pre_update action
before_validation :set_projections
def set_projections
@@ -232,18 +270,51 @@ Rails.application.config.after_initialize do
else
self.long_lat_type = nil
end
- if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty?
- if ! self.x.nil? && ! self.y.nil?
- self.projection_type = referential.projection_type_label
- else
- self.projection_type = nil
- end
+# if ! self.referential.projection_type.nil? && !self.referential.projection_type.empty?
+# if ! self.x.nil? && ! self.y.nil?
+# self.projection_type = referential.projection_type_label
+# else
+# self.projection_type = nil
+# end
+# else
+# self.projection_type = nil
+# self.x = nil
+# self.y = nil
+# end
+ end
+
+ def projection
+ if self.referential.projection_type.nil? || self.referential.projection_type.empty?
+ nil
else
- self.projection_type = nil
- self.x = nil
- self.y = nil
+ self.referential.projection_type
end
end
- end
+ @point = nil
+ def projection_x
+ if self.long_lat_type.nil? || self.projection.nil?
+ nil
+ else
+ @point ||= GeoRuby::SimpleFeatures::Point::from_lat_lng(Geokit::LatLng.new(self.latitude,self.longitude)).project_to(self.projection.to_i)
+
+ @point.x
+ end
+ end
+ def projection_y
+ if self.long_lat_type.nil? || self.projection.nil?
+ nil
+ else
+ @point ||= GeoRuby::SimpleFeatures::Point::from_lat_lng(Geokit::LatLng.new(self.latitude,self.longitude)).project_to(self.projection.to_i)
+ @point.y
+ end
+ end
+ def projection_x=(dummy)
+ # dummy method
+ end
+ def projection_y=(dummy)
+ # dummy method
+ end
+ end
+
end
diff --git a/app/views/access_points/_form.html.erb b/app/views/access_points/_form.html.erb
index cd728f0d6..8e546a878 100644
--- a/app/views/access_points/_form.html.erb
+++ b/app/views/access_points/_form.html.erb
@@ -26,8 +26,8 @@
<%= form.inputs :name => t('access_points.show.geographic_data') do %>
<% if ! @referential.projection_type_label.empty? %>
<%= form.inputs :name => @referential.projection_type_label do %>
- <%= form.input :x %>
- <%= form.input :y %>
+ <%= form.input :projection_x %>
+ <%= form.input :projection_y %>
<% end %>
<% end %>
<%= form.inputs :name => "WGS84" do %>
diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb
index 6361e2115..7f34ed0e0 100644
--- a/app/views/access_points/show.html.erb
+++ b/app/views/access_points/show.html.erb
@@ -56,18 +56,18 @@
<% if @access_point.projection_type == nil && @access_point.long_lat_type == nil %>
<span class='geo_data'><%= t('access_points.show.no_geographic_data') %></span>
<% else %>
- <% if !@access_point.projection_type.nil? %>
+ <% if !@access_point.projection.nil? %>
<p>
- <span class='geo_data'><%= @access_point.human_attribute_name("projection_type") %>: </span>
- <%= @access_point.projection_type %>
+ <span class='geo_data'><%= @access_point.human_attribute_name("projection") %>: </span>
+ <%= @access_point.projection %>
</p>
<p>
- <span class='geo_data'><%= @access_point.human_attribute_name("x") %>: </span>
- <%= @access_point.x %>
+ <span class='geo_data'><%= @access_point.human_attribute_name("projection_x") %>: </span>
+ <%= @access_point.projection_x %>
</p>
<p>
- <span class='geo_data'><%= @access_point.human_attribute_name("y") %>: </span>
- <%= @access_point.y %>
+ <span class='geo_data'><%= @access_point.human_attribute_name("projection_y") %>: </span>
+ <%= @access_point.projection_y %>
</p>
<% end %>
<% if !@access_point.long_lat_type.nil? %>
diff --git a/app/views/api/kml/stop_areas/_stop_area.kml.erb b/app/views/api/kml/stop_areas/_stop_area.kml.erb
index 1383fbf66..401bff052 100644
--- a/app/views/api/kml/stop_areas/_stop_area.kml.erb
+++ b/app/views/api/kml/stop_areas/_stop_area.kml.erb
@@ -11,9 +11,9 @@
<longitude><%= stop_area.longitude.to_s.html_safe %></longitude>
<latitude><%= stop_area.latitude.to_s.html_safe %></latitude>
<long_lat_type><%= stop_area.long_lat_type.to_s.html_safe %></long_lat_type>
- <x><%= stop_area.x.to_s.html_safe %></x>
- <y><%= stop_area.y.to_s.html_safe %></y>
- <projection_type><%= stop_area.projection_type.to_s.html_safe %></projection_type>
+ <x><%= stop_area.projection_x.to_s.html_safe %></x>
+ <y><%= stop_area.projection_y.to_s.html_safe %></y>
+ <projection_type><%= stop_area.projection.to_s.html_safe %></projection_type>
<country_code><%= stop_area.country_code.to_s.html_safe %></country_code>
<street_name><%= stop_area.street_name.to_s.html_safe %></street_name>
diff --git a/app/views/api/v1/access_points/show.rabl b/app/views/api/v1/access_points/show.rabl
index 07daffb44..1d413fb7c 100644
--- a/app/views/api/v1/access_points/show.rabl
+++ b/app/views/api/v1/access_points/show.rabl
@@ -2,7 +2,7 @@ object @access_point
extends "api/v1/trident_objects/show"
[ :longitude, :latitude, :long_lat_type, :street_name, :country_code,
- :x , :y , :projection_type, :name, :access_type,
+ :projection_x , :projection_y , :projection, :name, :access_type,
:openning_time, :closing_time,
:mobility_restricted_suitability, :stairs_availability, :lift_availability, :comment].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
diff --git a/app/views/api/v1/stop_areas/show.rabl b/app/views/api/v1/stop_areas/show.rabl
index 976d96342..1a0acecc5 100644
--- a/app/views/api/v1/stop_areas/show.rabl
+++ b/app/views/api/v1/stop_areas/show.rabl
@@ -3,7 +3,7 @@ extends "api/v1/trident_objects/show"
[ :name, :area_type,:nearest_topic_name, :fare_code, :registration_number,
:longitude, :latitude, :long_lat_type,
- :country_code, :street_name, :x, :y, :projection_type, :comment
+ :country_code, :street_name, :projection_x, :projection_y, :projection, :comment
].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb
index 5fca012f3..e649070ab 100644
--- a/app/views/stop_areas/_form.html.erb
+++ b/app/views/stop_areas/_form.html.erb
@@ -15,8 +15,8 @@
<%= form.inputs :name => t('stop_areas.show.geographic_data') do %>
<% if ! @referential.projection_type_label.empty? %>
<%= form.inputs :name => @referential.projection_type_label do %>
- <%= form.input :x %>
- <%= form.input :y %>
+ <%= form.input :projection_x %>
+ <%= form.input :projection_y %>
<% end %>
<% end %>
<%= form.inputs :name => "WGS84" do %>
diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb
index 9d0db8af8..b98378d71 100644
--- a/app/views/stop_areas/show.html.erb
+++ b/app/views/stop_areas/show.html.erb
@@ -42,18 +42,18 @@
<% if @stop_area.projection_type == nil && @stop_area.long_lat_type == nil %>
<span class='geo_data'><%= t('stop_areas.show.no_geographic_data') %></span>
<% else %>
- <% if !@stop_area.projection_type.nil? %>
+ <% if !@stop_area.projection.nil? %>
<p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("projection_type") %>: </span>
- <%= @stop_area.projection_type %>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("projection") %>: </span>
+ <%= @stop_area.projection %>
</p>
<p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("x") %>: </span>
- <%= @stop_area.x %>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("projection_x") %>: </span>
+ <%= @stop_area.projection_x %>
</p>
<p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("y") %>: </span>
- <%= @stop_area.y %>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("projection_y") %>: </span>
+ <%= @stop_area.projection_y %>
</p>
<% end %>
<% if !@stop_area.long_lat_type.nil? %>
diff --git a/config/environment.rb b/config/environment.rb
index e82bdc5f6..436f5cbba 100644
--- a/config/environment.rb
+++ b/config/environment.rb
@@ -6,4 +6,4 @@ require File.expand_path('../application', __FILE__)
ChouetteIhm::Application.initialize!
# Fix version
-APP_VERSION = '2.0.3'
+APP_VERSION = '2.1.0'
diff --git a/config/locales/access_points.yml b/config/locales/access_points.yml
index 83007d088..caaa55eaf 100644
--- a/config/locales/access_points.yml
+++ b/config/locales/access_points.yml
@@ -38,9 +38,9 @@ en:
country_code: "INSEE code"
openning_time: "Opening time"
closing_time: "Closing time"
- projection_type: "Projection type"
- x: "x-position"
- y: "y-position"
+ projection: "Projection type"
+ projection_x: "x-position"
+ projection_y: "y-position"
long_lat_type: "Projection type"
longitude: "Longitude"
latitude: "Latitude"
@@ -94,9 +94,9 @@ fr:
access_point_type: "Type d'accès"
street_name: "Nom de la rue"
country_code: "Code INSEE"
- projection_type: "Projection"
- x: "Position X"
- y: "Position Y"
+ projection: "Projection"
+ projection_x: "Position X"
+ projection_y: "Position Y"
long_lat_type: "Projection"
longitude: "Longitude"
latitude: "Latitude"
diff --git a/config/locales/stop_areas.yml b/config/locales/stop_areas.yml
index b7201b983..7baff0dba 100644
--- a/config/locales/stop_areas.yml
+++ b/config/locales/stop_areas.yml
@@ -67,9 +67,9 @@ en:
street_name: "Street name"
country_code: "INSEE code"
fare_code: "Fare code"
- projection_type: "Projection type"
- x: "x-position"
- y: "y-position"
+ projection: "Projection type"
+ projection_x: "x-position"
+ projection_y: "y-position"
long_lat_type: "Projection type"
longitude: "Longitude"
latitude: "Latitude"
@@ -158,9 +158,9 @@ fr:
street_name: "Nom de la rue"
country_code: "Code INSEE"
fare_code: "Zone tarifaire"
- projection_type: "Projection"
- x: "Position X"
- y: "Position Y"
+ projection: "Projection"
+ projection_x: "Position X"
+ projection_y: "Position Y"
long_lat_type: "Projection"
longitude: "Longitude"
latitude: "Latitude"
diff --git a/db/migrate/20130628130527_remove_projection_from_stop_areas.ninoxe_engine.rb b/db/migrate/20130628130527_remove_projection_from_stop_areas.ninoxe_engine.rb
new file mode 100644
index 000000000..3eb30a601
--- /dev/null
+++ b/db/migrate/20130628130527_remove_projection_from_stop_areas.ninoxe_engine.rb
@@ -0,0 +1,14 @@
+# This migration comes from ninoxe_engine (originally 20130628124932)
+class RemoveProjectionFromStopAreas < ActiveRecord::Migration
+ def up
+ remove_column :stop_areas, :x
+ remove_column :stop_areas, :y
+ remove_column :stop_areas, :projection_type
+ end
+
+ def down
+ add_column :stop_areas, :x, :decimal,:precision => 19, :scale => 2
+ add_column :stop_areas, :y, :decimal,:precision => 19, :scale => 2
+ add_column :stop_areas, :projection_type, :string
+ end
+end
diff --git a/db/migrate/20130628130528_remove_projection_from_access_points.ninoxe_engine.rb b/db/migrate/20130628130528_remove_projection_from_access_points.ninoxe_engine.rb
new file mode 100644
index 000000000..f0640a623
--- /dev/null
+++ b/db/migrate/20130628130528_remove_projection_from_access_points.ninoxe_engine.rb
@@ -0,0 +1,14 @@
+# This migration comes from ninoxe_engine (originally 20130628124951)
+class RemoveProjectionFromAccessPoints < ActiveRecord::Migration
+ def up
+ remove_column :access_points, :x
+ remove_column :access_points, :y
+ remove_column :access_points, :projection_type
+ end
+
+ def down
+ add_column :access_points, :x, :decimal,:precision => 19, :scale => 2
+ add_column :access_points, :y, :decimal,:precision => 19, :scale => 2
+ add_column :access_points, :projection_type, :string
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 6afe49f71..f8bbe06f3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130517090647) do
+ActiveRecord::Schema.define(:version => 20130628130528) do
create_table "access_links", :force => true do |t|
t.integer "access_point_id", :limit => 8
@@ -46,9 +46,6 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.decimal "longitude", :precision => 19, :scale => 16
t.decimal "latitude", :precision => 19, :scale => 16
t.string "long_lat_type"
- t.decimal "x", :precision => 19, :scale => 2
- t.decimal "y", :precision => 19, :scale => 2
- t.string "projection_type"
t.string "country_code"
t.string "street_name"
t.string "contained_in"
@@ -63,13 +60,12 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
add_index "access_points", ["objectid"], :name => "access_points_objectid_key", :unique => true
- create_table "api_keys", :id => false, :force => true do |t|
- t.integer "id", :limit => 8
+ create_table "api_keys", :force => true do |t|
t.integer "referential_id"
t.string "token"
t.string "name"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "companies", :force => true do |t|
@@ -124,8 +120,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.datetime "failed_at"
t.string "locked_by"
t.string "queue"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "delayed_jobs", ["priority", "run_at"], :name => "delayed_jobs_priority"
@@ -136,8 +132,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.string "arguments", :limit => 1000
t.integer "position"
t.string "severity"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "export_log_messages", ["export_id"], :name => "index_export_log_messages_on_export_id"
@@ -147,8 +143,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.string "status"
t.string "type"
t.string "options"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "references_type"
t.string "reference_ids"
end
@@ -230,8 +226,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.string "arguments", :limit => 1000
t.integer "position"
t.string "severity"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "import_log_messages", ["import_id"], :name => "index_import_log_messages_on_import_id"
@@ -239,8 +235,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
create_table "imports", :force => true do |t|
t.integer "referential_id", :limit => 8
t.string "status"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "type"
t.string "options"
t.string "file_type"
@@ -311,9 +307,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
create_table "organisations", :force => true do |t|
t.string "name"
- t.datetime "created_at", :null => false
- t.datetime "updated_at", :null => false
- t.string "geoportail_key"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "pt_links", :force => true do |t|
@@ -334,8 +329,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
create_table "referentials", :force => true do |t|
t.string "name"
t.string "slug"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "prefix"
t.string "projection_type"
t.string "time_zone"
@@ -380,9 +375,6 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.decimal "longitude", :precision => 19, :scale => 16
t.decimal "latitude", :precision => 19, :scale => 16
t.string "long_lat_type"
- t.decimal "x", :precision => 19, :scale => 2
- t.decimal "y", :precision => 19, :scale => 2
- t.string "projection_type"
t.string "country_code"
t.string "street_name"
end
@@ -471,8 +463,8 @@ ActiveRecord::Schema.define(:version => 20130517090647) do
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "organisation_id"
t.string "name"
t.string "confirmation_token"
diff --git a/spec/models/referential_spec.rb b/spec/models/referential_spec.rb
index bb6158d4f..daee718d5 100644
--- a/spec/models/referential_spec.rb
+++ b/spec/models/referential_spec.rb
@@ -7,4 +7,60 @@ describe Referential do
it { should validate_presence_of(:prefix) }
it { should validate_presence_of(:time_zone) }
+end
+
+describe Chouette::StopArea do
+ # check override methods
+
+ subject {Factory(:stop_area)}
+
+ it "should return referential projection " do
+ subject.referential.projection_type='27572'
+ subject.projection.should == subject.referential.projection_type
+ end
+
+ it "should return projection coordinates when referential has projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type='27572'
+ subject.projection_x.should_not be_nil
+ subject.projection_y.should_not be_nil
+ end
+
+ it "should return nil projection coordinates when referential has no projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type=nil
+ subject.projection_x.should be_nil
+ subject.projection_y.should be_nil
+ end
+
+end
+
+describe Chouette::AccessPoint do
+ # check override methods
+
+ subject {Factory(:access_point)}
+
+ it "should return referential projection " do
+ subject.referential.projection_type='27572'
+ subject.projection.should == subject.referential.projection_type
+ end
+
+ it "should return projection coordinates when referential has projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type='27572'
+ subject.projection_x.should_not be_nil
+ subject.projection_y.should_not be_nil
+ end
+
+ it "should return nil projection coordinates when referential has no projection" do
+ subject.latitude = 45
+ subject.longitude = 0
+ subject.referential.projection_type=nil
+ subject.projection_x.should be_nil
+ subject.projection_y.should be_nil
+ end
+
end \ No newline at end of file