new support for box=yes param on the homepage, and then link to this from various changeset display
This commit is contained in:
parent
1f8a68371a
commit
fdd5d2d779
7 changed files with 67 additions and 21 deletions
|
@ -37,18 +37,25 @@
|
|||
<th>Bounding box:</th>
|
||||
<% if changeset_details.max_lat.nil? or changeset_details.min_lat.nil? or changeset_details.max_lon.nil? or changeset_details.min_lon.nil? %>
|
||||
<td>No bounding box has been stored for this changeset.</td>
|
||||
<% else %>
|
||||
<%
|
||||
else
|
||||
minlon = changeset_details.min_lon/GeoRecord::SCALE.to_f
|
||||
minlat = changeset_details.min_lat/GeoRecord::SCALE.to_f
|
||||
maxlon = changeset_details.max_lon/GeoRecord::SCALE.to_f
|
||||
maxlat = changeset_details.max_lat/GeoRecord::SCALE.to_f
|
||||
%>
|
||||
<td>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center"><%= changeset_details.max_lat/GeoRecord::SCALE.to_f -%></td>
|
||||
<td colspan="3" style="text-align:center"><%=maxlat -%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%= changeset_details.min_lon/GeoRecord::SCALE.to_f -%></td>
|
||||
<td><%= changeset_details.max_lon/GeoRecord::SCALE.to_f -%></td>
|
||||
<td><%=minlon -%></td>
|
||||
<td>(<a href='/?minlon=<%= minlon %>&minlat=<%= minlat %>&maxlon=<%= maxlon %>&maxlat=<%= maxlat %>&box=yes' title='show area box'>box</a>)</td>
|
||||
<td><%=maxlon -%></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align:center"><%= changeset_details.min_lon/GeoRecord::SCALE.to_f -%></td>
|
||||
<td colspan="3" style="text-align:center"><%= minlon -%></td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
|
@ -33,13 +33,12 @@
|
|||
<% if changeset.min_lat.nil? %>
|
||||
(no edits)
|
||||
<% else
|
||||
lat1 = changeset.min_lat/GeoRecord::SCALE.to_f
|
||||
lat2 = changeset.max_lat/GeoRecord::SCALE.to_f
|
||||
lon1 = changeset.min_lon/GeoRecord::SCALE.to_f
|
||||
lon2 = changeset.max_lon/GeoRecord::SCALE.to_f
|
||||
minlon = changeset.min_lon/GeoRecord::SCALE.to_f
|
||||
minlat = changeset.min_lat/GeoRecord::SCALE.to_f
|
||||
maxlon = changeset.max_lon/GeoRecord::SCALE.to_f
|
||||
maxlat = changeset.max_lat/GeoRecord::SCALE.to_f
|
||||
%>
|
||||
(<a href='/?lat=<%= lat1 %>&lon=<%= lon1 %>&zoom=14'><%= format("%0.3f",lat1) -%>,<%= format("%0.3f",lon1) -%></a>) to
|
||||
(<a href='/?lat=<%= lat2 %>&lon=<%= lon2 %>&zoom=14'><%= format("%0.3f",lat2) -%>,<%= format("%0.3f",lon2) -%></a>)
|
||||
(<a href='/?minlon=<%= minlon %>&minlat=<%= minlat %>&maxlon=<%= maxlon %>&maxlat=<%= maxlat %>&box=yes' title='show area box'><%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%></a>)
|
||||
<% end %>
|
||||
</td>
|
||||
|
||||
|
|
|
@ -16,4 +16,4 @@
|
|||
<p>
|
||||
For more changesets, select a user and view their edits, or see the editing 'history' of a specific area.
|
||||
</p>
|
||||
|
||||
<br>
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
<h1>History</h1>
|
||||
<%
|
||||
if @bbox!=nil
|
||||
lon1 = @bbox[0]
|
||||
lat1 = @bbox[1]
|
||||
lon2 = @bbox[2]
|
||||
lat2 = @bbox[3]
|
||||
minlon = @bbox[0]
|
||||
minlat = @bbox[1]
|
||||
maxlon = @bbox[2]
|
||||
maxlat = @bbox[3]
|
||||
|
||||
%>
|
||||
<p>
|
||||
Changesets within the area:
|
||||
(<a href='/?lat=<%= lat1 %>&lon=<%= lon1 %>&zoom=14'><%= format("%0.3f",lat1) -%>,<%= format("%0.3f",lon1) -%></a>) to
|
||||
(<a href='/?lat=<%= lat2 %>&lon=<%= lon2 %>&zoom=14'><%= format("%0.3f",lat2) -%>,<%= format("%0.3f",lon2) -%></a>)
|
||||
(<a href='/?minlon=<%= minlon %>&minlat=<%= minlat %>&maxlon=<%= maxlon %>&maxlat=<%= maxlat %>&box=yes' title='show area box'><%= format("%0.3f",minlon) -%>,<%= format("%0.3f",minlat) -%>,<%= format("%0.3f",maxlon) -%>,<%= format("%0.3f",maxlat) -%></a>)
|
||||
|
||||
</p>
|
||||
|
||||
<% if @edits.nil? or @edits.empty? %>
|
||||
|
@ -32,6 +32,9 @@ Changesets within the area:
|
|||
</table>
|
||||
|
||||
<%= render :partial => 'changeset_paging_nav' %>
|
||||
|
||||
<p>For all changes everywhere see <%= link_to("Recent Changes", :controller => "browse", :action => "changesets") %> </p>
|
||||
|
||||
<%
|
||||
end
|
||||
|
||||
|
@ -47,4 +50,4 @@ else
|
|||
end
|
||||
%>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -16,3 +16,7 @@
|
|||
</table>
|
||||
<%= render :partial => 'changeset_paging_nav' %>
|
||||
<% end %>
|
||||
|
||||
<p>For changes by all users see <%= link_to("Recent Changes", :controller => "browse", :action => "changesets") %> </p>
|
||||
<br>
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ if params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat
|
|||
minlat = h(params['minlat'])
|
||||
maxlon = h(params['maxlon'])
|
||||
maxlat = h(params['maxlat'])
|
||||
box = true if params['box']=="yes"
|
||||
end
|
||||
|
||||
# Decide on a lat lon to initialise the map with. Various ways of doing this
|
||||
|
@ -109,13 +110,16 @@ end
|
|||
var bbox = new OpenLayers.Bounds(<%= minlon %>, <%= minlat %>, <%= maxlon %>, <%= maxlat %>);
|
||||
|
||||
setMapExtent(bbox);
|
||||
<% if box %>
|
||||
box = addBoxToMap(bbox);
|
||||
<% end %>
|
||||
<% else %>
|
||||
var centre = new OpenLayers.LonLat(<%= lon %>, <%= lat %>);
|
||||
var zoom = <%= zoom %>;
|
||||
|
||||
<% if params['scale'] and params['scale'].length > 0 then %>
|
||||
<% if params['scale'] and params['scale'].length > 0 then %>
|
||||
zoom = scaleToZoom(<%= params['scale'].to_f() %>);
|
||||
<% end %>
|
||||
<% end %>
|
||||
|
||||
setMapCenter(centre, zoom);
|
||||
<% end %>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
var epsg4326 = new OpenLayers.Projection("EPSG:4326");
|
||||
var map;
|
||||
var markers;
|
||||
var vectors;
|
||||
var popup;
|
||||
|
||||
var nonamekeys = {
|
||||
|
@ -82,6 +83,17 @@ function createMap(divName, options) {
|
|||
projection: "EPSG:900913"
|
||||
});
|
||||
map.addLayer(markers);
|
||||
|
||||
vectors = new OpenLayers.Layer.Vector("Vectors", {
|
||||
displayInLayerSwitcher: false,
|
||||
numZoomLevels: numZoomLevels,
|
||||
maxExtent: new OpenLayers.Bounds(-20037508,-20037508,20037508,20037508),
|
||||
maxResolution: 156543,
|
||||
units: "m",
|
||||
projection: "EPSG:900913"
|
||||
});
|
||||
map.addLayer(vectors);
|
||||
|
||||
|
||||
return map;
|
||||
}
|
||||
|
@ -106,6 +118,19 @@ function addMarkerToMap(position, icon, description) {
|
|||
return marker;
|
||||
}
|
||||
|
||||
function addBoxToMap(boxbounds) {
|
||||
box = new OpenLayers.Feature.Vector(
|
||||
boxbounds.toGeometry().transform(new OpenLayers.Projection("EPSG:4326"), map.getProjectionObject()) );
|
||||
|
||||
box.style = {
|
||||
'strokeWidth': 3,
|
||||
'strokeColor': '#0000ff',
|
||||
'fillOpacity': 0,
|
||||
};
|
||||
vectors.addFeatures(box);
|
||||
return box;
|
||||
}
|
||||
|
||||
function openMapPopup(marker, description) {
|
||||
closeMapPopup();
|
||||
|
||||
|
@ -129,6 +154,10 @@ function removeMarkerFromMap(marker){
|
|||
markers.removeMarker(marker);
|
||||
}
|
||||
|
||||
function removeBoxFromMap(box){
|
||||
vectors.removeFeature(box);
|
||||
}
|
||||
|
||||
function getMapCenter(center, zoom) {
|
||||
return map.getCenter().clone().transform(map.getProjectionObject(), epsg4326);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue