Merge remote-tracking branch 'upstream/master' into utfgrid
This commit is contained in:
@@ -5,6 +5,10 @@ OpenLayers.Renderer.symbol.church = [4, 0, 6, 0, 6, 4, 10, 4, 10, 6, 6, 6, 6, 14
|
|||||||
var map;
|
var map;
|
||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
|
// allow testing of specific renderers via "?renderer=Canvas", etc
|
||||||
|
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
|
||||||
|
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
|
||||||
|
|
||||||
map = new OpenLayers.Map('map', {
|
map = new OpenLayers.Map('map', {
|
||||||
controls: []
|
controls: []
|
||||||
});
|
});
|
||||||
@@ -46,7 +50,8 @@ function init(){
|
|||||||
// Create a vector layer and give it your style map.
|
// Create a vector layer and give it your style map.
|
||||||
var layer = new OpenLayers.Layer.Vector("Graphics", {
|
var layer = new OpenLayers.Layer.Vector("Graphics", {
|
||||||
styleMap: styles,
|
styleMap: styles,
|
||||||
isBaseLayer: true
|
isBaseLayer: true,
|
||||||
|
renderers: renderer
|
||||||
});
|
});
|
||||||
layer.addFeatures(features);
|
layer.addFeatures(features);
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|||||||
@@ -14,30 +14,6 @@
|
|||||||
function init(){
|
function init(){
|
||||||
map = new OpenLayers.Map('map', {allOverlays: true});
|
map = new OpenLayers.Map('map', {allOverlays: true});
|
||||||
|
|
||||||
// context for appropriate scale/resize cursors
|
|
||||||
var cursors = ["sw-resize", "s-resize", "se-resize",
|
|
||||||
"e-resize", "ne-resize", "n-resize", "nw-resize", "w-resize"];
|
|
||||||
var context = {
|
|
||||||
getCursor: function(feature){
|
|
||||||
var i = OpenLayers.Util.indexOf(control.handles, feature);
|
|
||||||
var cursor = "inherit";
|
|
||||||
if(i !== -1) {
|
|
||||||
i = (i + 8 + Math.round(control.rotation / 90) * 2) % 8;
|
|
||||||
cursor = cursors[i];
|
|
||||||
}
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// a nice style for the transformation box
|
|
||||||
var style = new OpenLayers.Style({
|
|
||||||
cursor: "${getCursor}",
|
|
||||||
pointRadius: 5,
|
|
||||||
fillColor: "white",
|
|
||||||
fillOpacity: 1,
|
|
||||||
strokeColor: "black"
|
|
||||||
}, {context: context});
|
|
||||||
|
|
||||||
// allow testing of specific renderers via "?renderer=Canvas", etc
|
// allow testing of specific renderers via "?renderer=Canvas", etc
|
||||||
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
|
var renderer = OpenLayers.Util.getParameters(window.location.href).renderer;
|
||||||
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
|
renderer = (renderer) ? [renderer] : OpenLayers.Layer.Vector.prototype.renderers;
|
||||||
@@ -45,7 +21,36 @@
|
|||||||
// the layer that we want to transform features on
|
// the layer that we want to transform features on
|
||||||
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {
|
var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry", {
|
||||||
styleMap: new OpenLayers.StyleMap({
|
styleMap: new OpenLayers.StyleMap({
|
||||||
"transform": style
|
// a nice style for the transformation box
|
||||||
|
"transform": new OpenLayers.Style({
|
||||||
|
display: "${getDisplay}",
|
||||||
|
cursor: "${role}",
|
||||||
|
pointRadius: 5,
|
||||||
|
fillColor: "white",
|
||||||
|
fillOpacity: 1,
|
||||||
|
strokeColor: "black"
|
||||||
|
}, {
|
||||||
|
context: {
|
||||||
|
getDisplay: function(feature) {
|
||||||
|
// hide the resize handle at the south-east corner
|
||||||
|
return feature.attributes.role === "se-resize" ? "none" : "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
"rotate": new OpenLayers.Style({
|
||||||
|
display: "${getDisplay}",
|
||||||
|
pointRadius: 10,
|
||||||
|
fillColor: "#ddd",
|
||||||
|
fillOpacity: 1,
|
||||||
|
strokeColor: "black"
|
||||||
|
}, {
|
||||||
|
context: {
|
||||||
|
getDisplay: function(feature) {
|
||||||
|
// only display the rotate handle at the south-east corner
|
||||||
|
return feature.attributes.role === "se-rotate" ? "" : "none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
renderers: renderer
|
renderers: renderer
|
||||||
});
|
});
|
||||||
@@ -53,7 +58,8 @@
|
|||||||
// create the TransformFeature control, using the renderIntent
|
// create the TransformFeature control, using the renderIntent
|
||||||
// from above
|
// from above
|
||||||
control = new OpenLayers.Control.TransformFeature(vectorLayer, {
|
control = new OpenLayers.Control.TransformFeature(vectorLayer, {
|
||||||
renderIntent: "transform"
|
renderIntent: "transform",
|
||||||
|
rotationHandleSymbolizer: "rotate"
|
||||||
});
|
});
|
||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
|
|
||||||
@@ -101,13 +107,15 @@
|
|||||||
<div id="docs">
|
<div id="docs">
|
||||||
<p>This example shows transformation of vector features with a
|
<p>This example shows transformation of vector features with a
|
||||||
tranformation box. Grab one of the handles to resize the feature.
|
tranformation box. Grab one of the handles to resize the feature.
|
||||||
Holding the SHIFT key will preserve the aspect ratio. Position the
|
Holding the SHIFT key will preserve the aspect ratio. Use the gray
|
||||||
mouse right outside one of the corner handles to rotate the feature,
|
handle to rotate the feature and hold the SHIFT key to only rotate
|
||||||
and hold the SHIFT key to only rotate in 45° increments.</p>
|
in 45° increments.
|
||||||
<p>In this example, the transformation box has been set on the left
|
</p>
|
||||||
|
<p>In this example, the transformation box has been set on the left
|
||||||
feature, with a rotation preset of 45°. Clicking on the right feature
|
feature, with a rotation preset of 45°. Clicking on the right feature
|
||||||
will set it for transformation, starting with an unrotated box.
|
will set it for transformation, starting with an unrotated box.
|
||||||
Dragging a feature or the box edges will move it around.</p>
|
Dragging a feature or the box edges will move it around.
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@@ -359,7 +359,8 @@ OpenLayers.Bounds = OpenLayers.Class({
|
|||||||
* APIMethod: containsLonLat
|
* APIMethod: containsLonLat
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* ll - {<OpenLayers.LonLat>}
|
* ll - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||||
|
* object with a 'lon' and 'lat' properties.
|
||||||
* options - {Object} Optional parameters
|
* options - {Object} Optional parameters
|
||||||
*
|
*
|
||||||
* Acceptable options:
|
* Acceptable options:
|
||||||
@@ -382,13 +383,12 @@ OpenLayers.Bounds = OpenLayers.Class({
|
|||||||
worldBounds = options.worldBounds;
|
worldBounds = options.worldBounds;
|
||||||
if (worldBounds && !contains) {
|
if (worldBounds && !contains) {
|
||||||
var worldWidth = worldBounds.getWidth();
|
var worldWidth = worldBounds.getWidth();
|
||||||
ll = ll.clone();
|
|
||||||
var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
|
var worldCenterX = (worldBounds.left + worldBounds.right) / 2;
|
||||||
var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
|
var worldsAway = Math.round((ll.lon - worldCenterX) / worldWidth);
|
||||||
ll.lon -= (worldsAway * worldWidth);
|
contains = this.containsLonLat({
|
||||||
contains = this.containsLonLat(
|
lon: ll.lon - worldsAway * worldWidth,
|
||||||
ll, {inclusive: options.inclusive}
|
lat: ll.lat
|
||||||
);
|
}, {inclusive: options.inclusive});
|
||||||
}
|
}
|
||||||
return contains;
|
return contains;
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* evt - {Event}
|
* evt - {Event}
|
||||||
*/
|
*/
|
||||||
defaultKeyPress: function (evt) {
|
defaultKeyPress: function (evt) {
|
||||||
|
var size;
|
||||||
switch(evt.keyCode) {
|
switch(evt.keyCode) {
|
||||||
case OpenLayers.Event.KEY_LEFT:
|
case OpenLayers.Event.KEY_LEFT:
|
||||||
this.map.pan(-this.slideFactor, 0);
|
this.map.pan(-this.slideFactor, 0);
|
||||||
@@ -77,19 +78,19 @@ OpenLayers.Control.KeyboardDefaults = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 33: // Page Up. Same in all browsers.
|
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);
|
this.map.pan(0, -0.75*size.h);
|
||||||
break;
|
break;
|
||||||
case 34: // Page Down. Same in all browsers.
|
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);
|
this.map.pan(0, 0.75*size.h);
|
||||||
break;
|
break;
|
||||||
case 35: // End. Same in all browsers.
|
case 35: // End. Same in all browsers.
|
||||||
var size = this.map.getSize();
|
size = this.map.getSize();
|
||||||
this.map.pan(0.75*size.w, 0);
|
this.map.pan(0.75*size.w, 0);
|
||||||
break;
|
break;
|
||||||
case 36: // Home. Same in all browsers.
|
case 36: // Home. Same in all browsers.
|
||||||
var size = this.map.getSize();
|
size = this.map.getSize();
|
||||||
this.map.pan(-0.75*size.w, 0);
|
this.map.pan(-0.75*size.w, 0);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -628,12 +628,14 @@ OpenLayers.Control.OverviewMap = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
* translated into pixel bounds for the overview map
|
* translated into pixel bounds for the overview map
|
||||||
*/
|
*/
|
||||||
getRectBoundsFromMapBounds: function(lonLatBounds) {
|
getRectBoundsFromMapBounds: function(lonLatBounds) {
|
||||||
var leftBottomLonLat = new OpenLayers.LonLat(lonLatBounds.left,
|
var leftBottomPx = this.getOverviewPxFromLonLat({
|
||||||
lonLatBounds.bottom);
|
lon: lonLatBounds.left,
|
||||||
var rightTopLonLat = new OpenLayers.LonLat(lonLatBounds.right,
|
lat: lonLatBounds.bottom
|
||||||
lonLatBounds.top);
|
});
|
||||||
var leftBottomPx = this.getOverviewPxFromLonLat(leftBottomLonLat);
|
var rightTopPx = this.getOverviewPxFromLonLat({
|
||||||
var rightTopPx = this.getOverviewPxFromLonLat(rightTopLonLat);
|
lon: lonLatBounds.right,
|
||||||
|
lat: lonLatBounds.top
|
||||||
|
});
|
||||||
var bounds = null;
|
var bounds = null;
|
||||||
if (leftBottomPx && rightTopPx) {
|
if (leftBottomPx && rightTopPx) {
|
||||||
bounds = new OpenLayers.Bounds(leftBottomPx.x, leftBottomPx.y,
|
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
|
* Get a pixel location from a map location
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* lonlat - {<OpenLayers.LonLat>}
|
* lonlat - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||||
|
* object with a 'lon' and 'lat' properties.
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
* {Object} Location which is the passed-in OpenLayers.LonLat,
|
* {Object} Location which is the passed-in OpenLayers.LonLat,
|
||||||
|
|||||||
@@ -232,9 +232,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
this.dragControl.deactivate();
|
this.dragControl.deactivate();
|
||||||
deactivated = true;
|
deactivated = true;
|
||||||
}
|
}
|
||||||
if (deactivated) {
|
|
||||||
this.unsetFeature();
|
|
||||||
}
|
|
||||||
return deactivated;
|
return deactivated;
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -335,7 +332,7 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
var control = this;
|
var control = this;
|
||||||
|
|
||||||
this.center = new OpenLayers.Geometry.Point(0, 0);
|
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.LineString([
|
||||||
new OpenLayers.Geometry.Point(-1, -1),
|
new OpenLayers.Geometry.Point(-1, -1),
|
||||||
new OpenLayers.Geometry.Point(0, -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
|
// 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;
|
control._moving = true;
|
||||||
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);
|
OpenLayers.Geometry.LineString.prototype.move.apply(this, arguments);
|
||||||
control.center.move(x, y);
|
control.center.move(x, y);
|
||||||
@@ -468,14 +465,17 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
var handles = new Array(8);
|
var handles = new Array(8);
|
||||||
var rotationHandles = new Array(4);
|
var rotationHandles = new Array(4);
|
||||||
var geom, handle, rotationHandle;
|
var geom, handle, rotationHandle;
|
||||||
|
var positions = ["sw", "s", "se", "e", "ne", "n", "nw", "w"];
|
||||||
for(var i=0; i<8; ++i) {
|
for(var i=0; i<8; ++i) {
|
||||||
geom = box.geometry.components[i];
|
geom = this.box.geometry.components[i];
|
||||||
handle = new OpenLayers.Feature.Vector(geom.clone(), null,
|
handle = new OpenLayers.Feature.Vector(geom.clone(), {
|
||||||
typeof this.renderIntent == "string" ? null :
|
role: positions[i] + "-resize"
|
||||||
|
}, typeof this.renderIntent == "string" ? null :
|
||||||
this.renderIntent);
|
this.renderIntent);
|
||||||
if(i % 2 == 0) {
|
if(i % 2 == 0) {
|
||||||
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(),
|
rotationHandle = new OpenLayers.Feature.Vector(geom.clone(), {
|
||||||
null, typeof this.rotationHandleSymbolizer == "string" ?
|
role: positions[i] + "-rotate"
|
||||||
|
}, typeof this.rotationHandleSymbolizer == "string" ?
|
||||||
null : this.rotationHandleSymbolizer);
|
null : this.rotationHandleSymbolizer);
|
||||||
rotationHandle.geometry.move = rotationHandleMoveFn;
|
rotationHandle.geometry.move = rotationHandleMoveFn;
|
||||||
geom._rotationHandle = rotationHandle;
|
geom._rotationHandle = rotationHandle;
|
||||||
@@ -489,7 +489,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
handles[i] = handle;
|
handles[i] = handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.box = box;
|
|
||||||
this.rotationHandles = rotationHandles;
|
this.rotationHandles = rotationHandles;
|
||||||
this.handles = handles;
|
this.handles = handles;
|
||||||
},
|
},
|
||||||
@@ -514,7 +513,6 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
onDrag: function(feature, pixel) {
|
onDrag: function(feature, pixel) {
|
||||||
if(feature === control.box) {
|
if(feature === control.box) {
|
||||||
control.transformFeature({center: control.center});
|
control.transformFeature({center: control.center});
|
||||||
control.drawHandles();
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
// set a new feature
|
// set a new feature
|
||||||
@@ -600,10 +598,16 @@ OpenLayers.Control.TransformFeature = OpenLayers.Class(OpenLayers.Control, {
|
|||||||
geom._rotationHandle && geom._rotationHandle.destroy();
|
geom._rotationHandle && geom._rotationHandle.destroy();
|
||||||
geom._rotationHandle = null;
|
geom._rotationHandle = null;
|
||||||
}
|
}
|
||||||
|
this.center = null;
|
||||||
|
this.feature = null;
|
||||||
|
this.handles = null;
|
||||||
|
this.rotationHandleSymbolizer = null;
|
||||||
|
this.rotationHandles = null;
|
||||||
this.box.destroy();
|
this.box.destroy();
|
||||||
this.box = null;
|
this.box = null;
|
||||||
this.layer = null;
|
this.layer = null;
|
||||||
this.dragControl.destroy();
|
this.dragControl.destroy();
|
||||||
|
this.dragControl = null;
|
||||||
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
OpenLayers.Control.prototype.destroy.apply(this, arguments);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
OpenLayers.Events.buttonclick = OpenLayers.Class({
|
OpenLayers.Events.buttonclick = OpenLayers.Class({
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIProperty: target
|
* Property: target
|
||||||
* {<OpenLayers.Events>} The events instance that the buttonclick event will
|
* {<OpenLayers.Events>} The events instance that the buttonclick event will
|
||||||
* be triggered on.
|
* be triggered on.
|
||||||
*/
|
*/
|
||||||
@@ -141,4 +141,4 @@ OpenLayers.Events.buttonclick = OpenLayers.Class({
|
|||||||
return propagate;
|
return propagate;
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -267,7 +267,8 @@ OpenLayers.Feature.Vector = OpenLayers.Class(OpenLayers.Feature, {
|
|||||||
* Determins whether the feature intersects with the specified location.
|
* Determins whether the feature intersects with the specified location.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* 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
|
* toleranceLon - {float} Optional tolerance in Geometric Coords
|
||||||
* toleranceLat - {float} Optional tolerance in Geographic 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) {
|
"*": function(node, obj) {
|
||||||
var name = node.localName || node.nodeName.split(":").pop();
|
var name = node.localName || node.nodeName.split(":").pop();
|
||||||
if (!(OpenLayers.Util.isArray(obj[name]))) {
|
if (!(OpenLayers.Util.isArray(obj[name]))) {
|
||||||
obj[name] = new Array();
|
obj[name] = [];
|
||||||
}
|
}
|
||||||
var dc_element = {};
|
var dc_element = {};
|
||||||
var attrs = node.attributes;
|
var attrs = node.attributes;
|
||||||
@@ -273,7 +273,7 @@ OpenLayers.Format.CSWGetRecords.v2_0_2 = OpenLayers.Class(OpenLayers.Format.XML,
|
|||||||
"*": function(node, obj) {
|
"*": function(node, obj) {
|
||||||
var name = node.localName || node.nodeName.split(":").pop();
|
var name = node.localName || node.nodeName.split(":").pop();
|
||||||
if (!(OpenLayers.Util.isArray(obj[name]))) {
|
if (!(OpenLayers.Util.isArray(obj[name]))) {
|
||||||
obj[name] = new Array();
|
obj[name] = [];
|
||||||
}
|
}
|
||||||
obj[name].push(this.getChildValue(node));
|
obj[name].push(this.getChildValue(node));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ OpenLayers.Format.XLS.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (address.freeFormAddress) {
|
if (address.freeFormAddress) {
|
||||||
this.writeNode("freeFormAddess", address.freeFormAddress, node);
|
this.writeNode("freeFormAddress", address.freeFormAddress, node);
|
||||||
} else {
|
} else {
|
||||||
if (address.street) {
|
if (address.street) {
|
||||||
this.writeNode("StreetAddress", address, node);
|
this.writeNode("StreetAddress", address, node);
|
||||||
|
|||||||
@@ -176,7 +176,8 @@ OpenLayers.Geometry = OpenLayers.Class({
|
|||||||
* geometry.
|
* geometry.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* 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
|
* toleranceLon - {float} Optional tolerance in Geometric Coords
|
||||||
* toleranceLat - {float} Optional tolerance in Geographic Coords
|
* toleranceLat - {float} Optional tolerance in Geographic Coords
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -205,12 +205,10 @@ OpenLayers.Layer.ArcIMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* Parameters:
|
* Parameters:
|
||||||
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
* bounds - {<OpenLayers.Bounds>} A bounds representing the bbox for the
|
||||||
* request.
|
* 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.
|
* 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);
|
bounds = this.adjustBounds(bounds);
|
||||||
|
|
||||||
// create an arcxml request to generate the image
|
// 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 axlResp = new OpenLayers.Format.ArcXML();
|
||||||
var arcxml = axlResp.read(doc);
|
var arcxml = axlResp.read(doc);
|
||||||
|
|
||||||
scope[prop] = this.getUrlOrImage(arcxml.image.output);
|
callback.call(scope, this.getUrlOrImage(arcxml.image.output));
|
||||||
|
|
||||||
// call the callback function to recieve the updated property on the
|
|
||||||
// scoped object
|
|
||||||
callback.apply(scope);
|
|
||||||
},
|
},
|
||||||
scope: this
|
scope: this
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -25,9 +25,6 @@ OpenLayers.Layer.Boxes = OpenLayers.Class(OpenLayers.Layer.Markers, {
|
|||||||
* name - {String}
|
* name - {String}
|
||||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
* 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
|
* Method: drawMarker
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ OpenLayers.Layer.FixedZoomLevels = OpenLayers.Class({
|
|||||||
*/
|
*/
|
||||||
initResolutions: function() {
|
initResolutions: function() {
|
||||||
|
|
||||||
var props = new Array('minZoomLevel', 'maxZoomLevel', 'numZoomLevels');
|
var props = ['minZoomLevel', 'maxZoomLevel', 'numZoomLevels'];
|
||||||
|
|
||||||
for(var i=0, len=props.length; i<len; i++) {
|
for(var i=0, len=props.length; i<len; i++) {
|
||||||
var property = props[i];
|
var property = props[i];
|
||||||
|
|||||||
@@ -677,8 +677,10 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
* Generate parameters for the grid layout.
|
* Generate parameters for the grid layout.
|
||||||
*
|
*
|
||||||
* Parameters:
|
* Parameters:
|
||||||
* bounds - {<OpenLayers.Bound>}
|
* bounds - {<OpenLayers.Bound>|Object} OpenLayers.Bounds or an
|
||||||
* origin - {<OpenLayers.LonLat>}
|
* object with a 'left' and 'top' properties.
|
||||||
|
* origin - {<OpenLayers.LonLat>|Object} OpenLayers.LonLat or an
|
||||||
|
* object with a 'lon' and 'lat' properties.
|
||||||
* resolution - {Number}
|
* resolution - {Number}
|
||||||
*
|
*
|
||||||
* Returns:
|
* Returns:
|
||||||
@@ -686,8 +688,6 @@ OpenLayers.Layer.Grid = OpenLayers.Class(OpenLayers.Layer.HTTPRequest, {
|
|||||||
* tileoffsetlat, tileoffsetx, tileoffsety
|
* tileoffsetlat, tileoffsetx, tileoffsety
|
||||||
*/
|
*/
|
||||||
calculateGridLayout: function(bounds, origin, resolution) {
|
calculateGridLayout: function(bounds, origin, resolution) {
|
||||||
bounds = bounds.clone();
|
|
||||||
|
|
||||||
var tilelon = resolution * this.tileSize.w;
|
var tilelon = resolution * this.tileSize.w;
|
||||||
var tilelat = resolution * this.tileSize.h;
|
var tilelat = resolution * this.tileSize.h;
|
||||||
|
|
||||||
|
|||||||
@@ -39,9 +39,7 @@ OpenLayers.Layer.MapServer = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
|||||||
* options - {Object} Hashtable of extra options to tag onto the layer
|
* options - {Object} Hashtable of extra options to tag onto the layer
|
||||||
*/
|
*/
|
||||||
initialize: function(name, url, params, options) {
|
initialize: function(name, url, params, options) {
|
||||||
var newArguments = [];
|
OpenLayers.Layer.Grid.prototype.initialize.apply(this, arguments);
|
||||||
newArguments.push(name, url, params, options);
|
|
||||||
OpenLayers.Layer.Grid.prototype.initialize.apply(this, newArguments);
|
|
||||||
|
|
||||||
this.params = OpenLayers.Util.applyDefaults(
|
this.params = OpenLayers.Util.applyDefaults(
|
||||||
this.params, this.DEFAULT_PARAMS
|
this.params, this.DEFAULT_PARAMS
|
||||||
|
|||||||
@@ -44,9 +44,6 @@ OpenLayers.Layer.PointTrack = OpenLayers.Class(OpenLayers.Layer.Vector, {
|
|||||||
* options - {Object} Optional object with properties to tag onto the
|
* options - {Object} Optional object with properties to tag onto the
|
||||||
* instance.
|
* instance.
|
||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
|
||||||
OpenLayers.Layer.Vector.prototype.initialize.apply(this, arguments);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* APIMethod: addNodes
|
* APIMethod: addNodes
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ OpenLayers.Layer.Text = OpenLayers.Class(OpenLayers.Layer.Markers, {
|
|||||||
*/
|
*/
|
||||||
initialize: function(name, options) {
|
initialize: function(name, options) {
|
||||||
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
OpenLayers.Layer.Markers.prototype.initialize.apply(this, arguments);
|
||||||
this.features = new Array();
|
this.features = [];
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -21,12 +21,6 @@
|
|||||||
*/
|
*/
|
||||||
OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
OpenLayers.Layer.Zoomify = OpenLayers.Class(OpenLayers.Layer.Grid, {
|
||||||
|
|
||||||
/**
|
|
||||||
* Property: url
|
|
||||||
* {String} URL for root directory with TileGroupX subdirectories.
|
|
||||||
*/
|
|
||||||
url: null,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Property: size
|
* Property: size
|
||||||
* {<OpenLayers.Size>} The Zoomify image size in pixels.
|
* {<OpenLayers.Size>} The Zoomify image size in pixels.
|
||||||
|
|||||||
@@ -1161,6 +1161,11 @@ OpenLayers.Map = OpenLayers.Class({
|
|||||||
|
|
||||||
if(!this.allOverlays || this.baseLayer.visibility) {
|
if(!this.allOverlays || this.baseLayer.visibility) {
|
||||||
this.baseLayer.setVisibility(true);
|
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
|
// recenter the map
|
||||||
|
|||||||
+33
-2
@@ -38,6 +38,30 @@ OpenLayers.Tile = OpenLayers.Class({
|
|||||||
*/
|
*/
|
||||||
events: null,
|
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
|
* Property: id
|
||||||
* {String} null
|
* {String} null
|
||||||
@@ -109,10 +133,13 @@ OpenLayers.Tile = OpenLayers.Class({
|
|||||||
|
|
||||||
//give the tile a unique id based on its BBOX.
|
//give the tile a unique id based on its BBOX.
|
||||||
this.id = OpenLayers.Util.createUniqueID("Tile_");
|
this.id = OpenLayers.Util.createUniqueID("Tile_");
|
||||||
|
|
||||||
this.events = new OpenLayers.Events(this);
|
|
||||||
|
|
||||||
OpenLayers.Util.extend(this, options);
|
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.size = null;
|
||||||
this.position = null;
|
this.position = null;
|
||||||
|
|
||||||
|
if (this.eventListeners) {
|
||||||
|
this.events.un(this.eventListeners);
|
||||||
|
}
|
||||||
this.events.destroy();
|
this.events.destroy();
|
||||||
|
this.eventListeners = null;
|
||||||
this.events = null;
|
this.events = null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -168,15 +168,14 @@ OpenLayers.Tile.Image = OpenLayers.Class(OpenLayers.Tile, {
|
|||||||
this.layer.div.appendChild(this.getTile());
|
this.layer.div.appendChild(this.getTile());
|
||||||
if (this.layer.async) {
|
if (this.layer.async) {
|
||||||
// Asynchronous image requests call the asynchronous getURL method
|
// Asynchronous image requests call the asynchronous getURL method
|
||||||
// on the layer to fetch an image that covers 'this.bounds', in the scope of
|
// on the layer to fetch an image that covers 'this.bounds'.
|
||||||
// 'this', setting the 'url' property of the layer itself, and running
|
var id = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
||||||
// the callback 'initImage' when the image request returns.
|
this.layer.getURLasync(this.bounds, function(url) {
|
||||||
var myId = this.asyncRequestId = (this.asyncRequestId || 0) + 1;
|
if (id == this.asyncRequestId) {
|
||||||
this.layer.getURLasync(this.bounds, this, "url", function() {
|
this.url = url;
|
||||||
if (myId == this.asyncRequestId) {
|
|
||||||
this.initImage();
|
this.initImage();
|
||||||
}
|
}
|
||||||
});
|
}, this);
|
||||||
} else {
|
} else {
|
||||||
// synchronous image requests get the url immediately.
|
// synchronous image requests get the url immediately.
|
||||||
this.url = this.layer.getURL(this.bounds);
|
this.url = this.layer.getURL(this.bounds);
|
||||||
|
|||||||
@@ -86,6 +86,10 @@ If you were previously using the `OpenLayers.Layer.SphericalMercator.forwardMerc
|
|||||||
|
|
||||||
`OpenLayers.Protocol.HTTP` no longer requires `OpenLayers.Format.QueryStringFilter`. It you need this, make sure it is included in your build config file.
|
`OpenLayers.Protocol.HTTP` no longer requires `OpenLayers.Format.QueryStringFilter`. It you need this, make sure it is included in your build config file.
|
||||||
|
|
||||||
|
## Changes in getURLasync
|
||||||
|
|
||||||
|
The internal `OpenLayers.Layer.getURLasync` function now take a bound, a callback and a scope. The function no longer needs update the passed property but simply to return to url.
|
||||||
|
|
||||||
## Deprecated Components
|
## Deprecated Components
|
||||||
|
|
||||||
A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate `<script>` tag after OpenLayers.js).
|
A number of properties, methods, and constructors have been marked as deprecated for multiple releases in the 2.x series. For the 2.12 release this deprecated functionality has been moved to a separate deprecated.js file. If you use any of the constructors or methods below, you will have to explicitly include the deprecated.js file in your build (or add it in a separate `<script>` tag after OpenLayers.js).
|
||||||
|
|||||||
+103
-114
@@ -47,132 +47,121 @@
|
|||||||
* http://unixpapa.com/js/key.html
|
* http://unixpapa.com/js/key.html
|
||||||
*/
|
*/
|
||||||
function test_Control_KeyboardDefaults_KeyDownEvent (t) {
|
function test_Control_KeyboardDefaults_KeyDownEvent (t) {
|
||||||
t.plan( 16 );
|
t.plan( 25 );
|
||||||
|
|
||||||
|
var evt = {which: 1}, pans = [], zoomIns = 0, zoomOuts = 0;
|
||||||
|
|
||||||
var evt = {which: 1};
|
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
|
// mock "pan", "zoomIn" and "zoomOut"
|
||||||
|
map.pan = function(dx, dy) {
|
||||||
|
pans.push({dx: dx, dy: dy});
|
||||||
|
};
|
||||||
|
map.zoomIn = function() {
|
||||||
|
zoomIns++;
|
||||||
|
};
|
||||||
|
map.zoomOut = function() {
|
||||||
|
zoomOuts++;
|
||||||
|
};
|
||||||
|
|
||||||
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
var layer = new OpenLayers.Layer.WMS("Test Layer",
|
||||||
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
"http://octo.metacarta.com/cgi-bin/mapserv?",
|
||||||
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
{map: "/mapdata/vmap_wms.map", layers: "basic"});
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
control = new OpenLayers.Control.KeyboardDefaults();
|
|
||||||
|
var control = new OpenLayers.Control.KeyboardDefaults({
|
||||||
|
slideFactor: 100
|
||||||
|
});
|
||||||
map.addControl(control);
|
map.addControl(control);
|
||||||
|
|
||||||
var STARTING_ZOOM_LEVEL = 4;
|
map.setCenter(new OpenLayers.LonLat(0, 0), 4);
|
||||||
var DELAY = 2;
|
|
||||||
|
|
||||||
var centerLL = new OpenLayers.LonLat(0,0);
|
|
||||||
map.setCenter(centerLL, STARTING_ZOOM_LEVEL);
|
|
||||||
|
|
||||||
// Start new test.
|
// Start new test.
|
||||||
evt.keyCode = OpenLayers.Event.KEY_LEFT;
|
evt.keyCode = OpenLayers.Event.KEY_LEFT;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
t.delay_call(
|
t.eq(pans.length, 1, '[KEY_LEFT] pan called once');
|
||||||
DELAY, function() {
|
t.eq(pans[0], {dx: -100, dy: 0},
|
||||||
t.ok( map.getCenter().lon < centerLL.lon, "key left works correctly" );
|
'[KEY LEFT] pan called with expected args');
|
||||||
|
|
||||||
// Start new test.
|
evt.keyCode = OpenLayers.Event.KEY_RIGHT;
|
||||||
evt.keyCode = OpenLayers.Event.KEY_RIGHT;
|
control.defaultKeyPress(evt);
|
||||||
control.defaultKeyPress(evt);
|
t.eq(pans.length, 2, '[KEY_RIGHT] pan called once');
|
||||||
},
|
t.eq(pans[1], {dx: 100, dy: 0},
|
||||||
DELAY, function() {
|
'[KEY RIGHT] pan called with expected args');
|
||||||
t.eq( map.getCenter().lon, centerLL.lon, "key right works correctly" );
|
|
||||||
|
evt.keyCode = OpenLayers.Event.KEY_UP;
|
||||||
// Start new test.
|
control.defaultKeyPress(evt);
|
||||||
evt.keyCode = OpenLayers.Event.KEY_UP;
|
t.eq(pans.length, 3, '[KEY_UP] pan called once');
|
||||||
control.defaultKeyPress(evt);
|
t.eq(pans[2], {dx: 0, dy: -100},
|
||||||
},
|
'[KEY UP] pan called with expected args');
|
||||||
DELAY, function() {
|
|
||||||
t.ok( map.getCenter().lat > centerLL.lat, "key up works correctly" );
|
evt.keyCode = OpenLayers.Event.KEY_DOWN;
|
||||||
|
control.defaultKeyPress(evt);
|
||||||
// Start new test.
|
t.eq(pans.length, 4, '[KEY_DOWN] pan called once');
|
||||||
evt.keyCode = OpenLayers.Event.KEY_DOWN;
|
t.eq(pans[3], {dx: 0, dy: 100},
|
||||||
control.defaultKeyPress(evt);
|
'[KEY DOWN] pan called with expected args');
|
||||||
},
|
|
||||||
DELAY, function() {
|
evt.keyCode = 33;
|
||||||
t.ok( map.getCenter().lat == centerLL.lat, "key down works correctly" );
|
control.defaultKeyPress(evt);
|
||||||
|
t.eq(pans.length, 5, '[33] pan called once');
|
||||||
// Start new test.
|
t.eq(pans[4], {dx: 0, dy: -384},
|
||||||
evt.keyCode = 33; //page up
|
'[33] pan called with expected args');
|
||||||
control.defaultKeyPress(evt);
|
|
||||||
},
|
evt.keyCode = 34;
|
||||||
DELAY, function() {
|
control.defaultKeyPress(evt);
|
||||||
t.ok( map.getCenter().lat > centerLL.lat, "key page up works correctly" );
|
t.eq(pans.length, 6, '[34] pan called once');
|
||||||
|
t.eq(pans[5], {dx: 0, dy: 384},
|
||||||
// Start new test.
|
'[34] pan called with expected args');
|
||||||
evt.keyCode = 34; //page down
|
|
||||||
control.defaultKeyPress(evt);
|
evt.keyCode = 35;
|
||||||
},
|
control.defaultKeyPress(evt);
|
||||||
DELAY, function() {
|
t.eq(pans.length, 7, '[35] pan called once');
|
||||||
t.ok( map.getCenter().lat == centerLL.lat, "key page down works correctly" );
|
t.eq(pans[6], {dx: 768, dy: 0},
|
||||||
|
'[35] pan called with expected args');
|
||||||
// Start new test.
|
|
||||||
evt.keyCode = 35; //end
|
evt.keyCode = 36;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
},
|
t.eq(pans.length, 8, '[36] pan called once');
|
||||||
DELAY, function() {
|
t.eq(pans[7], {dx: -768, dy: 0},
|
||||||
t.ok( map.getCenter().lon > centerLL.lon, "key end works correctly" );
|
'[36] pan called with expected args');
|
||||||
|
|
||||||
// Start new test.
|
evt.keyCode = 43;
|
||||||
evt.keyCode = 36; //home
|
control.defaultKeyPress(evt);
|
||||||
control.defaultKeyPress(evt);
|
t.eq(zoomIns, 1, '[43] zoomIn called once');
|
||||||
},
|
|
||||||
DELAY, function() {
|
evt.keyCode = 61;
|
||||||
t.ok( map.getCenter().lon == centerLL.lon, "key home works correctly");
|
control.defaultKeyPress(evt);
|
||||||
|
t.eq(zoomIns, 2, '[61] zoomIn called once');
|
||||||
// Start new test.
|
|
||||||
evt.keyCode = 43; //+
|
evt.keyCode = 187;
|
||||||
control.defaultKeyPress(evt);
|
control.defaultKeyPress(evt);
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 1, "key code 43 works correctly: +/= key (ASCII), keypad + (ASCII, Opera)" );
|
t.eq(zoomIns, 3, '[187] zoomIn called once');
|
||||||
|
|
||||||
// Start new test.
|
evt.keyCode = 107;
|
||||||
evt.keyCode = 61;
|
control.defaultKeyPress(evt);
|
||||||
control.defaultKeyPress(evt);
|
t.eq(zoomIns, 4, '[107] zoomIn called once');
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 2, "key code 61 works correctly: +/= key (Mozilla, Opera, some ASCII)");
|
|
||||||
|
evt.keyCode = 107;
|
||||||
// Start new test.
|
control.defaultKeyPress(evt);
|
||||||
evt.keyCode = 187;
|
t.eq(zoomIns, 5, '[107] zoomIn called once');
|
||||||
control.defaultKeyPress(evt);
|
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 3, "key code 187 works correctly: +/= key (IE)");
|
evt.keyCode = 45;
|
||||||
|
control.defaultKeyPress(evt);
|
||||||
// Start new test.
|
t.eq(zoomOuts, 1, '[45] zoomOut called once');
|
||||||
evt.keyCode = 107;
|
|
||||||
control.defaultKeyPress(evt);
|
evt.keyCode = 109;
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 4, "key code 107 works correctly: keypad + (IE, Mozilla)");
|
control.defaultKeyPress(evt);
|
||||||
|
t.eq(zoomOuts, 2, '[109] zoomOut called once');
|
||||||
// Start new test.
|
|
||||||
// set zoomanimation flag manually,
|
evt.keyCode = 189;
|
||||||
// reason: loadend event in layers.js will not achieved in unittests
|
control.defaultKeyPress(evt);
|
||||||
map.zoomanimationActive = false;
|
t.eq(zoomOuts, 3, '[189] zoomOut called once');
|
||||||
evt.keyCode = 45;
|
|
||||||
control.defaultKeyPress(evt);
|
evt.keyCode = 95;
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 3, "key code 45 works correctly: -/_ key (ASCII, Opera), keypad - (ASCII, Opera)");
|
control.defaultKeyPress(evt);
|
||||||
|
t.eq(zoomOuts, 4, '[95] zoomOut called once');
|
||||||
// Start new test.
|
|
||||||
// set zoomanimation flag manually,
|
map.destroy();
|
||||||
// reason: loadend event in layers.js will not achieved in unittests
|
|
||||||
map.zoomanimationActive = false;
|
|
||||||
evt.keyCode = 109;
|
|
||||||
control.defaultKeyPress(evt);
|
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 2, "key code 109 works correctly: -/_ key (Mozilla), keypad - (Mozilla, IE)");
|
|
||||||
|
|
||||||
// Start new test.
|
|
||||||
// set zoomanimation flag manually,
|
|
||||||
// reason: loadend event in layers.js will not achieved in unittests
|
|
||||||
map.zoomanimationActive = false;
|
|
||||||
evt.keyCode = 189;
|
|
||||||
control.defaultKeyPress(evt);
|
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL + 1, "key code 189 works correctly: -/_ key (IE)");
|
|
||||||
|
|
||||||
// Start new test.
|
|
||||||
// set zoomanimation flag manually,
|
|
||||||
// reason: loadend event in layers.js will not achieved in unittests
|
|
||||||
map.zoomanimationActive = false;
|
|
||||||
evt.keyCode = 95;
|
|
||||||
control.defaultKeyPress(evt);
|
|
||||||
t.eq( map.getZoom(), STARTING_ZOOM_LEVEL, "key code 95 works correctly: -/_ key (some ASCII)");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -70,7 +70,7 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Handler_Drag_deactivate(t) {
|
function test_Handler_Keyboard_deactivate(t) {
|
||||||
t.plan(8);
|
t.plan(8);
|
||||||
var map = new OpenLayers.Map('map');
|
var map = new OpenLayers.Map('map');
|
||||||
var control = new OpenLayers.Control();
|
var control = new OpenLayers.Control();
|
||||||
|
|||||||
+16
-3
@@ -763,7 +763,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function test_Map_setBaseLayer(t) {
|
function test_Map_setBaseLayer(t) {
|
||||||
t.plan( 4 );
|
t.plan( 6 );
|
||||||
|
|
||||||
map = new OpenLayers.Map('map');
|
map = new OpenLayers.Map('map');
|
||||||
|
|
||||||
@@ -791,6 +791,20 @@
|
|||||||
t.ok(map.baseLayer == wmslayer2, "setbaselayer correctly sets 'baseLayer' property");
|
t.ok(map.baseLayer == wmslayer2, "setbaselayer correctly sets 'baseLayer' property");
|
||||||
|
|
||||||
map.destroy();
|
map.destroy();
|
||||||
|
|
||||||
|
var l1 = new OpenLayers.Layer(),
|
||||||
|
l2 = new OpenLayers.Layer(null, {maxResolution: 1.4});
|
||||||
|
map = new OpenLayers.Map({
|
||||||
|
div: 'map',
|
||||||
|
allOverlays: true,
|
||||||
|
layers: [l1, l2],
|
||||||
|
zoom: 0,
|
||||||
|
center: [0, 0]
|
||||||
|
});
|
||||||
|
t.eq(l2.div.style.display, "none", "Layer invisible because not in range");
|
||||||
|
map.raiseLayer(l1, 1);
|
||||||
|
t.eq(l2.div.style.display, "block", "Layer visible after base layer change because in range now");
|
||||||
|
map.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test_Map_removeLayer(t) {
|
function test_Map_removeLayer(t) {
|
||||||
@@ -1276,10 +1290,10 @@
|
|||||||
t.eq(res, null, "getResolutionForZoom returns null for no base layer");
|
t.eq(res, null, "getResolutionForZoom returns null for no base layer");
|
||||||
map.fractionalZoom = true;
|
map.fractionalZoom = true;
|
||||||
var layer = new OpenLayers.Layer("test", {isBaseLayer: true});
|
var layer = new OpenLayers.Layer("test", {isBaseLayer: true});
|
||||||
|
map.addLayer(layer);
|
||||||
layer.getResolutionForZoom = function() {
|
layer.getResolutionForZoom = function() {
|
||||||
t.ok(true, "getResolutionForZoom calls base layer getResolutionForZoom");
|
t.ok(true, "getResolutionForZoom calls base layer getResolutionForZoom");
|
||||||
}
|
}
|
||||||
map.addLayer(layer);
|
|
||||||
var res = map.getResolutionForZoom();
|
var res = map.getResolutionForZoom();
|
||||||
layer.destroy();
|
layer.destroy();
|
||||||
map.destroy();
|
map.destroy();
|
||||||
@@ -2006,7 +2020,6 @@
|
|||||||
map.moveTo([16, 48], 0);
|
map.moveTo([16, 48], 0);
|
||||||
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
|
t.eq(map.getCenter().toShortString(), "0, 0", "no panning when moveTo is called with invalid zoom");
|
||||||
}
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
strategy.update({force: true});
|
strategy.update({force: true});
|
||||||
var from = map.getProjectionObject();
|
var from = map.getProjectionObject();
|
||||||
var to = layer.projection;
|
var to = layer.projection;
|
||||||
t.ok(strategy.bounds.equals(map.getExtent().transform(from, to)), "[force update different proj] bounds transformed");
|
t.eq(strategy.bounds.toString(), map.getExtent().transform(from, to).toString(), "[force update different proj] bounds transformed");
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-3
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
|
|
||||||
function test_Tile_constructor (t) {
|
function test_Tile_constructor (t) {
|
||||||
t.plan( 12 );
|
t.plan( 13 );
|
||||||
|
|
||||||
setUp();
|
setUp();
|
||||||
|
|
||||||
@@ -33,7 +33,11 @@
|
|||||||
var url = "bobob";
|
var url = "bobob";
|
||||||
var size = new OpenLayers.Size(5,6);
|
var size = new OpenLayers.Size(5,6);
|
||||||
|
|
||||||
tile = new OpenLayers.Tile(layer, position, bounds, url, size);
|
tile = new OpenLayers.Tile(layer, position, bounds, url, size, {
|
||||||
|
eventListeners: {
|
||||||
|
loadstart: OpenLayers.Function.False
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
t.ok(tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object");
|
t.ok(tile instanceof OpenLayers.Tile, "new OpenLayers.Tile returns Tile object");
|
||||||
t.ok(tile.layer === layer, "tile.layer set correctly");
|
t.ok(tile.layer === layer, "tile.layer set correctly");
|
||||||
@@ -48,7 +52,9 @@
|
|||||||
t.ok(tile.id != null, "tile is given an id");
|
t.ok(tile.id != null, "tile is given an id");
|
||||||
t.ok(OpenLayers.String.startsWith(tile.id, "Tile_"),
|
t.ok(OpenLayers.String.startsWith(tile.id, "Tile_"),
|
||||||
"tile's id starts correctly");
|
"tile's id starts correctly");
|
||||||
t.ok(tile.events != null, "tile's events intitialized");
|
t.ok(tile.events != null, "tile's events initialized");
|
||||||
|
t.ok(tile.events.listeners.loadstart.length == 1,
|
||||||
|
"tile's events initialized from eventListeners option");
|
||||||
|
|
||||||
tearDown();
|
tearDown();
|
||||||
|
|
||||||
|
|||||||
@@ -85,9 +85,8 @@
|
|||||||
var layer = new OpenLayers.Layer.WMS(
|
var layer = new OpenLayers.Layer.WMS(
|
||||||
"Name",
|
"Name",
|
||||||
"http://labs.metacarta.com/TESTURL?",
|
"http://labs.metacarta.com/TESTURL?",
|
||||||
{layers: 'basic'}, {async: true, getURLasync: function(bounds, scope, url, callback) {
|
{layers: 'basic'}, {async: true, getURLasync: function(bounds, callback, scope) {
|
||||||
scope.url = this.getURL(bounds);
|
callback.call(scope, this.getURL(bounds));
|
||||||
callback.call(scope);
|
|
||||||
}}
|
}}
|
||||||
);
|
);
|
||||||
map.addLayer(layer);
|
map.addLayer(layer);
|
||||||
|
|||||||
Reference in New Issue
Block a user