Merge remote-tracking branch 'upstream/master' into utfgrid

This commit is contained in:
Matthew Perry
2012-02-04 17:03:25 -08:00
29 changed files with 281 additions and 232 deletions
+6 -6
View File
@@ -359,7 +359,8 @@ OpenLayers.Bounds = OpenLayers.Class({
* APIMethod: containsLonLat
*
* Parameters:
* ll - {<OpenLayers.LonLat>}
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* options - {Object} Optional parameters
*
* Acceptable options:
@@ -382,13 +383,12 @@ OpenLayers.Bounds = OpenLayers.Class({
worldBounds = options.worldBounds;
if (worldBounds && !contains) {
var worldWidth = worldBounds.getWidth();
ll = ll.clone();
var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
ll.lon -= (worldsAway * worldWidth);
contains = this.containsLonLat(
ll, {inclusive: options.inclusive}
);
contains = this.containsLonLat({
lon: ll.lon - worldsAway * worldWidth,
lat: ll.lat
}, {inclusive: options.inclusive});
}
return contains;
},
+5 -4
View File
@@ -62,6 +62,7 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
* evt - {Event}
*/
defaultKeyPress: function (evt) {
var size;
switch(evt.keyCode) {
case OpenLayers.Event.KEY_LEFT:
this.map.pan(-this.slideFactor, 0);
@@ -77,19 +78,19 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
break;
case 33: // Page Up. Same in all browsers.
var size = this.map.getSize();
size = this.map.getSize();
this.map.pan(0, -0.75*size.h);
break;
case 34: // Page Down. Same in all browsers.
var size = this.map.getSize();
size = this.map.getSize();
this.map.pan(0, 0.75*size.h);
break;
case 35: // End. Same in all browsers.
var size = this.map.getSize();
size = this.map.getSize();
this.map.pan(0.75*size.w, 0);
break;
case 36: // Home. Same in all browsers.
var size = this.map.getSize();
size = this.map.getSize();
this.map.pan(-0.75*size.w, 0);
break;
+10 -7
View File
@@ -628,12 +628,14 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* translated into pixel bounds for the overview map
*/
getRectBoundsFromMapBounds: function(lonLatBounds) {
var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left,
lonLatBounds.bottom);
var rightTopLonLat = new OpenLayers.LonLat(lonLatBounds.right,
lonLatBounds.top);
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);
var leftBottomPx = this.getOverviewPxFromLonLat({
lon: lonLatBounds.left,
lat: lonLatBounds.bottom
});
var rightTopPx = this.getOverviewPxFromLonLat({
lon: lonLatBounds.right,
lat: lonLatBounds.top
});
var bounds = null;
if (leftBottomPx && rightTopPx) {
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
@@ -699,7 +701,8 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
* Get a pixel location from a map location
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
*
* Returns:
* {Object} Location which is the passed-in OpenLayers.LonLat,
+16 -12
View File
@@ -232,9 +232,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
this.dragControl.deactivate();
deactivated = true;
}
if (deactivated) {
this.unsetFeature();
}
return deactivated;
},
@@ -335,7 +332,7 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
var control = this;
this.center = new OpenLayers.Geometry.Point(0, 0);
var box = new OpenLayers.Feature.Vector(
this.box = new OpenLayers.Feature.Vector(
new OpenLayers.Geometry.LineString([
new OpenLayers.Geometry.Point(-1, -1),
new OpenLayers.Geometry.Point(0, -1),
@@ -351,7 +348,7 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
);
// Override for box move - make sure that the center gets updated
box.geometry.move = function(x, y) {
this.box.geometry.move = function(x, y) {
control._moving = true;
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);
control.center.move(x, y);
@@ -468,14 +465,17 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
var handles = new Array(8);
var rotationHandles = new Array(4);
var geom, handle, rotationHandle;
var positions = ["sw", "s", "se", "e", "ne", "n", "nw", "w"];
for(var i=0; i<8; ++i) {
geom = box.geometry.components[i];
handle = new OpenLayers.Feature.Vector(geom.clone(), null,
typeof this.renderIntent == "string" ? null :
geom = this.box.geometry.components[i];
handle = new OpenLayers.Feature.Vector(geom.clone(), {
role: positions[i] + "-resize"
}, typeof this.renderIntent == "string" ? null :
this.renderIntent);
if(i % 2 == 0) {
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(),
null, typeof this.rotationHandleSymbolizer == "string" ?
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(), {
role: positions[i] + "-rotate"
}, typeof this.rotationHandleSymbolizer == "string" ?
null : this.rotationHandleSymbolizer);
rotationHandle.geometry.move = rotationHandleMoveFn;
geom._rotationHandle = rotationHandle;
@@ -489,7 +489,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
handles[i] = handle;
}
this.box = box;
this.rotationHandles = rotationHandles;
this.handles = handles;
},
@@ -514,7 +513,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
onDrag: function(feature, pixel) {
if(feature === control.box) {
control.transformFeature({center: control.center});
control.drawHandles();
}
},
// set a new feature
@@ -600,10 +598,16 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
geom._rotationHandle && geom._rotationHandle.destroy();
geom._rotationHandle = null;
}
this.center = null;
this.feature = null;
this.handles = null;
this.rotationHandleSymbolizer = null;
this.rotationHandles = null;
this.box.destroy();
this.box = null;
this.layer = null;
this.dragControl.destroy();
this.dragControl = null;
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
+2 -2
View File
@@ -25,7 +25,7 @@
OpenLayers.Events.buttonclick = OpenLayers.Class({
/**
* APIProperty: target
* Property: target
* {<OpenLayers.Events>} The events instance that the buttonclick event will
* be triggered on.
*/
@@ -141,4 +141,4 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
return propagate;
}
});
});
+2 -1
View File
@@ -267,7 +267,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
* Determins whether the feature intersects with the specified location.
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
*
@@ -255,7 +255,7 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML,
"*": function(node, obj) {
var name = node.localName || node.nodeName.split(":").pop();
if (!(OpenLayers.Util.isArray(obj[name]))) {
obj[name] = new Array();
obj[name] = [];
}
var dc_element = {};
var attrs = node.attributes;
@@ -273,7 +273,7 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML,
"*": function(node, obj) {
var name = node.localName || node.nodeName.split(":").pop();
if (!(OpenLayers.Util.isArray(obj[name]))) {
obj[name] = new Array();
obj[name] = [];
}
obj[name].push(this.getChildValue(node));
}
+1 -1
View File
@@ -228,7 +228,7 @@ OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
}
});
if (address.freeFormAddress) {
this.writeNode("freeFormAddess", address.freeFormAddress, node);
this.writeNode("freeFormAddress", address.freeFormAddress, node);
} else {
if (address.street) {
this.writeNode("StreetAddress", address, node);
+2 -1
View File
@@ -176,7 +176,8 @@ OpenLayers.Geometry = OpenLayers.Class({
* geometry.
*
* Parameters:
* lonlat - {<OpenLayers.LonLat>}
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* toleranceLon - {float} Optional tolerance in Geometric Coords
* toleranceLat - {float} Optional tolerance in Geographic Coords
*
+3 -9
View File
@@ -205,12 +205,10 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
* Parameters:
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
* request.
* scope - {Object} The scope of the callback method.
* prop - {String} The name of the property in the scoped object to
* recieve the image url.
* callback - {Function} Function to call when image url is retrieved.
* scope - {Object} The scope of the callback method.
*/
getURLasync: function(bounds, scope, prop, callback) {
getURLasync: function(bounds, callback, scope) {
bounds = this.adjustBounds(bounds);
// create an arcxml request to generate the image
@@ -239,11 +237,7 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
var axlResp = new OpenLayers.Format.ArcXML();
var arcxml = axlResp.read(doc);
scope[prop] = this.getUrlOrImage(arcxml.image.output);
// call the callback function to recieve the updated property on the
// scoped object
callback.apply(scope);
callback.call(scope, this.getUrlOrImage(arcxml.image.output));
},
scope: this
});
-3
View File
@@ -25,9 +25,6 @@ OpenLayers.Layer.Boxes = OpenLayers.Class(OpenLayers.Layer.Markers, {
* name - {String}
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function (name, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
},
/**
* Method: drawMarker
+1 -1
View File
@@ -77,7 +77,7 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
*/
initResolutions: function() {
var props = new Array('minZoomLevel', 'maxZoomLevel', 'numZoomLevels');
var props = ['minZoomLevel', 'maxZoomLevel', 'numZoomLevels'];
for(var i=0, len=props.length; i<len; i++) {
var property = props[i];
+4 -4
View File
@@ -677,8 +677,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* Generate parameters for the grid layout.
*
* Parameters:
* bounds - {<OpenLayers.Bound>}
* origin - {<OpenLayers.LonLat>}
* bounds - {<OpenLayers.Bound>|Object} OpenLayers.Bounds or an
* object with a 'left' and 'top' properties.
* origin - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
* object with a 'lon' and 'lat' properties.
* resolution - {Number}
*
* Returns:
@@ -686,8 +688,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
* tileoffsetlat, tileoffsetx, tileoffsety
*/
calculateGridLayout: function(bounds, origin, resolution) {
bounds = bounds.clone();
var tilelon = resolution * this.tileSize.w;
var tilelat = resolution * this.tileSize.h;
+1 -3
View File
@@ -39,9 +39,7 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, {
* options - {Object} Hashtable of extra options to tag onto the layer
*/
initialize: function(name, url, params, options) {
var newArguments = [];
newArguments.push(name, url, params, options);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
OpenLayers.Layer.Grid.prototype.initialize.apply(this, arguments);
this.params = OpenLayers.Util.applyDefaults(
this.params, this.DEFAULT_PARAMS
-3
View File
@@ -44,9 +44,6 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
* options - {Object} Optional object with properties to tag onto the
* instance.
*/
initialize: function(name, options) {
OpenLayers.Layer.Vector.prototype.initialize.apply(this, arguments);
},
/**
* APIMethod: addNodes
+1 -1
View File
@@ -80,7 +80,7 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
*/
initialize: function(name, options) {
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
this.features = new Array();
this.features = [];
},
/**
-6
View File
@@ -21,12 +21,6 @@
*/
OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
* Property: url
* {String} URL for root directory with TileGroupX subdirectories.
*/
url: null,
/**
* Property: size
* {<OpenLayers.Size>} The Zoomify image size in pixels.
+5
View File
@@ -1161,6 +1161,11 @@ OpenLayers.Map = OpenLayers.Class({
if(!this.allOverlays || this.baseLayer.visibility) {
this.baseLayer.setVisibility(true);
// Layer may previously have been visible but not in range.
// In this case we need to redraw it to make it visible.
if (this.baseLayer.inRange === false) {
this.baseLayer.redraw();
}
}
// recenter the map
+33 -2
View File
@@ -38,6 +38,30 @@ OpenLayers.Tile = OpenLayers.Class({
*/
events: null,
/**
* APIProperty: eventListeners
* {Object} If set as an option at construction, the eventListeners
* object will be registered with <OpenLayers.Events.on>. Object
* structure must be a listeners object as shown in the example for
* the events.on method.
*
* This options can be set in the ``tileOptions`` option from
* <OpenLayers.Layer.Grid>. For example, to be notified of the
* ``loadend`` event of each tiles:
* (code)
* new OpenLayers.Layer.OSM('osm', 'http://tile.openstreetmap.org/${z}/${x}/${y}.png', {
* tileOptions: {
* eventListeners: {
* 'loadend': function(evt) {
* // do something on loadend
* }
* }
* }
* });
* (end)
*/
eventListeners: null,
/**
* Property: id
* {String} null
@@ -109,10 +133,13 @@ OpenLayers.Tile = OpenLayers.Class({
//give the tile a unique id based on its BBOX.
this.id = OpenLayers.Util.createUniqueID("Tile_");
this.events = new OpenLayers.Events(this);
OpenLayers.Util.extend(this, options);
this.events = new OpenLayers.Events(this);
if (this.eventListeners instanceof Object) {
this.events.on(this.eventListeners);
}
},
/**
@@ -139,7 +166,11 @@ OpenLayers.Tile = OpenLayers.Class({
this.size = null;
this.position = null;
if (this.eventListeners) {
this.events.un(this.eventListeners);
}
this.events.destroy();
this.eventListeners = null;
this.events = null;
},
+6 -7
View File
@@ -168,15 +168,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
this.layer.div.appendChild(this.getTile());
if (this.layer.async) {
// Asynchronous image requests call the asynchronous getURL method
// on the layer to fetch an image that covers 'this.bounds', in the scope of
// 'this', setting the 'url' property of the layer itself, and running
// the callback 'initImage' when the image request returns.
var myId = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
this.layer.getURLasync(this.bounds, this, "url", function() {
if (myId == this.asyncRequestId) {
// on the layer to fetch an image that covers 'this.bounds'.
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
this.layer.getURLasync(this.bounds, function(url) {
if (id == this.asyncRequestId) {
this.url = url;
this.initImage();
}
});
}, this);
} else {
// synchronous image requests get the url immediately.
this.url = this.layer.getURL(this.bounds);