Add a map to the changeset list page

Add a map to the changeset list page, with a bounding box for each
changeset and highighting when the mouse is placed over either a box
on the map or a row of the table.
This commit is contained in:
Mikel Maron 2011-04-30 15:07:47 -05:00 committed by Tom Hughes
parent 39f17cfbe1
commit 48929e8781
7 changed files with 116 additions and 10 deletions

View file

@ -149,7 +149,7 @@ function addObjectToMap(url, zoom, callback) {
layer.loadGML();
}
function addBoxToMap(boxbounds) {
function addBoxToMap(boxbounds, attributes, line) {
if (!vectors) {
// Be aware that IE requires Vector layers be initialised on page load, and not under deferred script conditions
vectors = new OpenLayers.Layer.Vector("Boxes", {
@ -157,8 +157,16 @@ function addBoxToMap(boxbounds) {
});
map.addLayer(vectors);
}
var geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject());
var box = new OpenLayers.Feature.Vector(geometry, {}, {
var geometry;
if (line) {
vertices = boxbounds.toGeometry().getVertices();
vertices.push( new OpenLayers.Geometry.Point( vertices[0].x, vertices[0].y ) );
geometry = new OpenLayers.Geometry.LineString(vertices).transform(epsg4326, map.getProjectionObject());
} else {
geometry = boxbounds.toGeometry().transform(epsg4326, map.getProjectionObject());
}
var box = new OpenLayers.Feature.Vector(geometry, attributes, {
strokeWidth: 2,
strokeColor: '#ee9900',
fillOpacity: 0