[OpenLayers-Commits] r4794 - in branches/openlayers/2.5: examples lib/OpenLayers lib/OpenLayers/Format lib/OpenLayers/Layer lib/OpenLayers/Layer/MapServer lib/OpenLayers/Layer/WMS tests tests/Format tests/Layer
commits at openlayers.org
commits at openlayers.org
Wed Oct 3 16:27:16 EDT 2007
Author: crschmidt
Date: 2007-10-03 16:27:15 -0400 (Wed, 03 Oct 2007)
New Revision: 4794
Modified:
branches/openlayers/2.5/examples/spherical-mercator.html
branches/openlayers/2.5/lib/OpenLayers/Format/GeoJSON.js
branches/openlayers/2.5/lib/OpenLayers/Format/GeoRSS.js
branches/openlayers/2.5/lib/OpenLayers/Layer/MapServer/Untiled.js
branches/openlayers/2.5/lib/OpenLayers/Layer/TMS.js
branches/openlayers/2.5/lib/OpenLayers/Layer/WFS.js
branches/openlayers/2.5/lib/OpenLayers/Layer/WMS/Untiled.js
branches/openlayers/2.5/lib/OpenLayers/Layer/Yahoo.js
branches/openlayers/2.5/lib/OpenLayers/Util.js
branches/openlayers/2.5/tests/Format/test_GeoJSON.html
branches/openlayers/2.5/tests/Format/test_GeoRSS.html
branches/openlayers/2.5/tests/Layer/test_MapServer.html
branches/openlayers/2.5/tests/Layer/test_TMS.html
branches/openlayers/2.5/tests/Layer/test_WMS.html
branches/openlayers/2.5/tests/test_Util.html
Log:
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)
Modified: branches/openlayers/2.5/examples/spherical-mercator.html
===================================================================
--- branches/openlayers/2.5/examples/spherical-mercator.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/examples/spherical-mercator.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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()
Modified: branches/openlayers/2.5/lib/OpenLayers/Format/GeoJSON.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Format/GeoJSON.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Format/GeoJSON.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -93,9 +93,9 @@
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 @@
}
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 @@
}
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 @@
"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.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 @@
} 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
Modified: branches/openlayers/2.5/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Format/GeoRSS.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Format/GeoRSS.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -38,6 +38,13 @@
* "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
Modified: branches/openlayers/2.5/lib/OpenLayers/Layer/MapServer/Untiled.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Layer/MapServer/Untiled.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -40,5 +40,29 @@
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"
});
Modified: branches/openlayers/2.5/lib/OpenLayers/Layer/TMS.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Layer/TMS.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Layer/TMS.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -14,6 +14,12 @@
OpenLayers.Layer.TMS = OpenLayers.Class(OpenLayers.Layer.Grid, {
/**
+ * APIProperty: serviceVersion
+ * {String}
+ */
+ serviceVersion: "1.0.0",
+
+ /**
* APIProperty: isBaseLayer
* {Boolean}
*/
@@ -91,7 +97,7 @@
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);
Modified: branches/openlayers/2.5/lib/OpenLayers/Layer/WFS.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Layer/WFS.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Layer/WFS.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -255,6 +255,7 @@
this.tile = null;
this.tile = new OpenLayers.Tile.WFS(this, pos, tileBounds,
url, tileSize);
+ this.addTileMonitoringHooks(this.tile);
this.tile.draw();
}
}
Modified: branches/openlayers/2.5/lib/OpenLayers/Layer/WMS/Untiled.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Layer/WMS/Untiled.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Layer/WMS/Untiled.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -40,5 +40,29 @@
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"
});
Modified: branches/openlayers/2.5/lib/OpenLayers/Layer/Yahoo.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Layer/Yahoo.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Layer/Yahoo.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -91,6 +91,7 @@
var size = this.getMapObjectSizeFromOLSize(this.map.getSize());
this.mapObject = new YMap(this.div, this.type, size);
this.mapObject.disableKeyControls();
+ this.mapObject.disableDragMap();
} catch(e) {}
},
Modified: branches/openlayers/2.5/lib/OpenLayers/Util.js
===================================================================
--- branches/openlayers/2.5/lib/OpenLayers/Util.js 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/lib/OpenLayers/Util.js 2007-10-03 20:27:15 UTC (rev 4794)
@@ -991,7 +991,12 @@
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;
}
}
Modified: branches/openlayers/2.5/tests/Format/test_GeoJSON.html
===================================================================
--- branches/openlayers/2.5/tests/Format/test_GeoJSON.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/Format/test_GeoJSON.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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",
Modified: branches/openlayers/2.5/tests/Format/test_GeoRSS.html
===================================================================
--- branches/openlayers/2.5/tests/Format/test_GeoRSS.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/Format/test_GeoRSS.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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();
Modified: branches/openlayers/2.5/tests/Layer/test_MapServer.html
===================================================================
--- branches/openlayers/2.5/tests/Layer/test_MapServer.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/Layer/test_MapServer.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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) {
Modified: branches/openlayers/2.5/tests/Layer/test_TMS.html
===================================================================
--- branches/openlayers/2.5/tests/Layer/test_TMS.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/Layer/test_TMS.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -119,7 +119,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 +128,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));
Modified: branches/openlayers/2.5/tests/Layer/test_WMS.html
===================================================================
--- branches/openlayers/2.5/tests/Layer/test_WMS.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/Layer/test_WMS.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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) {
Modified: branches/openlayers/2.5/tests/test_Util.html
===================================================================
--- branches/openlayers/2.5/tests/test_Util.html 2007-10-03 20:11:50 UTC (rev 4793)
+++ branches/openlayers/2.5/tests/test_Util.html 2007-10-03 20:27:15 UTC (rev 4794)
@@ -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 );
More information about the Commits
mailing list