Compare commits

..

5 Commits

Author SHA1 Message Date
crschmidt
ee1455c399 Tag RC4.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.5-rc4@4799 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-10-03 21:47:20 +00:00
crschmidt
c505d23c7b Pullup fix for zooms to branch. (Closes #1043) 4791:4792
git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4795 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-10-03 20:42:35 +00:00
crschmidt
6ecd34eaf0 Pull up most of the changes for what will be 2.5RC4:
* Clone on WMS/MS Untiled, 4760:4761 (Closes #1013) 
 * serviceVersion on TMS, 4720:4721 (Closes #1023)
 * W3CGeo in Format.GeoRSS, 4768:4769, 4778:4779 (Closes #1024)
 * GeoJSON Draft4 Update, 4769:4770 (Closes #1028)
 * pagePosition Regression 4782:4783, (Closes #1034)
 * example changes 4691:4692 (Closes #1040)
 * WFS missing registerTileListener 4759:4760 (Closes #1045)
 * Yahoo API to stop dragging 4792:4793 (Closes #1052)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4794 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-10-03 20:27:15 +00:00
crschmidt
ef306a7cbe Pullup changes for RC3:
* KML Examples broken (Closes #1001)
 * drag handler doesn't reset properties on left or improperly modified mousedown (Closes #1003)
 * Text nodes limited to 4096 in length (Closes #1006)
 * KML/GML Attribute CDATA Parsing (Closes #1007)
 * Control.MousePosition (Closes #1008)


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4432 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-09-21 13:32:42 +00:00
crschmidt
995ef95dba Pullup changes to trunk for RC2. Includes drag-fires click changes
(Closes #982), comment/documentation/requires changes (Closes #983, #993, #988),
Fixing post support in proxy.cgi (Closes #991), baseLayer zoom level change 
(Closes #990), typo in Layer.Image.setURL (Closes #985), and a fix or the
Layer.Google bug caused by Google's changing internals (#994). RC2, here we 
come.


git-svn-id: http://svn.openlayers.org/branches/openlayers/2.5@4390 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-09-19 11:36:13 +00:00
36 changed files with 484 additions and 211 deletions

View File

@@ -1,30 +0,0 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<style type="text/css">
#map {
width: 800px;
height: 475px;
border: 1px solid black;
}
</style>
<script src="../lib/OpenLayers.js"></script>
<script type="text/javascript">
var lon = 5;
var lat = 40;
var zoom = 5;
var map, layer;
function init(){
map = new OpenLayers.Map('map');
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
map.addLayer(new OpenLayers.Layer.GML("KML", "kml/lines.kml", {format: OpenLayers.Format.KML}));
map.zoomToExtent(new OpenLayers.Bounds(-112.292744,36.068477,-112.22408,36.109246));
}
</script>
</head>
<body onload="init()">
<div id="map"></div>
</body>
</html>

View File

@@ -19,8 +19,8 @@
layer = new OpenLayers.Layer.WMS( "OpenLayers WMS",
"http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
map.addLayer(layer);
map.addLayer(new OpenLayers.Layer.GML("KML", "kml/mc-search.kml", {format: OpenLayers.Format.KML}));
map.zoomToMaxExtent();
map.addLayer(new OpenLayers.Layer.GML("KML", "kml/lines.kml", {format: OpenLayers.Format.KML}));
map.zoomToExtent(new OpenLayers.Bounds(-112.306698,36.017792,-112.03204,36.18087));
}
</script>
</head>

View File

@@ -99,7 +99,7 @@
var vector = new OpenLayers.Layer.Vector("Editable Vectors");
map.addLayers([gmap, gsat, ghyb, veroad, veaer, vehyb,
yahoo, yahoosat, yahoohyb, mapnik, wms]);
yahoo, yahoosat, yahoohyb, mapnik, wms, vector]);
map.addControl(new OpenLayers.Control.LayerSwitcher());
map.addControl(new OpenLayers.Control.EditingToolbar(vector));
map.zoomToMaxExtent()

View File

@@ -61,6 +61,16 @@ OpenLayers.Control.MousePosition = OpenLayers.Class(OpenLayers.Control, {
OpenLayers.Control.prototype.initialize.apply(this, arguments);
},
/**
* Method: destroy
*/
destroy: function() {
if (this.map) {
this.map.events.unregister('mousemove', this, this.redraw);
}
OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
/**
* Method: draw
* {DOMElement}

View File

@@ -295,7 +295,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
// look for <gml:posList>
nodeList = this.getElementsByTagNameNS(node, this.gmlns, "posList");
if(nodeList.length > 0) {
coordString = nodeList[0].firstChild.nodeValue;
coordString = this.concatChildValues(nodeList[0]);
coordString = coordString.replace(this.regExes.trimSpace, "");
coords = coordString.split(this.regExes.splitSpace);
var dim = parseInt(nodeList[0].getAttribute("dimension"));
@@ -314,7 +314,7 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
nodeList = this.getElementsByTagNameNS(node, this.gmlns,
"coordinates");
if(nodeList.length > 0) {
coordString = nodeList[0].firstChild.nodeValue;
coordString = this.concatChildValues(nodeList[0]);
coordString = coordString.replace(this.regExes.trimSpace,
"");
coordString = coordString.replace(this.regExes.trimComma,
@@ -453,7 +453,8 @@ OpenLayers.Format.GML = OpenLayers.Class(OpenLayers.Format.XML, {
grandchildren = child.childNodes;
if(grandchildren.length == 1) {
grandchild = grandchildren[0];
if(grandchild.nodeType == 3) {
if(grandchild.nodeType == 3 ||
grandchild.nodeType == 4) {
name = (child.prefix) ?
child.nodeName.split(":")[1] :
child.nodeName;

View File

@@ -93,9 +93,9 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
break;
case "GeometryCollection":
results = [];
for(var i=0; i<obj.members.length; ++i) {
for(var i=0; i<obj.geometries.length; ++i) {
try {
results.push(this.parseGeometry(obj.members[i]));
results.push(this.parseGeometry(obj.geometries[i]));
} catch(err) {
results = null;
OpenLayers.Console.error(err);
@@ -115,9 +115,9 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
}
break;
case "FeatureCollection":
for(var i=0; i<obj.members.length; ++i) {
for(var i=0; i<obj.features.length; ++i) {
try {
results.push(this.parseFeature(obj.members[i]));
results.push(this.parseFeature(obj.features[i]));
} catch(err) {
results = null;
OpenLayers.Console.error(err);
@@ -125,9 +125,9 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
}
break;
case "GeometryCollection":
for(var i=0; i<obj.members.length; ++i) {
for(var i=0; i<obj.geometries.length; ++i) {
try {
var geom = this.parseGeometry(obj.members[i]);
var geom = this.parseGeometry(obj.geometries[i]);
results.push(new OpenLayers.Feature.Vector(geom));
} catch(err) {
results = null;
@@ -436,28 +436,24 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
"type": null
};
if(obj instanceof Array) {
geojson.members = [];
if(obj[0] instanceof OpenLayers.Feature.Vector) {
geojson.features = [];
} else if (obj[0].CLASS_NAME.search("OpenLayers.Geometry") == 0) {
geojson.geometries = [];
}
for(var i=0; i<obj.length; ++i) {
var element = obj[i];
if(element instanceof OpenLayers.Feature.Vector) {
if(geojson.type == null) {
geojson.type = "FeatureCollection";
if(element.layer && element.layer.projection) {
var proj = element.layer.projection;
if(proj.match(/epsg:/i)) {
geojson.crs = {
"type": "EPSG",
"properties": {
"code": parseInt(proj.substring(proj.indexOf(":") + 1))
}
};
}
this.createCRSObject(element);
}
} else if(geojson.type != "FeatureCollection") {
OpenLayers.Console.error("FeatureCollection only supports collections of features: " + element);
break;
}
geojson.members.push(this.extract.feature.apply(this, [element]));
geojson.features.push(this.extract.feature.apply(this, [element]));
} else if (element.CLASS_NAME.search("OpenLayers.Geometry") == 0) {
if(geojson.type == null) {
geojson.type = "GeometryCollection";
@@ -465,7 +461,7 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
OpenLayers.Console.error("GeometryCollection only supports collections of geometries: " + element);
break;
}
geojson.members.push(this.extract.geometry.apply(this, [element]));
geojson.geometries.push(this.extract.geometry.apply(this, [element]));
}
}
} else if (obj.CLASS_NAME.search("OpenLayers.Geometry") == 0) {
@@ -473,20 +469,38 @@ OpenLayers.Format.GeoJSON = OpenLayers.Class(OpenLayers.Format.JSON, {
} else if (obj instanceof OpenLayers.Feature.Vector) {
geojson = this.extract.feature.apply(this, [obj]);
if(obj.layer && obj.layer.projection) {
var proj = obj.layer.projection;
if(proj.match(/epsg:/i)) {
geojson.crs = {
"type": "EPSG",
"properties": {
"code": parseInt(proj.substring(proj.indexOf(":") + 1))
}
};
}
this.createCRSObject(obj);
}
}
return OpenLayers.Format.JSON.prototype.write.apply(this,
[geojson, pretty]);
},
/**
* Method: createCRSObject
* Create the CRS object for an object.
*/
createCRSObject: function(object) {
var proj = object.layer.projection;
if (proj.match(/epsg:/i)) {
var code = parseInt(proj.substring(proj.indexOf(":") + 1));
if (code == 4326) {
geojson.crs = {
"type": "OGC",
"properties": {
"urn": "urn:ogc:def:crs:OGC:1.3:CRS84"
}
};
} else {
geojson.crs = {
"type": "EPSG",
"properties": {
"code": code
}
};
}
}
},
/**
* Property: extract

View File

@@ -38,6 +38,13 @@ OpenLayers.Format.GeoRSS = OpenLayers.Class(OpenLayers.Format.XML, {
* "http://www.georss.org/georss"
*/
georssns: "http://www.georss.org/georss",
/**
* APIProperty: geons
* {String} W3C Geo namespace to use. Defaults to
* "http://www.w3.org/2003/01/geo/wgs84_pos#"
*/
geons: "http://www.w3.org/2003/01/geo/wgs84_pos#",
/**
* APIProperty: featureTitle

View File

@@ -48,6 +48,13 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* {Boolean} Extract attributes from KML. Default is true.
*/
extractAttributes: true,
/**
* Property: internalns
* {String} KML Namespace to use -- defaults to the namespace of the
* Placemark node being parsed, but falls back to kmlns.
*/
internalns: null,
/**
* Constructor: OpenLayers.Format.KML
@@ -83,7 +90,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
}
var featureNodes = this.getElementsByTagNameNS(data,
this.kmlns,
'*',
"Placemark");
var numFeatures = featureNodes.length;
var features = new Array(numFeatures);
@@ -116,7 +123,10 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
var type, nodeList, geometry, parser;
for(var i=0; i<order.length; ++i) {
type = order[i];
nodeList = this.getElementsByTagNameNS(node, this.kmlns, type);
this.internalns = node.namespaceURI ?
node.namespaceURI : this.kmlns;
nodeList = this.getElementsByTagNameNS(node,
this.internalns, type);
if(nodeList.length > 0) {
// only deal with first geometry of this type
var parser = this.parseGeometry[type.toLowerCase()];
@@ -165,7 +175,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* {<OpenLayers.Geometry.Point>} A point geometry.
*/
point: function(node) {
var nodeList = this.getElementsByTagNameNS(node, this.kmlns,
var nodeList = this.getElementsByTagNameNS(node, this.internalns,
"coordinates");
var coords = [];
if(nodeList.length > 0) {
@@ -200,7 +210,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* {<OpenLayers.Geometry.LineString>} A linestring geometry.
*/
linestring: function(node, ring) {
var nodeList = this.getElementsByTagNameNS(node, this.kmlns,
var nodeList = this.getElementsByTagNameNS(node, this.internalns,
"coordinates");
var line = null;
if(nodeList.length > 0) {
@@ -254,7 +264,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
* {<OpenLayers.Geometry.Polygon>} A polygon geometry.
*/
polygon: function(node) {
var nodeList = this.getElementsByTagNameNS(node, this.kmlns,
var nodeList = this.getElementsByTagNameNS(node, this.internalns,
"LinearRing");
var numRings = nodeList.length;
var components = new Array(numRings);
@@ -326,7 +336,7 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
grandchildren = child.childNodes;
if(grandchildren.length == 1) {
grandchild = grandchildren[0];
if(grandchild.nodeType == 3) {
if(grandchild.nodeType == 3 || grandchild.nodeType == 4) {
name = (child.prefix) ?
child.nodeName.split(":")[1] :
child.nodeName;
@@ -638,4 +648,4 @@ OpenLayers.Format.KML = OpenLayers.Class(OpenLayers.Format.XML, {
},
CLASS_NAME: "OpenLayers.Format.KML"
});
});

View File

@@ -256,6 +256,62 @@ OpenLayers.Format.XML = OpenLayers.Class(OpenLayers.Format, {
}
return attributeValue;
},
/**
* APIMethod: getChildValue
* Get the value of the first child node if it exists, or return an
* optional default string. Returns an empty string if no first child
* exists and no default value is supplied.
*
* Parameters:
* node - {DOMElement} The element used to look for a first child value.
* def - {String} Optional string to return in the event that no
* first child value exists.
*
* Returns:
* {String} The value of the first child of the given node.
*/
getChildValue: function(node, def) {
var value;
try {
value = node.firstChild.nodeValue;
} catch(e) {
value = (def != undefined) ? def : "";
}
return value;
},
/**
* APIMethod: concatChildValues
* Concatenate the value of all child nodes if any exist, or return an
* optional default string. Returns an empty string if no children
* exist and no default value is supplied. Not optimized for large
* numbers of child nodes.
*
* Parameters:
* node - {DOMElement} The element used to look for child values.
* def - {String} Optional string to return in the event that no
* child exist.
*
* Returns:
* {String} The concatenated value of all child nodes of the given node.
*/
concatChildValues: function(node, def) {
var value = "";
var child = node.firstChild;
var childValue;
while(child) {
childValue = child.nodeValue;
if(childValue) {
value += childValue;
}
child = child.nextSibling;
}
if(value == "" && def != undefined) {
value = def;
}
return value;
},
/**
* APIMethod: hasAttributeNS

View File

@@ -143,9 +143,10 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
* {Boolean} Let the event propagate.
*/
mousedown: function (evt) {
var propagate = true;
this.dragging = false;
if (this.checkModifiers(evt) && OpenLayers.Event.isLeftClick(evt)) {
this.started = true;
this.dragging = false;
this.start = evt.xy;
this.last = evt.xy;
// TBD replace with CSS classes
@@ -159,9 +160,13 @@ OpenLayers.Handler.Drag = OpenLayers.Class(OpenLayers.Handler, {
document.onselectstart = function() {return false;}
}
return false;
propagate = false;
} else {
this.started = false;
this.start = null;
this.last = null;
}
return true;
return propagate;
},
/**

View File

@@ -731,19 +731,24 @@ OpenLayers.Layer = OpenLayers.Class({
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* closest - {Boolean} Find the zoom level that most closely fits the
* specified bounds. Note that this may result in a zoom that does
* not exactly contain the entire extent.
* Default is false.
*
* Returns:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
* that still contains the passed-in extent. We do this by calculating
* the ideal resolution for the given exteng (based on the map size)
* and then find the closest resolution to this ideal resolution.
* for the passed-in extent. We do this by calculating the ideal
* resolution for the given extent (based on the map size) and then
* calling getZoomForResolution(), passing along the 'closest'
* parameter.
*/
getZoomForExtent: function(extent) {
getZoomForExtent: function(extent, closest) {
var viewSize = this.map.getSize();
var idealResolution = Math.max( extent.getWidth() / viewSize.w,
extent.getHeight() / viewSize.h );
return this.getZoomForResolution(idealResolution);
return this.getZoomForResolution(idealResolution, closest);
},
/**
@@ -760,28 +765,39 @@ OpenLayers.Layer = OpenLayers.Class({
/**
* APIMethod: getZoomForResolution
* Get the index for the closest resolution in the layers resolutions array.
*
* Parameters:
* resolution - {Float} Map units per pixel.
* resolution - {Float}
* closest - {Boolean} Find the zoom level that corresponds to the absolute
* closest resolution, which may result in a zoom whose corresponding
* resolution is actually smaller than we would have desired (if this
* is being called from a getZoomForExtent() call, then this means that
* the returned zoom index might not actually contain the entire
* extent specified... but it'll be close).
* Default is false.
*
* Returns:
* {Integer} The index of the zoomLevel (entry in the resolutions array)
* that is the closest to the passed-in resolution.
* that corresponds to the best fit resolution given the passed in
* value and the 'closest' specification.
*/
getZoomForResolution: function(resolution) {
var zoom, diff;
getZoomForResolution: function(resolution, closest) {
var diff;
var minDiff = Number.POSITIVE_INFINITY;
for(var i=0; i < this.resolutions.length; i++) {
diff = Math.abs(this.resolutions[i] - resolution);
if(diff < minDiff) {
zoom = i;
for(var i=0; i < this.resolutions.length; i++) {
if (closest) {
diff = Math.abs(this.resolutions[i] - resolution);
if (diff > minDiff) {
break;
}
minDiff = diff;
} else if(diff > minDiff) {
break;
} else {
if (this.resolutions[i] < resolution) {
break;
}
}
}
return zoom;
return Math.max(0, i-1);
},
/**

View File

@@ -40,5 +40,29 @@ OpenLayers.Layer.MapServer.Untiled = OpenLayers.Class(OpenLayers.Layer.MapServer
OpenLayers.Console.warn(msg);
},
/**
* Method: clone
* Create a clone of this layer
*
* Returns:
* {<OpenLayers.Layer.MapServer.Untiled>} An exact clone of this layer
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.MapServer.Untiled(this.name,
this.url,
this.params,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.MapServer.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
CLASS_NAME: "OpenLayers.Layer.MapServer.Untiled"
});

View File

@@ -13,6 +13,12 @@
*/
OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
* APIProperty: serviceVersion
* {String}
*/
serviceVersion: "1.0.0",
/**
* APIProperty: isBaseLayer
* {Boolean}
@@ -91,7 +97,7 @@ OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
var x = Math.round((bounds.left - this.tileOrigin.lon) / (res * this.tileSize.w));
var y = Math.round((bounds.bottom - this.tileOrigin.lat) / (res * this.tileSize.h));
var z = this.map.getZoom();
var path = "1.0.0" + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
var path = this.serviceVersion + "/" + this.layername + "/" + z + "/" + x + "/" + y + "." + this.type;
var url = this.url;
if (url instanceof Array) {
url = this.selectUrl(path, url);

View File

@@ -255,6 +255,7 @@ OpenLayers.Layer.WFS = OpenLayers.Class(
this.tile = null;
this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
url, tileSize);
this.addTileMonitoringHooks(this.tile);
this.tile.draw();
}
}

View File

@@ -40,5 +40,29 @@ OpenLayers.Layer.WMS.Untiled = OpenLayers.Class(OpenLayers.Layer.WMS, {
OpenLayers.Console.warn(msg);
},
/**
* Method: clone
* Create a clone of this layer
*
* Returns:
* {<OpenLayers.Layer.WMS.Untiled>} An exact clone of this layer
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Layer.WMS.Untiled(this.name,
this.url,
this.params,
this.options);
}
//get all additions from superclasses
obj = OpenLayers.Layer.WMS.prototype.clone.apply(this, [obj]);
// copy/set any non-init, non-simple values here
return obj;
},
CLASS_NAME: "OpenLayers.Layer.WMS.Untiled"
});

View File

@@ -91,6 +91,7 @@ OpenLayers.Layer.Yahoo = OpenLayers.Class(
var size = this.getMapObjectSizeFromOLSize(this.map.getSize());
this.mapObject = new YMap(this.div, this.type, size);
this.mapObject.disableKeyControls();
this.mapObject.disableDragMap();
} catch(e) {}
},

View File

@@ -707,7 +707,7 @@ OpenLayers.Map = OpenLayers.Class({
} else {
// zoom to oldExtent *and* force zoom change
this.setCenter(oldExtent.getCenterLonLat(),
this.getZoomForExtent(oldExtent),
this.getZoomForExtent(oldExtent, true),
false, true);
}
}
@@ -1356,15 +1356,19 @@ OpenLayers.Map = OpenLayers.Class({
*
* Parameters:
* bounds - {<OpenLayers.Bounds>}
* closest - {Boolean} Find the zoom level that most closely fits the
* specified bounds. Note that this may result in a zoom that does
* not exactly contain the entire extent.
* Default is false.
*
* Returns:
* {Integer} A suitable zoom level for the specified bounds.
* If no baselayer is set, returns null.
*/
getZoomForExtent: function (bounds) {
getZoomForExtent: function (bounds, closest) {
var zoom = null;
if (this.baseLayer != null) {
zoom = this.baseLayer.getZoomForExtent(bounds);
zoom = this.baseLayer.getZoomForExtent(bounds, closest);
}
return zoom;
},
@@ -1374,15 +1378,22 @@ OpenLayers.Map = OpenLayers.Class({
*
* Parameter:
* resolution - {Float}
* closest - {Boolean} Find the zoom level that corresponds to the absolute
* closest resolution, which may result in a zoom whose corresponding
* resolution is actually smaller than we would have desired (if this
* is being called from a getZoomForExtent() call, then this means that
* the returned zoom index might not actually contain the entire
* extent specified... but it'll be close).
* Default is false.
*
* Returns:
* {Integer} A suitable zoom level for the specified resolution.
* If no baselayer is set, returns null.
*/
getZoomForResolution: function(resolution) {
getZoomForResolution: function(resolution, closest) {
var zoom = null;
if (this.baseLayer != null) {
zoom = this.baseLayer.getZoomForResolution(resolution);
zoom = this.baseLayer.getZoomForResolution(resolution, closest);
}
return zoom;
},

View File

@@ -991,7 +991,12 @@ OpenLayers.Util.pagePosition = function(forElement) {
while(element) {
if(element == document.body) {
if(OpenLayers.Element.getStyle(child, 'position') == 'absolute') {
// FIXME: IE, when passed 'window' as the forElement, treats it as
// equal to document.body, but window.style fails, so getStyle
// fails, so we are paranoid and check this here. This check should
// probably move into element.getStyle in 2.6.
if(child && child.style &&
OpenLayers.Element.getStyle(child, 'position') == 'absolute') {
break;
}
}

35
repository-license.txt Normal file
View File

@@ -0,0 +1,35 @@
This license applies to all code and content in the OpenLayers code
repository at svn.openlayers.org:
Copyright (c) 2005-2007 MetaCarta, Inc.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of MetaCarta, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
This license grants no rights to any components related to natural language
processing, free text querying, or unstructured information retrieval. This
license grants no rights to components that implement inventions on which
MetaCarta has patents or has filed applications for patents.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@@ -0,0 +1,45 @@
<html>
<head>
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
function test_MousePosition_constructor(t) {
t.plan(2);
var control = new OpenLayers.Control.MousePosition();
t.ok(control instanceof OpenLayers.Control.MousePosition, "new OpenLayers.Control.MousePosition returns object");
t.eq(control.displayClass, "olControlMousePosition", "displayClass set correctly");
}
function test_MousePosition_destroy(t) {
t.plan(1);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control.MousePosition();
map.addControl(control);
var listeners = map.events.listeners.mousemove.length;
control.destroy();
t.eq(map.events.listeners.mousemove.length, listeners - 1, "mousemove event is unregistered");
}
function test_MousePosition_addControl(t) {
t.plan(4);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control.MousePosition();
map.addControl(control);
t.ok(control.map === map, "Control.map is set to the map object");
t.ok(map.controls[map.controls.length - 1] === control, "map.controls contains control");
t.eq(parseInt(control.div.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Control div zIndexed properly" );
t.eq(parseInt(map.viewPortDiv.lastChild.style.zIndex), map.Z_INDEX_BASE['Control'] + 5, "Viewport div contains control div");
}
</script>
</head>
<body>
<div id="map" style="width: 1024px; height: 512px;"/>
</body>
</html>

View File

@@ -43,33 +43,21 @@
var overviewZoom = control.ovmap.getZoom();
t.eq(overviewCenter.lon, -71, "Overviewmap center lon correct");
t.eq(overviewCenter.lat, 42, "Overviewmap center lat correct");
t.eq(overviewZoom, 9, "Overviewmap zoomcorrect");
t.eq(overviewZoom, 8, "Overviewmap zoomcorrect");
control.mapDivClick({'xy':new OpenLayers.Pixel(5,5)});
// There are box model issues that keep browsers from giving us
// identical results here. Test the normalized difference against
// a tolerance instead of testing equality.
function normalizedDiff(a, b) {
return Math.abs((a - b) / (a + b));
}
var tolerance = 1e-4;
var cent = map.getCenter();
t.ok(normalizedDiff(cent.lon, -71.00390625) < tolerance,
"Clicking on the Overview Map has the correct effect on map lon");
t.ok(normalizedDiff(cent.lat, 42.00390625) < tolerance,
"Clicking on the Overview Map has the correct effect on map lat");
t.eq(cent.lon, -71.3515625, "Clicking on the Overview Map has the correct effect on map lon");
t.eq(cent.lat, 42.17578125, "Clicking on the Overview Map has the correct effect on map lat");
control.rectMouseDown({'xy':new OpenLayers.Pixel(5,5), 'which':1});
control.rectMouseMove({'xy':new OpenLayers.Pixel(15,15), 'which':1});
control.rectMouseUp({'xy':new OpenLayers.Pixel(15,15), 'which':1});
var cent = map.getCenter();
t.ok(normalizedDiff(cent.lon, -70.83984375) < tolerance,
"Dragging on the Overview Map has the correct effect on map lon");
t.ok(normalizedDiff(cent.lat, 41.84765625) < tolerance,
"Dragging on the Overview Map has the correct effect on map lat");
t.eq(cent.lon, -71.2734375, "Dragging on the Overview Map has the correct effect on map lon");
t.eq(cent.lat, 42.09765625, "Dragging on the Overview Map has the correct effect on map lat");
map.setCenter(new OpenLayers.LonLat(0,0), 0);
var overviewCenter = control.ovmap.getCenter();

View File

@@ -147,13 +147,14 @@
t.eq(data[0].geometry.components.length, 2, "rings length correct");
}
function test_Format_GML_read_attributes(t) {
t.plan(1);
t.plan(2);
var parser = new OpenLayers.Format.GML();
data = parser.read(test_content[0]);
t.eq(data[0].attributes['NAME'], "WY", "Simple Attribute data is read correctly.");
t.eq(data[0].attributes['LONGNAME'], "Wyoming", "Attribute data is read from CDATA node correctly.");
}
var test_content = ['<?xml version="1.0" encoding="utf-8" ?>\n<ogr:FeatureCollection\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n xsi:schemaLocation="http://ogr.maptools.org/ testoutput.xsd"\n xmlns:ogr="http://ogr.maptools.org/"\n xmlns:gml="http://www.opengis.net/gml">\n <gml:boundedBy>\n <gml:Box>\n <gml:coord><gml:X>-1254041.389711702</gml:X><gml:Y>250906.9515983529</gml:Y></gml:coord>\n <gml:coord><gml:X>-634517.1199908922</gml:X><gml:Y>762236.2940800377</gml:Y></gml:coord>\n </gml:Box>\n </gml:boundedBy> \n <gml:featureMember>\n <ogr:states fid="F0">\n <ogr:geometryProperty><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-634517.11999089224,691849.77929356066,0 -653761.64509297756,471181.53429472551,0 -673343.60852865304,250906.9515983529,0 -1088825.734430399,299284.85108220269,0 -1254041.3897117018,324729.27754874947,0 -1235750.4212498858,434167.33911316615,0 -1190777.7803201093,704392.96327195223,0 -1181607.835811228,762236.29408003774,0 -634517.11999089224,691849.77929356066,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>\n <ogr:NAME>WY</ogr:NAME>\n </ogr:states>\n </gml:featureMember>\n</ogr:FeatureCollection>\n',
var test_content = ['<?xml version="1.0" encoding="utf-8" ?>\n<ogr:FeatureCollection\n xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n xsi:schemaLocation="http://ogr.maptools.org/ testoutput.xsd"\n xmlns:ogr="http://ogr.maptools.org/"\n xmlns:gml="http://www.opengis.net/gml">\n <gml:boundedBy>\n <gml:Box>\n <gml:coord><gml:X>-1254041.389711702</gml:X><gml:Y>250906.9515983529</gml:Y></gml:coord>\n <gml:coord><gml:X>-634517.1199908922</gml:X><gml:Y>762236.2940800377</gml:Y></gml:coord>\n </gml:Box>\n </gml:boundedBy> \n <gml:featureMember>\n <ogr:states fid="F0">\n <ogr:geometryProperty><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>-634517.11999089224,691849.77929356066,0 -653761.64509297756,471181.53429472551,0 -673343.60852865304,250906.9515983529,0 -1088825.734430399,299284.85108220269,0 -1254041.3897117018,324729.27754874947,0 -1235750.4212498858,434167.33911316615,0 -1190777.7803201093,704392.96327195223,0 -1181607.835811228,762236.29408003774,0 -634517.11999089224,691849.77929356066,0</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></ogr:geometryProperty>\n <ogr:NAME>WY</ogr:NAME>\n <ogr:LONGNAME><![CDATA[Wyoming]]></ogr:LONGNAME>\n </ogr:states>\n </gml:featureMember>\n</ogr:FeatureCollection>\n',
'<wfs:FeatureCollection' +
' xmlns:fs="http://example.com/featureserver"' +
' xmlns:wfs="http://www.opengis.net/wfs"' +

View File

@@ -3,10 +3,10 @@
<script src="../../lib/OpenLayers.js"></script>
<script type="text/javascript">
var poly_content = '{"type": "FeatureCollection", "members": [{"geometry": {"type": "Polygon", "coordinates": [[[-131.484375, -5.9765625], [-112.5, -58.0078125], [-32.34375, -50.2734375], [-114.609375, 52.3828125], [-167.34375, -35.5078125], [-146.953125, -57.3046875], [-139.921875, -34.1015625], [-131.484375, -5.9765625]]]}, "type": "Feature", "id": 562, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}]}';
var poly_content = '{"type": "FeatureCollection", "features": [{"geometry": {"type": "Polygon", "coordinates": [[[-131.484375, -5.9765625], [-112.5, -58.0078125], [-32.34375, -50.2734375], [-114.609375, 52.3828125], [-167.34375, -35.5078125], [-146.953125, -57.3046875], [-139.921875, -34.1015625], [-131.484375, -5.9765625]]]}, "type": "Feature", "id": 562, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}]}';
var point_feature = '{"geometry": {"type": "Point", "coordinates": [94.21875, 72.94921875]}, "type": "Feature", "id": 573, "properties": {"strokeColor": "blue", "title": "Feature 5", "author": "Your Name Here"}}'
var line_feature = '{"type": "FeatureCollection", "members": [{"geometry": {"type": "LineString", "coordinates": [[-27.0703125, 59.4140625], [-77.6953125, 20.7421875], [30.5859375, -36.2109375], [67.1484375, 34.8046875]]}, "type": "Feature", "id": 559, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}]}';
var multiple_features = '{"type": "FeatureCollection", "members": [{"geometry": {"type": "Point", "coordinates": [-91.0546875, 43.9453125]}, "type": "Feature", "id": 577, "properties": {"strokeColor": "red", "title": "Feature 2", "image": "foo.gif", "author": "Your Name Here"}}, {"geometry": {"type": "LineString", "coordinates": [[91.40625, -1.40625], [116.015625, -42.890625], [153.28125, -28.125], [108.984375, 11.25], [75.234375, 8.4375], [76.640625, 9.140625], [67.5, -36.5625], [67.5, -35.859375]]}, "type": "Feature", "id": 576, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [139.5703125, 57.48046875]}, "type": "Feature", "id": 575, "properties": {"strokeColor": "blue", "title": "Feature 7", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [107.2265625, 82.44140625]}, "type": "Feature", "id": 574, "properties": {"strokeColor": "blue", "title": "Feature 6", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [94.21875, 72.94921875]}, "type": "Feature", "id": 573, "properties": {"strokeColor": "blue", "title": "Feature 5", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [116.3671875, 61.69921875]}, "type": "Feature", "id": 572, "properties": {"strokeColor": "blue", "title": "Feature 4", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [145.8984375, 73.65234375]}, "type": "Feature", "id": 571, "properties": {"strokeColor": "blue", "title": "Feature 3", "author": "Your Name Here"}}, {"geometry": {"type": "Polygon", "coordinates": [[[32.34375, 52.20703125], [87.1875, 70.13671875], [122.6953125, 37.44140625], [75.234375, 42.36328125], [40.078125, 42.36328125], [28.828125, 48.33984375], [18.6328125, 56.77734375], [23.203125, 65.56640625], [32.34375, 52.20703125]]]}, "type": "Feature", "id": 570, "properties": {"strokeColor": "blue", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [62.578125, -53.4375]}, "type": "Feature", "id": 569, "properties": {"strokeColor": "red", "title": "Feature 3", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [121.640625, 16.875]}, "type": "Feature", "id": 568, "properties": {"strokeColor": "red", "title": "Feature 6", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [135.703125, 8.4375]}, "type": "Feature", "id": 567, "properties": {"strokeColor": "red", "title": "Feature 4", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [137.109375, 48.515625]}, "type": "Feature", "id": 566, "properties": {"strokeColor": "red", "title": "Feature 274", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 565, "properties": {}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 564, "properties": {}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 563, "properties": {}}, {"geometry": {"type": "Polygon", "coordinates": [[[-131.484375, -5.9765625], [-112.5, -58.0078125], [-32.34375, -50.2734375], [-114.609375, 52.3828125], [-167.34375, -35.5078125], [-146.953125, -57.3046875], [-139.921875, -34.1015625], [-131.484375, -5.9765625]]]}, "type": "Feature", "id": 562, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [48.8671875, -15.8203125]}, "type": "Feature", "id": 560, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "LineString", "coordinates": [[-27.0703125, 59.4140625], [-77.6953125, 20.7421875], [30.5859375, -36.2109375], [67.1484375, 34.8046875]]}, "type": "Feature", "id": 559, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [12.65625, 16.5234375]}, "type": "Feature", "id": 558, "properties": {"styleUrl": "#allstyle", "title": "Feature 1", "strokeColor": "red", "author": "Your Name Here"}}]}';
var line_feature = '{"type": "FeatureCollection", "features": [{"geometry": {"type": "LineString", "coordinates": [[-27.0703125, 59.4140625], [-77.6953125, 20.7421875], [30.5859375, -36.2109375], [67.1484375, 34.8046875]]}, "type": "Feature", "id": 559, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}]}';
var multiple_features = '{"type": "FeatureCollection", "features": [{"geometry": {"type": "Point", "coordinates": [-91.0546875, 43.9453125]}, "type": "Feature", "id": 577, "properties": {"strokeColor": "red", "title": "Feature 2", "image": "foo.gif", "author": "Your Name Here"}}, {"geometry": {"type": "LineString", "coordinates": [[91.40625, -1.40625], [116.015625, -42.890625], [153.28125, -28.125], [108.984375, 11.25], [75.234375, 8.4375], [76.640625, 9.140625], [67.5, -36.5625], [67.5, -35.859375]]}, "type": "Feature", "id": 576, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [139.5703125, 57.48046875]}, "type": "Feature", "id": 575, "properties": {"strokeColor": "blue", "title": "Feature 7", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [107.2265625, 82.44140625]}, "type": "Feature", "id": 574, "properties": {"strokeColor": "blue", "title": "Feature 6", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [94.21875, 72.94921875]}, "type": "Feature", "id": 573, "properties": {"strokeColor": "blue", "title": "Feature 5", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [116.3671875, 61.69921875]}, "type": "Feature", "id": 572, "properties": {"strokeColor": "blue", "title": "Feature 4", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [145.8984375, 73.65234375]}, "type": "Feature", "id": 571, "properties": {"strokeColor": "blue", "title": "Feature 3", "author": "Your Name Here"}}, {"geometry": {"type": "Polygon", "coordinates": [[[32.34375, 52.20703125], [87.1875, 70.13671875], [122.6953125, 37.44140625], [75.234375, 42.36328125], [40.078125, 42.36328125], [28.828125, 48.33984375], [18.6328125, 56.77734375], [23.203125, 65.56640625], [32.34375, 52.20703125]]]}, "type": "Feature", "id": 570, "properties": {"strokeColor": "blue", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [62.578125, -53.4375]}, "type": "Feature", "id": 569, "properties": {"strokeColor": "red", "title": "Feature 3", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [121.640625, 16.875]}, "type": "Feature", "id": 568, "properties": {"strokeColor": "red", "title": "Feature 6", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [135.703125, 8.4375]}, "type": "Feature", "id": 567, "properties": {"strokeColor": "red", "title": "Feature 4", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [137.109375, 48.515625]}, "type": "Feature", "id": 566, "properties": {"strokeColor": "red", "title": "Feature 274", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 565, "properties": {}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 564, "properties": {}}, {"geometry": {"type": "Point", "coordinates": [0, 5]}, "type": "Feature", "id": 563, "properties": {}}, {"geometry": {"type": "Polygon", "coordinates": [[[-131.484375, -5.9765625], [-112.5, -58.0078125], [-32.34375, -50.2734375], [-114.609375, 52.3828125], [-167.34375, -35.5078125], [-146.953125, -57.3046875], [-139.921875, -34.1015625], [-131.484375, -5.9765625]]]}, "type": "Feature", "id": 562, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [48.8671875, -15.8203125]}, "type": "Feature", "id": 560, "properties": {"strokeColor": "red", "title": "Feature 2", "author": "Your Name Here"}}, {"geometry": {"type": "LineString", "coordinates": [[-27.0703125, 59.4140625], [-77.6953125, 20.7421875], [30.5859375, -36.2109375], [67.1484375, 34.8046875]]}, "type": "Feature", "id": 559, "properties": {"strokeColor": "red", "title": "Feature 1", "author": "Your Name Here"}}, {"geometry": {"type": "Point", "coordinates": [12.65625, 16.5234375]}, "type": "Feature", "id": 558, "properties": {"styleUrl": "#allstyle", "title": "Feature 1", "strokeColor": "red", "author": "Your Name Here"}}]}';
var parser = new OpenLayers.Format.GeoJSON();
function test_Format_GeoJSON_constructor(t) {
@@ -145,7 +145,7 @@
var geomcol = {
"type": "GeometryCollection",
"members": [
"geometries": [
{
"type": "Point",
"coordinates": [100.0, 0.0]
@@ -189,7 +189,7 @@
var line_object = {
"type": "FeatureCollection",
"members": [
"features": [
{
"geometry": {
"type": "LineString",
@@ -212,7 +212,7 @@
};
data = parser.read(line_object);
out = parser.write(data);
serialized = '{"type":"FeatureCollection","members":[{"type":"Feature","id":559,"properties":{"strokeColor":"red","title":"Feature 1","author":"Your Name Here"},"geometry":{"type":"LineString","coordinates":[[-27.0703125,59.4140625],[-77.6953125,20.7421875],[30.5859375,-36.2109375],[67.1484375,34.8046875]]}}]}';
serialized = '{"type":"FeatureCollection","features":[{"type":"Feature","id":559,"properties":{"strokeColor":"red","title":"Feature 1","author":"Your Name Here"},"geometry":{"type":"LineString","coordinates":[[-27.0703125,59.4140625],[-77.6953125,20.7421875],[30.5859375,-36.2109375],[67.1484375,34.8046875]]}}]}';
t.eq(out, serialized, "input and output on line collections are the same");
var serialize_tests = [
@@ -253,8 +253,8 @@
serialize_tests.push([multiline, '{"type":"MultiLineString","coordinates":[[[1,2],[3,4]],[[1,2],[3,4]]]}']);
multipolygon = new OpenLayers.Geometry.MultiPolygon([serialize_tests[4][0], serialize_tests[4][0]]);
serialize_tests.push([multipolygon, '{"type":"MultiPolygon","coordinates":[[[[1,2],[3,4],[5,6],[1,2]]],[[[1,2],[3,4],[5,6],[1,2]]]]}']);
serialize_tests.push([ [ serialize_tests[0][0] ], '{"type":"FeatureCollection","members":[{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]}}]}' ]);
serialize_tests.push([ [ serialize_tests[1][0], serialize_tests[2][0] ], '{"type":"GeometryCollection","members":[{"type":"Point","coordinates":[1,2]},{"type":"MultiPoint","coordinates":[[1,2]]}]}' ]);
serialize_tests.push([ [ serialize_tests[0][0] ], '{"type":"FeatureCollection","features":[{"type":"Feature","id":0,"properties":{},"geometry":{"type":"Point","coordinates":[1,2]}}]}' ]);
serialize_tests.push([ [ serialize_tests[1][0], serialize_tests[2][0] ], '{"type":"GeometryCollection","geometries":[{"type":"Point","coordinates":[1,2]},{"type":"MultiPoint","coordinates":[[1,2]]}]}' ]);
for (var i = 0; i < serialize_tests.length; i++) {
var input = serialize_tests[i][0];
var output = serialize_tests[i][1];
@@ -268,7 +268,7 @@
var line_object = {
"type": "FeatureCollection",
"members": [
"features": [
{
"geometry": {
"type": "LineString",

View File

@@ -26,6 +26,14 @@
var data = parser.write([f]);
t.eq(data, '<rss xmlns="http://backend.userland.com/rss2"><item><title></title><description></description><georss:line xmlns:georss="http://www.georss.org/georss">45.68 -111.04 45.68 -112.04</georss:line></item></rss>', 'GeoRSS serializes a line correctly');
}
function test_Format_GeoRSS_w3cgeo(t) {
t.plan(2);
var parser = new OpenLayers.Format.GeoRSS();
var data = parser.read('<rss xmlns="http://backend.userland.com/rss2" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"><item><geo:long>-1</geo:long><geo:lat>1</geo:lat></item></rss>');
t.eq(data[0].geometry.x, -1, "w3c geo x read correctly");
t.eq(data[0].geometry.y, 1, "w3c geo y read correctly");
}
function test_Format_GeoRSS_roundtrip(t) {
t.plan(input.length);
var parser = new OpenLayers.Format.GeoRSS();

View File

@@ -28,6 +28,24 @@
"read geometry collection");
}
function test_Format_KML_readCdataAttributes_20(t) {
t.plan(2);
var cdata = '<kml xmlns="http://earth.google.com/kml/2.0"><Document><Placemark><name><![CDATA[Pezinok]]></name><description><![CDATA[Full of text.]]></description><styleUrl>#rel1.0</styleUrl><Point> <coordinates>17.266666, 48.283333</coordinates></Point></Placemark></Document></kml>';
var features = (new OpenLayers.Format.KML()).read(cdata);
t.eq(features[0].attributes.description, "Full of text.", "Description attribute in cdata read correctly");
t.eq(features[0].attributes.name, "Pezinok", "title attribute in cdata read correctly");
}
function test_Format_KML_readCdataAttributes_21(t) {
t.plan(2);
var cdata = '<kml xmlns="http://earth.google.com/kml/2.1"><Document><Placemark><name><![CDATA[Pezinok]]></name><description><![CDATA[Full of text.]]></description><styleUrl>#rel1.0</styleUrl><Point> <coordinates>17.266666, 48.283333</coordinates></Point></Placemark></Document></kml>';
var features = (new OpenLayers.Format.KML()).read(cdata);
t.eq(features[0].attributes.description, "Full of text.", "Description attribute in cdata read correctly");
t.eq(features[0].attributes.name, "Pezinok", "title attribute in cdata read correctly");
}
function test_Format_KML_write(t) {
// make sure id, name, and description are preserved
t.plan(1);

View File

@@ -87,7 +87,7 @@
}
function test_Handler_Drag_callbacks(t) {
t.plan(27);
t.plan(33);
var map = new OpenLayers.Map('map', {controls: []});
@@ -115,10 +115,41 @@
var handler = new OpenLayers.Handler.Drag(control, callbacks);
handler.activate();
// test mousedown
var oldIsLeftClick = OpenLayers.Event.isLeftClick;
var oldStop = OpenLayers.Event.stop;
var oldCheckModifiers = handler.checkModifiers;
// test mousedown with right click
OpenLayers.Event.isLeftClick = function() {
return false;
}
handler.checkModifiers = function() {
return true;
}
handler.started = true;
handler.start = {x: "foo", y: "bar"};
handler.last = {x: "foo", y: "bar"};
map.events.triggerEvent("mousedown", testEvents.down);
t.ok(!handler.started, "right-click sets started to false");
t.eq(handler.start, null, "right-click sets start to null");
t.eq(handler.last, null, "right-click sets last to null");
// test mousedown with improper modifier
OpenLayers.Event.isLeftClick = function() {
return true;
}
handler.checkModifiers = function() {
return false;
}
handler.started = true;
handler.start = {x: "foo", y: "bar"};
handler.last = {x: "foo", y: "bar"};
map.events.triggerEvent("mousedown", testEvents.down);
t.ok(!handler.started, "bad modifier sets started to false");
t.eq(handler.start, null, "bad modifier sets start to null");
t.eq(handler.last, null, "bad modifier sets last to null");
// test mousedown
handler.checkModifiers = function(evt) {
t.ok(evt.xy.x == testEvents.down.xy.x &&
evt.xy.y == testEvents.down.xy.y,
@@ -151,8 +182,9 @@
t.ok(handler.last.x == testEvents.down.xy.x &&
handler.last.y == testEvents.down.xy.y,
"mouse down sets handler.last correctly");
OpenLayers.Event.stop = oldStop;
OpenLayers.Event.isLeftClick = oldIsLeftClick;
OpenLayers.Event.stop = oldStop;
handler.checkModifiers = oldCheckModifiers;
// test mousemove

View File

@@ -150,26 +150,12 @@
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 2 map units / 500px = 0.004
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
* 0.087890625, 0.0439453125, 0.02197265625,
* 0.010986328125, 0.0054931640625, 0.00274658203125,
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
*
* So, we expect a zoom of 9 because it is the closest resolution.
*/
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 90 map units / 500px = 0.18
* So, we expect a zoom of 3 because it is the closest.
*/
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
}
function test_07_Layer_Grid_moveTo(t) {
@@ -555,10 +541,10 @@
map.zoomToMaxExtent();
map.zoomIn();
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
t.eq(bounds.toBBOX(), "-90,0,0,90", "get tile bounds returns correct bounds");
t.eq(bounds.toBBOX(), "-180,-90,0,90", "get tile bounds returns correct bounds");
map.pan(200,0);
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
t.eq(bounds.toBBOX(), "0,0,90,90", "get tile bounds returns correct bounds after pan");
t.eq(bounds.toBBOX(), "0,-90,180,90", "get tile bounds returns correct bounds after pan");
}
function test_Layer_Grid_moveTo_buffer_calculation (t) {

View File

@@ -128,26 +128,12 @@
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 2 map units / 500px = 0.004
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
* 0.087890625, 0.0439453125, 0.02197265625,
* 0.010986328125, 0.0054931640625, 0.00274658203125,
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
*
* So, we expect a zoom of 9 because it is the closest resolution.
*/
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 90 map units / 500px = 0.18
* So, we expect a zoom of 3 because it is the closest.
*/
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
}
function test_06_Layer_kaMap_mergeNewParams (t) {
@@ -250,10 +236,10 @@
map.zoomToMaxExtent();
map.zoomIn();
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
t.eq(bounds.toBBOX(), "-90,0,0,90", "get tile bounds returns correct bounds");
t.eq(bounds.toBBOX(), "-180,0,0,180", "get tile bounds returns correct bounds");
map.pan(200,0);
var bounds = layer.getTileBounds(new OpenLayers.Pixel(200,200));
t.eq(bounds.toBBOX(), "0,0,90,90", "get tile bounds returns correct bounds after pan");
t.eq(bounds.toBBOX(), "0,0,180,180", "get tile bounds returns correct bounds after pan");
}
function test_99_Layer_KaMap_destroy (t) {

View File

@@ -399,6 +399,17 @@
t.eq(parseFloat(tLayer.div.firstChild.firstChild.style.opacity), 0.6, "Opacity on tile is changed correctly");
}
// DEPRECATED -- REMOVE IN 3.0
function test_Layer_Untiled_MapServer(t) {
t.plan(1);
var layer = new OpenLayers.Layer.MapServer.Untiled();
var clone = layer.clone();
t.ok(clone.singleTile, "regression test: clone works. this is for #1013");
}
function test_99_Layer_MapServer_Untiled_destroy (t) {

View File

@@ -77,26 +77,13 @@
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 2 map units / 500px = 0.004
* layer.resolutions = [1.40625, 0.703125, 0.3515625, 0.17578125,
* 0.087890625, 0.0439453125, 0.02197265625,
* 0.010986328125, 0.0054931640625, 0.00274658203125,
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125]
*
* So, we expect a zoom of 9 because it is the closest resolution.
*/
t.eq( zoom, 9, "getZoomForExtent() returns correct value");
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 90 map units / 500px = 0.18
* So, we expect a zoom of 3 because it is the closest.
*/
t.eq( zoom, 3, "getZoomForExtent() returns correct value");
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
}
@@ -119,7 +106,7 @@
*/
function test_10_Layer_TMS_getURL(t) {
t.plan(2);
t.plan(3);
var map = new OpenLayers.Map('map', options);
var options = {'layername':'basic', 'type':'png'};
@@ -128,6 +115,12 @@
map.setCenter(new OpenLayers.LonLat(0,0), 9);
var tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.0.0/basic/9/261/192.png", "Tile URL is correct");
var layer2 = layer.clone();
layer2.serviceVersion = "1.2.3";
map.addLayer(layer2);
tileurl = layer2.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));
t.eq(tileurl, "http://labs.metacarta.com/wms-c/Basic.py/1.2.3/basic/9/261/192.png", "TMS serviceVersion is correct");
layer.url = ["http://tilecache1/", "http://tilecache2/", "http://tilecache3/"];
tileurl = layer.getURL(new OpenLayers.Bounds(3.515625,45,4.21875,45.703125));

View File

@@ -78,27 +78,13 @@
bounds = new OpenLayers.Bounds(10,10,12,12);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 2 map units / 500px = 0.004
* layer.resolutions = [0.703125, 0.3515625, 0.17578125,
* 0.087890625, 0.0439453125, 0.02197265625,
* 0.010986328125, 0.0054931640625, 0.00274658203125,
* 0.001373291015625, 0.0006866455078125, 0.00034332275390625,
* 0.000171661376953125, 0.0000858306884765625, 0.00004291534423828125,
* 0.000021457672119140625]
*
* So, we expect a zoom of 8 because it is the closest resolution.
*/
t.eq( zoom, 8, "getZoomForExtent() returns correct value");
t.eq( zoom, 7, "getZoomForExtent() returns correct value");
bounds = new OpenLayers.Bounds(10,10,100,100);
zoom = layer.getZoomForExtent(bounds);
/**
* ideal resolution: 90 map units / 500px = 0.18
* So, we expect a zoom of 2 because it is the closest.
*/
t.eq( zoom, 2, "getZoomForExtent() returns correct value");
t.eq( zoom, 1, "getZoomForExtent() returns correct value");
}

View File

@@ -352,6 +352,17 @@
map.destroy();
}
// DEPRECATED -- REMOVE IN 3.0
function test_Layer_Untiled_WMS(t) {
t.plan(1);
var layer = new OpenLayers.Layer.WMS.Untiled();
var clone = layer.clone();
t.ok(clone.singleTile, "regression test: clone works. this is for #1013");
}
function test_99_Layer_WMS_destroy (t) {

View File

@@ -131,9 +131,9 @@
var m = new OpenLayers.Map('map');
m.addLayer(layer);
m.zoomToMaxExtent();
t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C0%2C90%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world.");
t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C270%2C90%2C360&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat");
t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all.");
t.eq(layer.grid[3][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "cell [3][0] is wrapped around the world.");
t.eq(layer.grid[0][0].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "cell [0][0] is wrapped around the world lon, but not lat");
t.eq(layer.grid[0][3].url, "http://octo.metacarta.com/cgi-bin/mapserv?MAP=%2Fmapdata%2Fvmap_wms.map&LAYERS=basic&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "cell [3][0] is not wrapped at all.");
}
function test_Layer_WrapDateLine_KaMap (t) {
@@ -146,9 +146,9 @@
var m = new OpenLayers.Map('map');
m.addLayer(layer);
m.zoomToMaxExtent();
t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=110735960.625", "grid[0][0] kamap is okay");
t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=110735960.625", "grid[0][3] kamap is okay");
t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=110735960.625", "grid[3][0] is okay");
t.eq(layer.grid[0][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=0&s=221471921.25", "grid[0][0] kamap is okay");
t.eq(layer.grid[0][3].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-1280&l=-256&s=221471921.25", "grid[0][3] kamap is okay");
t.eq(layer.grid[3][0].url, "http://www.openlayers.org/world/index.php?g=satellite&map=world&i=jpeg&t=-512&l=0&s=221471921.25", "grid[3][0] is okay");
}
function test_Layer_WrapDateLine_WMS_Overlay (t) {
t.plan( 3 );
@@ -163,9 +163,9 @@
var m = new OpenLayers.Map('map');
m.addLayers([baselayer,layer]);
m.zoomToMaxExtent();
t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C270%2C90%2C360&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay");
t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-90%2C270%2C0%2C360&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay");
t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C0%2C90%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay");
t.eq(layer.grid[0][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C450%2C180%2C630&WIDTH=256&HEIGHT=256", "grid[0][0] wms overlay is okay");
t.eq(layer.grid[0][3].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-180%2C450%2C0%2C630&WIDTH=256&HEIGHT=256", "grid[0][3] wms overlay is okay");
t.eq(layer.grid[3][0].url, "http://www2.dmsolutions.ca/cgi-bin/mswms_gmap?LAYERS=bathymetry%2Cland_fn%2Cpark%2Cdrain_fn%2Cdrainage%2Cprov_bound%2Cfedlimit%2Crail%2Croad%2Cpopplace&TRANSPARENT=true&FORMAT=image%2Fpng&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=0%2C-90%2C180%2C90&WIDTH=256&HEIGHT=256", "grid[3][0] wms overlay okay");
}
</script>

View File

@@ -71,6 +71,7 @@
<li>Control/test_OverviewMap.html</li>
<li>Control/test_NavToolbar.html</li>
<li>Control/test_MouseToolbar.html</li>
<li>Control/test_MousePosition.html</li>
<li>Control/test_LayerSwitcher.html</li>
<li>Control/test_Panel.html</li>
<li>Control/test_PanZoom.html</li>

View File

@@ -155,7 +155,7 @@
function test_06_Layer_getZoomForResolution(t) {
t.plan(6);
t.plan(8);
var layer = new OpenLayers.Layer('Test Layer');
@@ -163,12 +163,16 @@
layer.resolutions = [128, 64, 32, 16, 8, 4, 2];
t.eq(layer.getZoomForResolution(200), 0, "zoom all the way out");
t.eq(layer.getZoomForResolution(65), 1, "index closest to 65");
t.eq(layer.getZoomForResolution(63), 1, "index closest to 63");
t.eq(layer.getZoomForResolution(25), 2, "zoom in middle");
t.eq(layer.getZoomForResolution(3), 5, "zoom allmost all the way in");
t.eq(layer.getZoomForResolution(1), 6, "zoom all the way in");
t.eq(layer.getZoomForResolution(65), 0, "smallest containing res");
t.eq(layer.getZoomForResolution(63), 1, "smallest containing res");
t.eq(layer.getZoomForResolution(65, true), 1, "closest res");
t.eq(layer.getZoomForResolution(63, true), 1, "closest res");
}
function test_07_Layer_redraw(t) {

View File

@@ -19,6 +19,13 @@
OpenLayers.Util.removeItem(array, 3);
t.eq( array.toString(), "1,2,4,5", "Util.removeItem works");
}
function test_03_Util_pagePosition(t) {
t.plan( 1 );
var pp = OpenLayers.Util.pagePosition(window);
t.eq( pp.toString(), "0,0", "Page position doesn't bail if passed 'window'")
}
function test_04_Util_createDiv(t) {
t.plan( 24 );