<%= javascript_include_tag '/openlayers/OpenLayers.js' %>
<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'map.js' %>
-<td align="right">
- <% if map.instance_of? Changeset or map.visible %>
- <div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
- </div>
- <span id="loading"><%= t 'browse.map.loading' %></span>
- <a id="larger_map" href=""></a>
- <br />
- <a id="main_map" href=""></a>
- <% else %>
- <%= t 'browse.map.deleted' %>
- <% end %>
+<td>
+ <div style="width: 250px; margin: auto; text-align: right"">
+ <% if map.instance_of? Changeset or map.visible %>
+ <div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
+ </div>
+ <span id="loading"><%= t 'browse.map.loading' %></span>
+ <a id="area_larger_map" href=""></a>
+ <% unless map.instance_of? Changeset %>
+ <br />
+ <a id="object_larger_map" href=""></a>
+ <% end %>
+ <% else %>
+ <%= t 'browse.map.deleted' %>
+ <% end %>
+ </div>
</td>
<% if map.instance_of? Changeset or map.visible %>
<script type="text/javascript">
$("loading").innerHTML = "";
- $("larger_map").href = '<%= url_for :controller => 'browse', :action => (map.class.to_s.downcase + '_map'), :id => map.id, :only_path => true %>';
- $("larger_map").innerHTML = "<%= t 'browse.map.view_larger_map' %>";
-
- $("main_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
- $("main_map").innerHTML = "<%= t 'browse.map.view_main_map' %>";
+ $("area_larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
+ $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
<% else %>
var obj_type = "<%= map.class.name.downcase %>";
var obj_id = <%= map.id %>;
url += "/full";
}
- var osm_layer = new OpenLayers.Layer.GML("OSM", url, {
- format: OpenLayers.Format.OSM,
- projection: new OpenLayers.Projection("EPSG:4326")
- });
-
- osm_layer.events.register("loadend", osm_layer, function() {
+ addObjectToMap(url, true, function(extent) {
$("loading").innerHTML = "";
- if (this.features.length) {
- var extent = this.features[0].geometry.getBounds();
-
- for (var i = 1; i < this.features.length; i++) {
- extent.extend(this.features[i].geometry.getBounds());
- }
+ if (extent) {
+ extent.transform(map.getProjectionObject(), map.displayProjection);
- if (extent) {
- this.map.zoomToExtent(extent);
- } else {
- this.map.zoomToMaxExtent();
- }
+ $("area_larger_map").href = '/?minlon='+extent.left+'&minlat='+extent.bottom+'&maxlon='+extent.right+'&maxlat='+extent.top;
+ $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
- var center = getMapCenter();
-
- $("larger_map").href = '<%= url_for :controller => 'browse', :action => (map.class.to_s.downcase + '_map'), :id => map.id, :only_path => true %>';
- $("larger_map").innerHTML = "<%= t 'browse.map.view_larger_map' %>";
-
- $("main_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
- $("main_map").innerHTML = "<%= t 'browse.map.view_main_map' %>";
+ <% unless map.instance_of? Changeset %>
+ $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
+ $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
+ <% end %>
} else {
$("small_map").style.display = "none";
}
});
-
- map.addLayer(osm_layer);
-
- osm_layer.loadGML();
- osm_layer.loaded = true;
<% end %>
}