aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorMichel Etienne2012-11-13 16:18:13 +0100
committerMichel Etienne2012-11-13 16:18:13 +0100
commiteeaf81e645de6f073b84b22b19e04ac63024399e (patch)
tree5c0664cc51d2ad7d42ec8ff3322d540ac2413972 /app
parent0c9781ac6c9927c4631826c2319c0c14436587d6 (diff)
downloadchouette-core-eeaf81e645de6f073b84b22b19e04ac63024399e.tar.bz2
add some features on maps
Diffstat (limited to 'app')
-rw-r--r--app/controllers/access_links_controller.rb5
-rw-r--r--app/controllers/stop_areas_controller.rb2
-rw-r--r--app/helpers/stop_areas_helper.rb6
-rw-r--r--app/maps/access_link_map.rb37
-rw-r--r--app/maps/access_point_map.rb4
-rw-r--r--app/maps/stop_area_map.rb39
-rw-r--r--app/maps/style_map/access_link_style_map.rb43
-rw-r--r--app/maps/style_map/access_points_style_map.rb27
-rw-r--r--app/maps/style_map/stop_areas_style_map.rb26
-rw-r--r--app/views/access_links/show.html.erb1
-rw-r--r--app/views/access_links/show.kml.erb20
-rw-r--r--app/views/access_points/show.html.erb4
-rw-r--r--app/views/stop_areas/_form.html.erb24
-rw-r--r--app/views/stop_areas/access_links.html.erb4
-rw-r--r--app/views/stop_areas/edit.html.erb5
-rw-r--r--app/views/stop_areas/show.html.erb66
-rw-r--r--app/views/stop_areas/show.kml.erb20
17 files changed, 258 insertions, 75 deletions
diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb
index 4c0173d4c..a8c4a3ba3 100644
--- a/app/controllers/access_links_controller.rb
+++ b/app/controllers/access_links_controller.rb
@@ -6,7 +6,8 @@ class AccessLinksController < ChouetteController
belongs_to :stop_area, :parent_class => Chouette::StopArea, :optional => true, :polymorphic => true
end
- respond_to :html, :kml, :xml, :json
+ respond_to :html, :xml, :json
+ respond_to :kml, :only => :show
def index
@@ -15,7 +16,7 @@ class AccessLinksController < ChouetteController
end
def show
- #@map = AccessLinkMap.new(resource).with_helpers(self)
+ @map = AccessLinkMap.new(resource).with_helpers(self)
show!
end
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index d08ed1803..a3e2ab921 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -49,7 +49,7 @@ class StopAreasController < ChouetteController
map.editable = false
@access_points = @stop_area.access_points
show! do |format|
- unless stop_area.position or params[:default]
+ unless stop_area.position or params[:default] or params[:routing]
format.kml {
render :nothing => true, :status => :not_found
}
diff --git a/app/helpers/stop_areas_helper.rb b/app/helpers/stop_areas_helper.rb
index df598b83f..4a2f3f9a4 100644
--- a/app/helpers/stop_areas_helper.rb
+++ b/app/helpers/stop_areas_helper.rb
@@ -3,7 +3,11 @@ module StopAreasHelper
return t(".genealogical_routing") if @stop_area.stop_area_type == 'itl'
t(".genealogical")
end
-
+
+ def show_map?
+ manage_itl || @stop_area.projection_type != nil || @stop_area.long_lat_type != nil
+ end
+
def manage_access_points
@stop_area.stop_area_type == 'stop_place' || @stop_area.stop_area_type == 'commercial_stop_point'
end
diff --git a/app/maps/access_link_map.rb b/app/maps/access_link_map.rb
new file mode 100644
index 000000000..daf49738a
--- /dev/null
+++ b/app/maps/access_link_map.rb
@@ -0,0 +1,37 @@
+
+class AccessLinkMap < ApplicationMap
+
+ attr_reader :access_link, :access_link_style
+
+ def initialize(access_link, access_link_style = nil)
+ @access_link = access_link
+ @access_link_style = access_link_style
+ end
+
+ def map
+ @map ||= MapLayers::Map.new(id, :projection => projection("EPSG:900913"), :controls => controls) do |map, page|
+ page << map.add_layer(MapLayers::OSM_MAPNIK)
+ page << map.add_layer(google_physical)
+ page << map.add_layer(google_streets)
+ page << map.add_layer(google_hybrid)
+ page << map.add_layer(google_satellite)
+
+ page.assign "access_points_layer", kml_layer([access_link.referential, access_link.access_point], :styleMap => StyleMap::AccessPointsStyleMap.new(helpers).style_map)
+ page << map.add_layer(:access_points_layer)
+ page.assign "stop_areas_layer", kml_layer([access_link.referential, access_link.stop_area], :styleMap => StyleMap::StopAreasStyleMap.new(helpers).style_map)
+ page << map.add_layer(:stop_areas_layer)
+ page << map.add_layer( kml_layer([access_link.referential, access_link.access_point, access_link], :styleMap => StyleMap::AccessLinkStyleMap.new(helpers).style_map))
+ page << map.add_control( hover_control_display_name([:access_points_layer,:stop_areas_layer]) )
+ page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds
+ end
+ end
+
+ def ready?
+ Chouette::StopArea.bounds.present?
+ end
+
+ def bounds
+ @bounds ||= GeoRuby::SimpleFeatures::Point.bounds([access_link.stop_area.geometry,access_link.access_point.geometry])
+ end
+
+end
diff --git a/app/maps/access_point_map.rb b/app/maps/access_point_map.rb
index ebb513ab0..bf763e6c6 100644
--- a/app/maps/access_point_map.rb
+++ b/app/maps/access_point_map.rb
@@ -17,6 +17,8 @@ class AccessPointMap < ApplicationMap
page << map.add_layer(google_hybrid)
page << map.add_layer(google_satellite)
+ page.assign "parent_layer", kml_layer(access_point.stop_area, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map)
+ page << map.add_layer(:parent_layer)
page.assign "edit_access_point_layer", kml_layer(access_point, { :default => editable? }, :style_map => StyleMap::EditAccessPointStyleMap.new(helpers).style_map)
page << map.add_layer(:edit_access_point_layer)
@@ -41,6 +43,8 @@ class AccessPointMap < ApplicationMap
EOF
page << map.add_control(OpenLayers::Control::ModifyFeature.new(:edit_access_point_layer, :mode => 8, :autoActivate => true))
+ else
+ page << map.add_control( hover_control_display_name(:parent_layer) )
end
page << map.set_center(center.to_google.to_openlayers, 16, false, true)
diff --git a/app/maps/stop_area_map.rb b/app/maps/stop_area_map.rb
index 3e172c523..2fc329dce 100644
--- a/app/maps/stop_area_map.rb
+++ b/app/maps/stop_area_map.rb
@@ -17,15 +17,26 @@ class StopAreaMap < ApplicationMap
page << map.add_layer(google_hybrid)
page << map.add_layer(google_satellite)
- page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => StyleMap::EditStopAreaStyleMap.new(helpers).style_map)
- page << map.add_layer(:edit_stop_area_layer)
+ if stop_area.children.present?
+ page.assign "children_layer", kml_layer(stop_area, { :children => true }, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map)
+ page << map.add_layer(:children_layer)
+ end
+ if stop_area.routing_stops.present?
+ page.assign "routing_layer", kml_layer(stop_area, { :routing => true }, :style_map => StyleMap::StopAreasStyleMap.new(helpers).style_map)
+ page << map.add_layer(:routing_layer)
+ page << map.add_control( hover_control_display_name(:routing_layer) )
+ page << map.zoom_to_extent(bounds.to_google.to_openlayers) if bounds
+ else
+
+ page.assign "edit_stop_area_layer", kml_layer(stop_area, { :default => editable? }, :style_map => StyleMap::EditStopAreaStyleMap.new(helpers).style_map)
+ page << map.add_layer(:edit_stop_area_layer)
- if editable?
- page.assign "referential_projection", projection_type.present? ? projection("EPSG:" + projection_type) : JsVar.new("undefined")
- # TODO virer ce code inline
- page << <<EOF
- edit_stop_area_layer.events.on({
+ if editable?
+ page.assign "referential_projection", projection_type.present? ? projection("EPSG:" + projection_type) : JsVar.new("undefined")
+ # TODO virer ce code inline
+ page << <<EOF
+ edit_stop_area_layer.events.on({
'afterfeaturemodified': function(event) {
geometry = event.feature.geometry.clone().transform(new OpenLayers.Projection("EPSG:900913"), new OpenLayers.Projection("EPSG:4326"));
$('#stop_area_longitude').val(geometry.x);
@@ -39,11 +50,14 @@ class StopAreaMap < ApplicationMap
}
});
EOF
- page << map.add_control(OpenLayers::Control::ModifyFeature.new(:edit_stop_area_layer, :mode => 8, :autoActivate => true))
+ page << map.add_control(OpenLayers::Control::ModifyFeature.new(:edit_stop_area_layer, :mode => 8, :autoActivate => true))
+ elsif stop_area.children.present?
+ page << map.add_control( hover_control_display_name(:children_layer) )
- end
+ end
- page << map.set_center(center.to_google.to_openlayers, 16, false, true)
+ page << map.set_center(center.to_google.to_openlayers, 16, false, true)
+ end
end
end
@@ -59,4 +73,9 @@ EOF
stop_area.geometry or stop_area.default_position
end
+ def bounds
+ # for ITL only
+ @bounds ||= GeoRuby::SimpleFeatures::Point.bounds(stop_area.routing_stops.collect(&:geometry).compact)
+ end
+
end
diff --git a/app/maps/style_map/access_link_style_map.rb b/app/maps/style_map/access_link_style_map.rb
new file mode 100644
index 000000000..07ef5952b
--- /dev/null
+++ b/app/maps/style_map/access_link_style_map.rb
@@ -0,0 +1,43 @@
+class StyleMap::AccessLinkStyleMap < StyleMap::GenericStyleMap
+ attr_accessor :style
+
+ def initialize(helpers,options = {})
+ @helpers= helpers
+ @style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ end
+
+ def default_style
+ {
+ :fontColor => "black",
+ :fontSize => "11px",
+ :fontWeight => "bold",
+ :labelAlign => "ct",
+ :labelXOffset => 0,
+ :labelYOffset => -10,
+ :strokeColor => "#000000",
+ :strokeOpacity => 1,
+ :strokeWidth => 3,
+ :strokeLineCap => "round",
+ :strokeDashstyle => "solid",
+ :externalGraphic => @helpers.assets_path_patch( "map/${positionType}.png"),
+ :graphicWidth => 36,
+ :graphicHeight => 36,
+ :graphicOpacity => 1,
+ :graphicXOffset => -18,
+ :graphicYOffset => -18,
+ :display => true
+ }
+ end
+
+ def context
+ context = {
+ :positionType => :" function(feature) { if (feature.attributes.departure != undefined) { return 'departure'; } else { return 'arrival'; }} "
+ }
+ end
+
+ def style_map
+ OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}))
+ end
+
+end
+
diff --git a/app/maps/style_map/access_points_style_map.rb b/app/maps/style_map/access_points_style_map.rb
index c3bf2586f..57cf8dfb3 100644
--- a/app/maps/style_map/access_points_style_map.rb
+++ b/app/maps/style_map/access_points_style_map.rb
@@ -1,5 +1,5 @@
class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap
- attr_accessor :style, :context
+ attr_accessor :style, :context, :temporary
def default_style
raise "Helpers nil" if @helpers.nil?
@@ -9,7 +9,24 @@ class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap
:fontWeight => "bold",
:labelAlign => "ct",
:labelXOffset => 0,
- :labelYOffset => -40,
+ :labelYOffset => -20,
+ :pointRadius => 1,
+ :externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"),
+ :graphicWidth => 25,
+ :graphicHeight => 25,
+ :graphicOpacity => 1,
+ :graphicXOffset => -12.5,
+ :graphicYOffset => -12.5 }
+ end
+ def temporary_style
+ raise "Helpers nil" if @helpers.nil?
+ {:label => "${label}",
+ :fontColor => "darkblue",
+ :fontSize => "12px",
+ :fontWeight => "bold",
+ :labelAlign => "ct",
+ :labelXOffset => 0,
+ :labelYOffset => -20,
:pointRadius => 1,
:externalGraphic => @helpers.assets_path_patch( "map/access_${accessType}.png"),
:graphicWidth => 25,
@@ -22,18 +39,20 @@ class StyleMap::AccessPointsStyleMap < StyleMap::GenericStyleMap
def initialize(helpers,options = {})
@helpers= helpers
@style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style
end
def context
{
:label => :" function(feature) {if(feature.layer.map.getZoom() > 13) { return feature.attributes.name;} else {return '';}} ",
- :accessType => :" function(feature) { return feature.attributes.access_type.toLowerCase();} "
+ :accessType => :" function(feature) { return feature.attributes.access_point_type.toLowerCase();} "
}
end
def style_map
- OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}) )
+ OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}),
+ :temporary => OpenLayers::Style.new(temporary, { :context => context}) )
end
end
diff --git a/app/maps/style_map/stop_areas_style_map.rb b/app/maps/style_map/stop_areas_style_map.rb
index 398748a22..f23b58136 100644
--- a/app/maps/style_map/stop_areas_style_map.rb
+++ b/app/maps/style_map/stop_areas_style_map.rb
@@ -1,5 +1,5 @@
class StyleMap::StopAreasStyleMap < StyleMap::GenericStyleMap
- attr_accessor :style, :context
+ attr_accessor :style, :context, :temporary
def default_style
raise "Helpers nil" if @helpers.nil?
@@ -9,7 +9,7 @@ class StyleMap::StopAreasStyleMap < StyleMap::GenericStyleMap
:fontWeight => "bold",
:labelAlign => "ct",
:labelXOffset => 0,
- :labelYOffset => -40,
+ :labelYOffset => -20,
:pointRadius => 1,
:externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"),
:graphicWidth => 25,
@@ -18,10 +18,29 @@ class StyleMap::StopAreasStyleMap < StyleMap::GenericStyleMap
:graphicXOffset => -12.5,
:graphicYOffset => -12.5 }
end
+ def temporary_style
+ raise "Helpers nil" if @helpers.nil?
+ {:label => "${label}",
+ :fontColor => "darkblue",
+ :fontSize => "12px",
+ :fontWeight => "bold",
+ :labelAlign => "ct",
+ :labelXOffset => 0,
+ :labelYOffset => -20,
+ :pointRadius => 1,
+ :externalGraphic => @helpers.assets_path_patch( "map/${areaType}.png"),
+ :graphicWidth => 25,
+ :graphicHeight => 25,
+ :graphicOpacity => 1,
+ :graphicXOffset => -12.5,
+ :graphicYOffset => -12.5 }
+ end
+
def initialize(helpers,options = {})
@helpers= helpers
@style = options[:style].present? ? default_style.merge(options[:style]) : default_style
+ @temporary = options[:style].present? ? temporary_style.merge(options[:style]) : temporary_style
end
@@ -33,7 +52,8 @@ class StyleMap::StopAreasStyleMap < StyleMap::GenericStyleMap
end
def style_map
- OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}) )
+ OpenLayers::StyleMap.new(:default => OpenLayers::Style.new(style, { :context => context}),
+ :temporary => OpenLayers::Style.new(temporary, { :context => context}) )
end
end
diff --git a/app/views/access_links/show.html.erb b/app/views/access_links/show.html.erb
index aa049899a..a318a84c6 100644
--- a/app/views/access_links/show.html.erb
+++ b/app/views/access_links/show.html.erb
@@ -1,6 +1,7 @@
<%= title_tag t('access_links.show.title', :access_link => @access_link.name ) %>
<div class="access_link_show">
+ <%= @map.to_html %>
<div class="summary">
<p>
diff --git a/app/views/access_links/show.kml.erb b/app/views/access_links/show.kml.erb
new file mode 100644
index 000000000..25e4351b8
--- /dev/null
+++ b/app/views/access_links/show.kml.erb
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<kml xmlns="http://www.opengis.net/kml/2.2">
+ <Document>
+ <% if @access_link.geometry %>
+ <Placemark id="route_<%= @access_link.id %>" >
+ <name><%= @access_link.name %></name>
+ <%= @access_link.geometry.kml_representation.html_safe %>
+ </Placemark>
+ <Placemark id="<%= @access_link.access_point.id %>" >
+ <departure><%= @access_link.link_orientation_type == "access_point_to_stop_area" %></departure>
+ <%= @access_link.access_point.geometry.kml_representation.html_safe %>
+ </Placemark>
+ <Placemark id="<%= @access_link.stop_area.id %>" >
+ <arrival><%= @access_link.link_orientation_type == "access_point_to_stop_area" %></arrival>
+ <%= @access_link.stop_area.geometry.kml_representation.html_safe %>
+ </Placemark>
+ <% end %>
+ </Document>
+</kml>
+
diff --git a/app/views/access_points/show.html.erb b/app/views/access_points/show.html.erb
index 7b25d6b96..6361e2115 100644
--- a/app/views/access_points/show.html.erb
+++ b/app/views/access_points/show.html.erb
@@ -109,8 +109,6 @@
<%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@generic_access_links) %>
</table>
</div>
- <p><%= t('.access_link_legend_1') %></p>
- <p><%= t('.access_link_legend_2') %></p>
</div>
@@ -128,8 +126,6 @@
<%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@detail_access_links) %>
</table>
</div>
- <p><%= t('.access_link_legend_1') %></p>
- <p><%= t('.access_link_legend_2') %></p>
</div>
</div>
diff --git a/app/views/stop_areas/_form.html.erb b/app/views/stop_areas/_form.html.erb
index b5541cf20..5fca012f3 100644
--- a/app/views/stop_areas/_form.html.erb
+++ b/app/views/stop_areas/_form.html.erb
@@ -11,17 +11,19 @@
<%= form.input :nearest_topic_name %>
<%= form.input :comment %>
<%= form.input :objectid, :required => !@stop_area.new_record?, :input_html => { :disabled => !@stop_area.new_record? } %>
- <%= 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 %>
- <% end %>
- <% end %>
- <%= form.inputs :name => "WGS84" do %>
- <%= form.input :longitude %>
- <%= form.input :latitude %>
- <% end %>
+ <% if !manage_itl %>
+ <%= 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 %>
+ <% end %>
+ <% end %>
+ <%= form.inputs :name => "WGS84" do %>
+ <%= form.input :longitude %>
+ <%= form.input :latitude %>
+ <% end %>
+ <% end %>
<% end %>
<% end %>
diff --git a/app/views/stop_areas/access_links.html.erb b/app/views/stop_areas/access_links.html.erb
index da648eef6..d4727d7db 100644
--- a/app/views/stop_areas/access_links.html.erb
+++ b/app/views/stop_areas/access_links.html.erb
@@ -14,8 +14,6 @@
<%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@generic_access_links) %>
</table>
</div>
- <p><%= t('.access_link_legend_1') %></p>
- <p><%= t('.access_link_legend_2') %></p>
</div>
<h3 class="stop_area_generics">
<a class="details"><%= t('.detail_access_links') %>
@@ -30,8 +28,6 @@
<%= render :partial => "access_link_pairs/access_link_pair", :collection => access_links_pairs(@detail_access_links) %>
</table>
</div>
- <p><%= t('.access_link_legend_1') %></p>
- <p><%= t('.access_link_legend_2') %></p>
</div>
</div>
diff --git a/app/views/stop_areas/edit.html.erb b/app/views/stop_areas/edit.html.erb
index 1ec77056d..d08949104 100644
--- a/app/views/stop_areas/edit.html.erb
+++ b/app/views/stop_areas/edit.html.erb
@@ -1,5 +1,6 @@
<%= title_tag t('stop_areas.edit.title', :stop_area => @stop_area.name ) %>
-<%= @map.to_html %>
-
+<% if !manage_itl %>
+ <%= @map.to_html %>
+<% end %>
<%= render "form" %>
diff --git a/app/views/stop_areas/show.html.erb b/app/views/stop_areas/show.html.erb
index 310761a03..9d0db8af8 100644
--- a/app/views/stop_areas/show.html.erb
+++ b/app/views/stop_areas/show.html.erb
@@ -1,7 +1,7 @@
<%= title_tag t('stop_areas.show.title', :stop_area => @stop_area.name ) %>
<div class="stop_area_show">
- <% if @stop_area.projection_type != nil || @stop_area.long_lat_type != nil %>
+ <% if show_map? %>
<%= @map.to_html %>
<% end %>
<div class="summary">
@@ -37,37 +37,39 @@
<label><%= @stop_area.human_attribute_name("stop_area_type") %>: </label>
<%= t("area_types.label.#{@stop_area.stop_area_type}") %>
</p>
- <p> <label><%= t('stop_areas.show.geographic_data') %> </label></p>
- <% 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? %>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("projection_type") %>: </span>
- <%= @stop_area.projection_type %>
- </p>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("x") %>: </span>
- <%= @stop_area.x %>
- </p>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("y") %>: </span>
- <%= @stop_area.y %>
- </p>
- <% end %>
- <% if !@stop_area.long_lat_type.nil? %>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("long_lat_type") %>: </span>
- <%= @stop_area.long_lat_type %>
- </p>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("longitude") %>: </span>
- <%= @stop_area.longitude %>
- </p>
- <p>
- <span class='geo_data'><%= @stop_area.human_attribute_name("latitude") %>: </span>
- <%= @stop_area.latitude %>
- </p>
+ <% if !manage_itl %>
+ <p> <label><%= t('stop_areas.show.geographic_data') %> </label></p>
+ <% 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? %>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("projection_type") %>: </span>
+ <%= @stop_area.projection_type %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("x") %>: </span>
+ <%= @stop_area.x %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("y") %>: </span>
+ <%= @stop_area.y %>
+ </p>
+ <% end %>
+ <% if !@stop_area.long_lat_type.nil? %>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("long_lat_type") %>: </span>
+ <%= @stop_area.long_lat_type %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("longitude") %>: </span>
+ <%= @stop_area.longitude %>
+ </p>
+ <p>
+ <span class='geo_data'><%= @stop_area.human_attribute_name("latitude") %>: </span>
+ <%= @stop_area.latitude %>
+ </p>
+ <% end %>
<% end %>
<% end %>
<p>
diff --git a/app/views/stop_areas/show.kml.erb b/app/views/stop_areas/show.kml.erb
index 16613b6bc..39a764bd6 100644
--- a/app/views/stop_areas/show.kml.erb
+++ b/app/views/stop_areas/show.kml.erb
@@ -1,10 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document>
+ <% if !params["children"].nil? %>
+ <% @stop_area.children.each do |child| %>
+ <Placemark id="<%= child.id %>" >
+ <name><%= child.name %></name>
+ <stop_area_type><%= child.stop_area_type %></stop_area_type>
+ <%= (child.position or child.default_position).kml_representation.html_safe %>
+ </Placemark>
+ <% end %>
+ <% elsif !params["routing"].nil? %>
+ <% @stop_area.routing_stops.each do |child| %>
+ <Placemark id="<%= child.id %>" >
+ <name><%= child.name %></name>
+ <stop_area_type><%= child.stop_area_type %></stop_area_type>
+ <%= (child.position or child.default_position).kml_representation.html_safe %>
+ </Placemark>
+ <% end %>
+ <% else %>
<Placemark id="<%= @stop_area.id %>" >
<name><%= @stop_area.name %></name>
- <stop_area_type><%= @stop_area.type %></stop_area_type>
+ <stop_area_type><%= @stop_area.stop_area_type %></stop_area_type>
<%= (@stop_area.position or @stop_area.default_position).kml_representation.html_safe %>
</Placemark>
+ <% end %>
</Document>
</kml>