aboutsummaryrefslogtreecommitdiffstats
path: root/app/maps/application_map.rb
diff options
context:
space:
mode:
authorLuc Donnet2012-03-21 17:20:15 +0100
committerLuc Donnet2012-03-21 17:20:15 +0100
commit64fd52a1ba9a29c19409cd9778eed44e6e14fb33 (patch)
tree65abd2d50afb4717c032e3e7a8589ff2f13e7bd6 /app/maps/application_map.rb
parente63f0bc88eda8c5907d5dd4a312052b0e5c8f5ce (diff)
downloadchouette-core-64fd52a1ba9a29c19409cd9778eed44e6e14fb33.tar.bz2
Add features for line map
Diffstat (limited to 'app/maps/application_map.rb')
-rw-r--r--app/maps/application_map.rb32
1 files changed, 27 insertions, 5 deletions
diff --git a/app/maps/application_map.rb b/app/maps/application_map.rb
index c5546f4d9..ed523eebe 100644
--- a/app/maps/application_map.rb
+++ b/app/maps/application_map.rb
@@ -9,12 +9,17 @@ class ApplicationMap
OpenLayers::Projection.new(name)
end
- def id
- "map"
+ def controls
+ [ OpenLayers::Control::LayerSwitcher.new(:ascending => true),
+ OpenLayers::Control::ScaleLine.new,
+ OpenLayers::Control::Navigation.new,
+ OpenLayers::Control::PanZoomBar.new,
+ OpenLayers::Control::Attribution.new
+ ]
end
- def controls
- []
+ def id
+ "map"
end
def map
@@ -41,10 +46,27 @@ class ApplicationMap
OpenLayers::Strategy::Fixed.new :preload => true
end
+ def google_physical
+ OpenLayers::Layer::Google.new("Google Physical",
+ :type => :"google.maps.MapTypeId.TERRAIN")
+ end
+
+ def google_streets
+ OpenLayers::Layer::Google.new "Google Streets", :numZoomLevels => 20
+ end
+
+ def google_hybrid
+ OpenLayers::Layer::Google.new "Google Hybrid", :type => :"google.maps.MapTypeId.HYBRID", :numZoomLevels => 20
+ end
+
+ def google_satellite
+ OpenLayers::Layer::Google.new "Google Satellite", :type => :"google.maps.MapTypeId.SATELLITE", :numZoomLevels => 22
+ end
+
def kml_layer(url, options = {})
url = polymorphic_path([url.referential, url], :format => :kml) unless String === url
protocol = OpenLayers::Protocol::HTTP.new :url => url, :format => kml
- OpenLayers::Layer::Vector.new name, {:projection => projection("EPSG:4326"), :strategies => [strategy_fixed], :protocol => protocol}.merge(options)
+ OpenLayers::Layer::Vector.new name, {:projection => projection("EPSG:4326"), :strategies => [strategy_fixed], :protocol => protocol, :displayInLayerSwitcher => false}.merge(options)
end
end