1 <%= javascript_include_tag '/openlayers/OpenLayers.js' %>
2 <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
3 <%= javascript_include_tag 'map.js' %>
5 <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
8 <span id="loading"><%= t 'browse.map.loading' %></span>
9 <a id="area_larger_map" href=""></a>
10 <% unless map.instance_of? Changeset %>
12 <a id="object_larger_map" href=""></a>
15 <%= t 'browse.map.deleted' %>
18 <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
19 <script type="text/javascript">
20 OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
23 var map = createMap("small_map", {
24 controls: [ new OpenLayers.Control.Navigation() ]
27 <% if map.instance_of? Changeset %>
28 var minlon = <%= map.min_lon / GeoRecord::SCALE.to_f %>;
29 var minlat = <%= map.min_lat / GeoRecord::SCALE.to_f %>;
30 var maxlon = <%= map.max_lon / GeoRecord::SCALE.to_f %>;
31 var maxlat = <%= map.max_lat / GeoRecord::SCALE.to_f %>;
32 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
37 $("loading").innerHTML = "";
39 $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
40 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
41 <% else if map.instance_of? MapBug %>
42 $("loading").innerHTML = "";
43 var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>);
45 setMapCenter(centre, zoom);
46 marker = addMarkerToMap(centre);
47 $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>';
48 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
50 var obj_type = "<%= map.class.name.downcase %>";
51 var obj_id = <%= map.id %>;
52 var obj_version = <%= map.version %>;
53 var obj_visible = <%= map.visible %>;
54 var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
56 if (obj_type != "node") {
58 } else if (!obj_visible) {
59 var previous_version = obj_version - 1;
60 url += "/" + previous_version;
63 addObjectToMap(url, true, function(extent) {
64 $("loading").innerHTML = "";
67 extent.transform(map.getProjectionObject(), map.displayProjection);
69 $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
70 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
72 <% unless map.instance_of? Changeset %>
73 $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
74 $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
77 $("small_map").style.display = "none";