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 <% elsif map.instance_of? MapBug %>
42 var centre = new OpenLayers.LonLat(<%= map.lon %>, <%= map.lat %>);
44 setMapCenter(centre, 16);
45 addMarkerToMap(centre);
47 $("loading").innerHTML = "";
49 $("area_larger_map").href = '/?mlon=<%= map.lon %>&mlat=<%=map.lat %>';
50 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
52 var obj_type = "<%= map.class.name.downcase %>";
53 var obj_id = <%= map.id %>;
54 var obj_version = <%= map.version %>;
55 var obj_visible = <%= map.visible %>;
56 var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
58 if (obj_type != "node") {
60 } else if (!obj_visible) {
61 var previous_version = obj_version - 1;
62 url += "/" + previous_version;
65 addObjectToMap(url, true, function(extent) {
66 $("loading").innerHTML = "";
69 extent.transform(map.getProjectionObject(), map.displayProjection);
71 $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
72 $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
74 <% unless map.instance_of? Changeset %>
75 $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
76 $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
79 $("small_map").style.display = "none";