[OpenLayers-Commits] r11063 - in sandbox/tschaub/xdomain: . build
examples lib lib/OpenLayers lib/OpenLayers/BaseTypes
lib/OpenLayers/Control lib/OpenLayers/Format
lib/OpenLayers/Format/WFST
lib/OpenLayers/Format/WMSCapabilities lib/OpenLayers/Lang
lib/OpenLayers/Layer lib/OpenLayers/Layer/Google tests
tests/BaseTypes tests/Control tests/Format/WFST
tests/Format/WMSCapabilities tests/Layer theme/default
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Thu Jan 27 15:43:53 EST 2011
Author: tschaub
Date: 2011-01-27 12:43:53 -0800 (Thu, 27 Jan 2011)
New Revision: 11063
Added:
sandbox/tschaub/xdomain/examples/tile-origin.html
sandbox/tschaub/xdomain/examples/tile-origin.js
sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js
sandbox/tschaub/xdomain/tests/Format/WMSCapabilities/v1_1_1_WMSC.html
Removed:
sandbox/tschaub/xdomain/examples/tile-extent.html
sandbox/tschaub/xdomain/examples/tile-extent.js
Modified:
sandbox/tschaub/xdomain/
sandbox/tschaub/xdomain/build/library.cfg
sandbox/tschaub/xdomain/examples/bing-tiles.js
sandbox/tschaub/xdomain/examples/google-v3.html
sandbox/tschaub/xdomain/examples/google-v3.js
sandbox/tschaub/xdomain/examples/osm-google.html
sandbox/tschaub/xdomain/examples/sos.html
sandbox/tschaub/xdomain/lib/OpenLayers.js
sandbox/tschaub/xdomain/lib/OpenLayers/BaseTypes/Bounds.js
sandbox/tschaub/xdomain/lib/OpenLayers/Control/ModifyFeature.js
sandbox/tschaub/xdomain/lib/OpenLayers/Control/WMSGetFeatureInfo.js
sandbox/tschaub/xdomain/lib/OpenLayers/Format/WFST/v1.js
sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities.js
sandbox/tschaub/xdomain/lib/OpenLayers/Lang/en.js
sandbox/tschaub/xdomain/lib/OpenLayers/Lang/fr.js
sandbox/tschaub/xdomain/lib/OpenLayers/Layer.js
sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Bing.js
sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Google/v3.js
sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Grid.js
sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Vector.js
sandbox/tschaub/xdomain/lib/OpenLayers/Map.js
sandbox/tschaub/xdomain/lib/OpenLayers/Request.js
sandbox/tschaub/xdomain/tests/BaseTypes/Bounds.html
sandbox/tschaub/xdomain/tests/Control/ModifyFeature.html
sandbox/tschaub/xdomain/tests/Control/WMSGetFeatureInfo.html
sandbox/tschaub/xdomain/tests/Format/WFST/v1.html
sandbox/tschaub/xdomain/tests/Layer.html
sandbox/tschaub/xdomain/tests/Layer/Bing.html
sandbox/tschaub/xdomain/tests/Layer/WMS.html
sandbox/tschaub/xdomain/tests/Map.html
sandbox/tschaub/xdomain/tests/Request.html
sandbox/tschaub/xdomain/tests/list-tests.html
sandbox/tschaub/xdomain/theme/default/google.css
sandbox/tschaub/xdomain/theme/default/style.css
Log:
merging log:trunk/openlayers#11030:11062
Property changes on: sandbox/tschaub/xdomain
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10940-11028
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:10940-11028,11030-11062
Modified: sandbox/tschaub/xdomain/build/library.cfg
===================================================================
--- sandbox/tschaub/xdomain/build/library.cfg 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/build/library.cfg 2011-01-27 20:43:53 UTC (rev 11063)
@@ -1,6 +1,5 @@
# This file includes the OpenLayers code to create a build for everything that
-# does not require vector support. build.py uses this profile if no other one
-# is specified.
+# does not require vector support.
[first]
Modified: sandbox/tschaub/xdomain/examples/bing-tiles.js
===================================================================
--- sandbox/tschaub/xdomain/examples/bing-tiles.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/bing-tiles.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -6,7 +6,10 @@
var road = new OpenLayers.Layer.Bing({
key: apiKey,
- type: "Road"
+ type: "Road",
+ // custom metadata parameter to request the new map style - only useful
+ // before May 1st, 2011
+ metadataParams: {mapVersion: "v1"}
});
var aerial = new OpenLayers.Layer.Bing({
key: apiKey,
Modified: sandbox/tschaub/xdomain/examples/google-v3.html
===================================================================
--- sandbox/tschaub/xdomain/examples/google-v3.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/google-v3.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -5,7 +5,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
- <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
+ <script src="http://maps.google.com/maps/api/js?v=3.3&sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="google-v3.js"></script>
</head>
@@ -19,6 +19,8 @@
</p>
<div id="map" class="smallmap"></div>
<div id="docs">
+ <p><input id="animate" type="checkbox" checked="checked">Animated
+ zoom (if supported by GMaps on your device)</input></p>
<p>
If you use the Google Maps v3 API with a Google layer, you don't
need to include an API key. This layer only works in the
Modified: sandbox/tschaub/xdomain/examples/google-v3.js
===================================================================
--- sandbox/tschaub/xdomain/examples/google-v3.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/google-v3.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -29,4 +29,12 @@
new OpenLayers.Projection("EPSG:4326"),
map.getProjectionObject()
), 5);
+
+ // add behavior to html
+ var animate = document.getElementById("animate");
+ animate.onclick = function() {
+ for (var i=map.layers.length-1; i>=0; --i) {
+ map.layers[i].animationEnabled = this.checked;
+ }
+ };
}
Modified: sandbox/tschaub/xdomain/examples/osm-google.html
===================================================================
--- sandbox/tschaub/xdomain/examples/osm-google.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/osm-google.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -5,7 +5,7 @@
<link rel="stylesheet" href="../theme/default/style.css" type="text/css">
<link rel="stylesheet" href="../theme/default/google.css" type="text/css">
<link rel="stylesheet" href="style.css" type="text/css">
- <script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
+ <script src="http://maps.google.com/maps/api/js?v=3.3&sensor=false"></script>
<script src="../lib/OpenLayers.js"></script>
<script src="osm-google.js"></script>
</head>
Modified: sandbox/tschaub/xdomain/examples/sos.html
===================================================================
--- sandbox/tschaub/xdomain/examples/sos.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/sos.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -1,6 +1,8 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
+ <title>SOS Client Example</title>
<link rel="stylesheet" href="../theme/default/style.css" type="text/css" />
+ <link rel="stylesheet" href="style.css" type="text/css" />
<style type="text/css">
.sosmap {
width: 768px;
Deleted: sandbox/tschaub/xdomain/examples/tile-extent.html
===================================================================
--- sandbox/tschaub/xdomain/examples/tile-extent.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/tile-extent.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -1,36 +0,0 @@
-<!DOCTYPE html>
-<html>
- <head>
- <title>OpenLayers Tile Extent Example</title>
- <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
- <link rel="stylesheet" href="../theme/default/google.css" type="text/css">
- <link rel="stylesheet" href="style.css" type="text/css">
- </head>
- <body>
- <h1 id="title">Tile Extent</h1>
- <div id="tags">
- grid, tileExtent
- </div>
- <p id="shortdesc">
- Demonstrates the use of the tileExtent property to differentiate
- between the maximum extent and the tile extent for a layer.
- </p>
- <div id="map" class="smallmap"></div>
- <div id="docs">
- <p>
- This example uses a layer that requests map tiles from a WMS
- that only generates image responses for requests that align with
- a particular tile lattice. In this case, the layer's
- <code>maxExtent</code> does not align with that tile lattice.
- To configure the layer with a tile extent that conforms to the
- tile extent configured on the server, use the layer's
- <code>tileExtent</code> property.
- </p><p>
- View the <a href="tile-extent.js" target="_blank">tile-extent.js</a>
- source to see how this is done
- </p>
- </div>
- <script src="../lib/OpenLayers.js"></script>
- <script src="tile-extent.js"></script>
- </body>
-</html>
Deleted: sandbox/tschaub/xdomain/examples/tile-extent.js
===================================================================
--- sandbox/tschaub/xdomain/examples/tile-extent.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/examples/tile-extent.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -1,16 +0,0 @@
-var map = new OpenLayers.Map({
- div: "map",
- maxExtent: new OpenLayers.Bounds(-130, 30, -80, 55),
- maxResolution: 360 / 256 / Math.pow(2, 4),
- numZoomLevels: 12,
- layers: [
- new OpenLayers.Layer.WMS(
- "Global Imagery",
- "http://maps.opengeo.org/geowebcache/service/wms",
- {layers: "bluemarble"},
- {tileExtent: new OpenLayers.Bounds(-180, -90, 180, 90)}
- )
- ],
- center: new OpenLayers.LonLat(-110, 45),
- zoom: 0
-});
Copied: sandbox/tschaub/xdomain/examples/tile-origin.html (from rev 11062, trunk/openlayers/examples/tile-origin.html)
===================================================================
--- sandbox/tschaub/xdomain/examples/tile-origin.html (rev 0)
+++ sandbox/tschaub/xdomain/examples/tile-origin.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Tile Origin Example</title>
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <link rel="stylesheet" href="../theme/default/google.css" type="text/css">
+ <link rel="stylesheet" href="style.css" type="text/css">
+ </head>
+ <body>
+ <h1 id="title">Tile Origin</h1>
+ <div id="tags">
+ grid, tileOrigin
+ </div>
+ <p id="shortdesc">
+ Demonstrates the use of the tileExtent property to differentiate
+ between the maximum extent and the tile extent for a layer.
+ </p>
+ <div id="map" class="smallmap"></div>
+ <div id="docs">
+ <p>
+ This example uses a layer that requests map tiles from a WMS
+ that only generates image responses for requests that align with
+ a particular tile lattice. In this case, the layer's
+ <code>maxExtent</code> does not align with that tile lattice.
+ To configure the layer with a tile extent that conforms to the
+ tile origin configured on the server, use the layer's
+ <code>tileOrigin</code> property.
+ </p><p>
+ View the <a href="tile-origin.js" target="_blank">tile-origin.js</a>
+ source to see how this is done
+ </p>
+ </div>
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="tile-origin.js"></script>
+ </body>
+</html>
Copied: sandbox/tschaub/xdomain/examples/tile-origin.js (from rev 11062, trunk/openlayers/examples/tile-origin.js)
===================================================================
--- sandbox/tschaub/xdomain/examples/tile-origin.js (rev 0)
+++ sandbox/tschaub/xdomain/examples/tile-origin.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -0,0 +1,16 @@
+var map = new OpenLayers.Map({
+ div: "map",
+ maxExtent: new OpenLayers.Bounds(-130, 30, -80, 55),
+ maxResolution: 360 / 256 / Math.pow(2, 4),
+ numZoomLevels: 12,
+ layers: [
+ new OpenLayers.Layer.WMS(
+ "Global Imagery",
+ "http://maps.opengeo.org/geowebcache/service/wms",
+ {layers: "bluemarble"},
+ {tileOrigin: new OpenLayers.LonLat(-180, -90)}
+ )
+ ],
+ center: new OpenLayers.LonLat(-110, 45),
+ zoom: 0
+});
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/BaseTypes/Bounds.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/BaseTypes/Bounds.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/BaseTypes/Bounds.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -615,14 +615,15 @@
*
* Parameters:
* str - {String}Comma-separated bounds string. (ex. <i>"5,42,10,45"</i>)
+ * reverseAxisOrder - {Boolean} Does the string use reverse axis order?
*
* Returns:
* {<OpenLayers.Bounds>} New bounds object built from the
* passed-in String.
*/
-OpenLayers.Bounds.fromString = function(str) {
+OpenLayers.Bounds.fromString = function(str, reverseAxisOrder) {
var bounds = str.split(",");
- return OpenLayers.Bounds.fromArray(bounds);
+ return OpenLayers.Bounds.fromArray(bounds, reverseAxisOrder);
};
/**
@@ -632,12 +633,18 @@
*
* Parameters:
* bbox - {Array(Float)} Array of bounds values (ex. <i>[5,42,10,45]</i>)
+ * reverseAxisOrder - {Boolean} Does the array use reverse axis order?
*
* Returns:
* {<OpenLayers.Bounds>} New bounds object built from the passed-in Array.
*/
-OpenLayers.Bounds.fromArray = function(bbox) {
- return new OpenLayers.Bounds(parseFloat(bbox[0]),
+OpenLayers.Bounds.fromArray = function(bbox, reverseAxisOrder) {
+ return reverseAxisOrder === true ?
+ new OpenLayers.Bounds(parseFloat(bbox[1]),
+ parseFloat(bbox[0]),
+ parseFloat(bbox[3]),
+ parseFloat(bbox[2])) :
+ new OpenLayers.Bounds(parseFloat(bbox[0]),
parseFloat(bbox[1]),
parseFloat(bbox[2]),
parseFloat(bbox[3]));
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Control/ModifyFeature.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Control/ModifyFeature.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Control/ModifyFeature.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -608,6 +608,11 @@
vertex.geometry.parent) {
// remove the vertex
vertex.geometry.parent.removeComponent(vertex.geometry);
+ this.layer.events.triggerEvent("vertexremoved", {
+ vertex: vertex.geometry,
+ feature: this.feature,
+ pixel: evt.xy
+ });
this.layer.drawFeature(this.feature, this.standalone ?
undefined :
this.selectControl.renderIntent);
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Control/WMSGetFeatureInfo.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Control/WMSGetFeatureInfo.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Control/WMSGetFeatureInfo.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -370,13 +370,13 @@
}, (parseFloat(firstLayer.params.VERSION) >= 1.3) ?
{
crs: projection,
- i: clickPosition.x,
- j: clickPosition.y
+ i: parseInt(clickPosition.x),
+ j: parseInt(clickPosition.y)
} :
{
srs: projection,
- x: clickPosition.x,
- y: clickPosition.y
+ x: parseInt(clickPosition.x),
+ y: parseInt(clickPosition.y)
}
);
OpenLayers.Util.applyDefaults(params, this.vendorParams);
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Format/WFST/v1.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Format/WFST/v1.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Format/WFST/v1.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -253,8 +253,9 @@
// add in geometry
if (this.geometryName !== null) {
+ this.srsName = this.getSrsName(feature);
this.writeNode(
- "Property", {name: this.geometryName, value: feature}, node
+ "Property", {name: this.geometryName, value: feature.geometry}, node
);
}
@@ -287,10 +288,9 @@
},
"Value": function(obj) {
var node;
- if(obj instanceof OpenLayers.Feature.Vector) {
+ if(obj instanceof OpenLayers.Geometry) {
node = this.createElementNSPlus("wfs:Value");
- this.srsName = this.getSrsName(obj);
- var geom = this.writeNode("feature:_geometry", obj.geometry).firstChild;
+ var geom = this.writeNode("feature:_geometry", obj).firstChild;
node.appendChild(geom);
} else {
node = this.createElementNSPlus("wfs:Value", {value: obj});
Copied: sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js (from rev 11062, trunk/openlayers/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js)
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js (rev 0)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -0,0 +1,90 @@
+/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+ * full list of contributors). Published under the Clear BSD license.
+ * See http://svn.openlayers.org/trunk/openlayers/license.txt for the
+ * full text of the license. */
+
+/**
+ * @requires OpenLayers/Format/WMSCapabilities/v1_1_1.js
+ */
+
+/**
+ * Class: OpenLayers.Format.WMSCapabilities/v1_1_1_WMSC
+ * Read WMS-C Capabilities version 1.1.1.
+ *
+ * Inherits from:
+ * - <OpenLayers.Format.WMSCapabilities.v1_1_1>
+ */
+OpenLayers.Format.WMSCapabilities.v1_1_1_WMSC = OpenLayers.Class(
+ OpenLayers.Format.WMSCapabilities.v1_1_1, {
+
+ /**
+ * Property: version
+ * {String} The specific parser version.
+ */
+ version: "1.1.1",
+
+ /**
+ * Property: profile
+ * {String} The specific profile
+ */
+ profile: "WMSC",
+
+ /**
+ * Constructor: OpenLayers.Format.WMSCapabilities.v1_1_1
+ * Create a new parser for WMS-C capabilities version 1.1.1.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
+ initialize: function(options) {
+ OpenLayers.Format.WMSCapabilities.v1_1_1.prototype.initialize.apply(
+ this, [options]
+ );
+ },
+
+ /**
+ * Property: readers
+ * Contains public functions, grouped by namespace prefix, that will
+ * be applied when a namespaced node is found matching the function
+ * name. The function will be applied in the scope of this parser
+ * with two arguments: the node being read and a context object passed
+ * from the parent.
+ */
+ readers: {
+ "wms": OpenLayers.Util.applyDefaults({
+ "VendorSpecificCapabilities": function(node, obj) {
+ obj.vendorSpecific = {tileSets: []};
+ this.readChildNodes(node, obj.vendorSpecific);
+ },
+ "TileSet": function(node, vendorSpecific) {
+ var tileset = {srs: {}, bbox: {}, resolutions: []};
+ this.readChildNodes(node, tileset);
+ vendorSpecific.tileSets.push(tileset);
+ },
+ "Resolutions": function(node, tileset) {
+ var res = this.getChildValue(node).split(" ");
+ for (var i=0, len=res.length; i<len; i++) {
+ if (res[i] != "") {
+ tileset.resolutions.push(parseFloat(res[i]));
+ }
+ }
+ },
+ "Width": function(node, tileset) {
+ tileset.width = parseInt(this.getChildValue(node));
+ },
+ "Height": function(node, tileset) {
+ tileset.height = parseInt(this.getChildValue(node));
+ },
+ "Layers": function(node, tileset) {
+ tileset.layers = this.getChildValue(node);
+ },
+ "Styles": function(node, tileset) {
+ tileset.styles = this.getChildValue(node);
+ }
+ }, OpenLayers.Format.WMSCapabilities.v1_1_1.prototype.readers["wms"])
+ },
+
+ CLASS_NAME: "OpenLayers.Format.WMSCapabilities.v1_1_1_WMSC"
+
+});
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Format/WMSCapabilities.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -29,6 +29,15 @@
version: null,
/**
+ * APIProperty: profile
+ * {String} If provided, use a custom profile.
+ *
+ * Currently supported profiles:
+ * - WMSC - parses vendor specific capabilities for WMS-C.
+ */
+ profile: null,
+
+ /**
* Property: parser
* {<OpenLayers.Format>} A cached versioned format used for reading.
*/
@@ -63,12 +72,14 @@
}
var root = data.documentElement;
var version = this.version || root.getAttribute("version") || this.defaultVersion;
+ var profile = this.profile ? "_" + this.profile : "";
if(!this.parser || this.parser.version !== version) {
var constr = OpenLayers.Format.WMSCapabilities[
- "v" + version.replace(/\./g, "_")
+ "v" + version.replace(/\./g, "_") + profile
];
if(!constr) {
- throw "Can't find a WMS capabilities parser for version " + version;
+ throw "Can't find a WMS capabilities parser for version " +
+ version + profile;
}
this.parser = new constr(this.options);
}
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Lang/en.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Lang/en.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Lang/en.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -122,6 +122,9 @@
// console message
'filterEvaluateNotImplemented': "evaluate is not implemented for this filter type.",
+ 'proxyNeeded': "You probably need to set OpenLayers.ProxyHost to access ${url}."+
+ "See http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost",
+
// **** end ****
'end': ''
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Lang/fr.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Lang/fr.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Lang/fr.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -75,6 +75,7 @@
'pagePositionFailed': "OpenLayers.Util.pagePosition a échoué: l\'élément d\'id ${elemId} pourrait être mal positionné.",
- 'filterEvaluateNotImplemented': "évaluer n\'a pas encore été implémenté pour ce type de filtre."
+ 'filterEvaluateNotImplemented': "évaluer n\'a pas encore été implémenté pour ce type de filtre.",
+ 'proxyNeeded': "Vous avez très probablement besoin de renseigner OpenLayers.ProxyHost pour accéder à ${url}. Voir http://trac.osgeo.org/openlayers/wiki/FrequentlyAskedQuestions#ProxyHost"
});
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Bing.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Bing.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Bing.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -42,28 +42,13 @@
* used. Default is "Road".
*/
type: "Road",
-
+
/**
- * Constant: EVENT_TYPES
- * {Array(String)} Supported application event types. Register a listener
- * for a particular event with the following syntax:
- * (code)
- * layer.events.register(type, obj, listener);
- * (end)
- *
- * Listeners will be called with a reference to an event object. The
- * properties of this event depends on exactly what happened.
- *
- * All event objects have at least the following properties:
- * object - {Object} A reference to layer.events.object.
- * element - {DOMElement} A reference to layer.events.element.
- *
- * Supported map event types (in addition to those from <OpenLayers.Layer>):
- * added - Triggered after the layer is added to a map. Listeners
- * will receive an object with a *map* property referencing the
- * map and a *layer* property referencing the layer.
+ * APIProperty: metadataParams
+ * {Object} Optional url parameters for the Get Imagery Metadata request
+ * as described here: http://msdn.microsoft.com/en-us/library/ff701716.aspx
*/
- EVENT_TYPES: ["added"],
+ metadataParams: null,
/**
* Constructor: OpenLayers.Layer.Bing
@@ -91,40 +76,34 @@
* Any other documented layer properties can be provided in the config object.
*/
initialize: function(options) {
- // concatenate events specific to vector with those from the base
- this.EVENT_TYPES =
- OpenLayers.Layer.Bing.prototype.EVENT_TYPES.concat(
- OpenLayers.Layer.prototype.EVENT_TYPES
- );
-
options = OpenLayers.Util.applyDefaults({
- zoomOffset: 1,
- maxResolution: 78271.51695,
+ restrictedMinZoom: 1,
sphericalMercator: true
}, options)
var name = options.name || "Bing " + (options.type || this.type);
var newArgs = [name, null, options];
OpenLayers.Layer.XYZ.prototype.initialize.apply(this, newArgs);
- this.loadMetadata(this.type);
+ this.loadMetadata();
},
/**
* Method: loadMetadata
- *
- * Parameters:
- * imageryType - {String}
*/
- loadMetadata: function(imageryType) {
+ loadMetadata: function() {
this._callbackId = "_callback_" + this.id.replace(/\./g, "_");
// link the processMetadata method to the global scope and bind it
// to this instance
window[this._callbackId] = OpenLayers.Function.bind(
OpenLayers.Layer.Bing.processMetadata, this
);
+ var params = OpenLayers.Util.applyDefaults({
+ key: this.key,
+ jsonp: this._callbackId,
+ include: "ImageryProviders"
+ }, this.metadataParams);
var url = "http://dev.virtualearth.net/REST/v1/Imagery/Metadata/" +
- imageryType + "?key=" + this.key + "&jsonp=" + this._callbackId +
- "&include=ImageryProviders";
+ this.type + "?" + OpenLayers.Util.getParameterString(params);
var script = document.createElement("script");
script.type = "text/javascript";
script.src = url;
@@ -144,20 +123,11 @@
for (var i=0; i<res.imageUrlSubdomains.length; ++i) {
this.url.push(url.replace("{subdomain}", res.imageUrlSubdomains[i]));
};
- var resolution;
- if (this.map && this.map.baseLayer === this && this.map.getCenter()) {
- // if we are the current base layer and the map was centered
- // already, we need to remember the current resolution to find a
- // matching zoom level after the maxResolution changes
- resolution = this.getResolution();
- }
this.addOptions({
- maxResolution: 78271.51695 / Math.pow(2, res.zoomMin - 1),
- numZoomLevels: res.zoomMax - res.zoomMin + 1
+ restrictedMinZoom: res.zoomMin,
+ numZoomLevels: res.zoomMax + 1
});
- // adjust zoom level to match the previous resolution - this triggers a
- // moveTo on all layers.
- resolution && this.map.zoomTo(this.getZoomForResolution(resolution));
+ this.updateAttribution();
// redraw to replace "blank.gif" tiles with real tiles
this.redraw();
},
@@ -199,7 +169,7 @@
*/
updateAttribution: function() {
var metadata = this.metadata;
- if (!metadata || !this.map) {
+ if (!metadata || !this.map || !this.map.center) {
return;
}
var res = metadata.resourceSets[0].resources[0];
@@ -233,13 +203,8 @@
*/
setMap: function() {
OpenLayers.Layer.XYZ.prototype.setMap.apply(this, arguments);
- if (this.map.getCenter()) {
- this.updateAttribution();
- }
+ this.updateAttribution();
this.map.events.register("moveend", this, this.updateAttribution);
- // TODO: move this event to Layer
- // http://trac.osgeo.org/openlayers/ticket/2983
- this.events.triggerEvent("added", {map: this.map, layer: this});
},
/**
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Google/v3.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Google/v3.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Google/v3.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -51,6 +51,19 @@
projection: "EPSG:900913"
},
+ /**
+ * APIProperty: animationEnabled
+ * {Boolean} If set to true, the transition between zoom levels will be
+ * animated (if supported by the GMaps API for the device used). Set to
+ * false to match the zooming experience of other layer types. Default
+ * is true. Note that the GMaps API does not give us control over zoom
+ * animation, so if set to false, when zooming, this will make the
+ * layer temporarily invisible, wait until GMaps reports the map being
+ * idle, and make it visible again. The result will be a blank layer
+ * for a few moments while zooming.
+ */
+ animationEnabled: true,
+
/**
* Method: loadMapObject
* Load the GMap and register appropriate event listeners. If we can't
@@ -134,6 +147,11 @@
var cache = OpenLayers.Layer.Google.cache[this.map.id];
var container = this.map.viewPortDiv;
+
+ // move the Map Data popup to the container, if any
+ while (div.lastChild.style.display == "none") {
+ container.appendChild(div.lastChild);
+ }
// move the ToS and branding stuff up to the container div
var termsOfUse = div.lastChild;
@@ -335,6 +353,17 @@
* zoom - {int} MapObject zoom format
*/
setMapObjectCenter: function(center, zoom) {
+ if (this.animationEnabled === false && zoom != this.mapObject.zoom) {
+ var mapContainer = this.getMapContainer();
+ google.maps.event.addListenerOnce(
+ this.mapObject,
+ "idle",
+ function() {
+ mapContainer.style.visibility = "";
+ }
+ );
+ mapContainer.style.visibility = "hidden";
+ }
this.mapObject.setOptions({
center: center,
zoom: zoom
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Grid.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Grid.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -24,12 +24,26 @@
* {<OpenLayers.Size>}
*/
tileSize: null,
+
+ /**
+ * Property: tileOriginCorner
+ * {String} If the <tileOrigin> property is not provided, the tile origin
+ * will be derived from the layer's <maxExtent>. The corner of the
+ * <maxExtent> used is determined by this property. Acceptable values
+ * are "tl" (top left), "tr" (top right), "bl" (bottom left), and "br"
+ * (bottom right). Default is "bl".
+ */
+ tileOriginCorner: "bl",
/**
- * APIProperty: tileExtent
- * {<OpenLayers.Bounds>}
+ * APIProperty: tileOrigin
+ * {<OpenLayers.LonLat>} Optional origin for aligning the grid of tiles.
+ * If provided, requests for tiles at all resolutions will be aligned
+ * with this location (no tiles shall overlap this location). If
+ * not provided, the grid of tiles will be aligned with the layer's
+ * <maxExtent>. Default is ``null``.
*/
- tileExtent: null,
+ tileOrigin: null,
/** APIProperty: tileOptions
* {Object} optional configuration options for <OpenLayers.Tile> instances
@@ -315,32 +329,32 @@
/**
* Method: calculateGridLayout
- * Generate parameters for the grid layout. This
+ * Generate parameters for the grid layout.
*
* Parameters:
* bounds - {<OpenLayers.Bound>}
- * extent - {<OpenLayers.Bounds>}
+ * origin - {<OpenLayers.LonLat>}
* resolution - {Number}
*
* Returns:
* Object containing properties tilelon, tilelat, tileoffsetlat,
* tileoffsetlat, tileoffsetx, tileoffsety
*/
- calculateGridLayout: function(bounds, extent, resolution) {
+ calculateGridLayout: function(bounds, origin, resolution) {
var tilelon = resolution * this.tileSize.w;
var tilelat = resolution * this.tileSize.h;
- var offsetlon = bounds.left - extent.left;
+ var offsetlon = bounds.left - origin.lon;
var tilecol = Math.floor(offsetlon/tilelon) - this.buffer;
var tilecolremain = offsetlon/tilelon - tilecol;
var tileoffsetx = -tilecolremain * this.tileSize.w;
- var tileoffsetlon = extent.left + tilecol * tilelon;
+ var tileoffsetlon = origin.lon + tilecol * tilelon;
- var offsetlat = bounds.top - (extent.bottom + tilelat);
+ var offsetlat = bounds.top - (origin.lat + tilelat);
var tilerow = Math.ceil(offsetlat/tilelat) + this.buffer;
var tilerowremain = tilerow - offsetlat/tilelat;
var tileoffsety = -tilerowremain * this.tileSize.h;
- var tileoffsetlat = extent.bottom + tilerow * tilelat;
+ var tileoffsetlat = origin.lat + tilerow * tilelat;
return {
tilelon: tilelon, tilelat: tilelat,
@@ -349,6 +363,32 @@
};
},
+
+ /**
+ * Method: getTileOrigin
+ * Determine the origin for aligning the grid of tiles. If a <tileOrigin>
+ * property is supplied, that will be returned. Otherwise, the origin
+ * will be derived from the layer's <maxExtent> property. In this case,
+ * the tile origin will be the corner of the <maxExtent> given by the
+ * <tileOriginCorner> property.
+ *
+ * Returns:
+ * {<OpenLayers.LonLat>} The tile origin.
+ */
+ getTileOrigin: function() {
+ var origin = this.tileOrigin;
+ if (!origin) {
+ var extent = this.getMaxExtent();
+ var edges = ({
+ "tl": ["left", "top"],
+ "tr": ["right", "top"],
+ "bl": ["left", "bottom"],
+ "br": ["right", "bottom"]
+ })[this.tileOriginCorner];
+ origin = new OpenLayers.LonLat(extent[edges[0]], extent[edges[1]]);
+ }
+ return origin;
+ },
/**
* Method: initGriddedTiles
@@ -367,10 +407,10 @@
var minCols = Math.ceil(viewSize.w/this.tileSize.w) +
Math.max(1, 2 * this.buffer);
- var extent = this.getMaxExtent();
+ var origin = this.getTileOrigin();
var resolution = this.map.getResolution();
- var tileLayout = this.calculateGridLayout(bounds, extent, resolution);
+ var tileLayout = this.calculateGridLayout(bounds, origin, resolution);
var tileoffsetx = Math.round(tileLayout.tileoffsetx); // heaven help us
var tileoffsety = Math.round(tileLayout.tileoffsety);
@@ -452,7 +492,7 @@
* {OpenLayers.Bounds}
*/
getMaxExtent: function() {
- return this.tileExtent || this.maxExtent;
+ return this.maxExtent;
},
/**
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Vector.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Layer/Vector.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -90,6 +90,12 @@
* property referencing the vertex modified (always a point geometry),
* and a *pixel* property referencing the pixel location of the
* modification.
+ * vertexremoved - Triggered when a vertex within any feature geometry
+ * has been deleted. Listeners will receive an object with a
+ * *feature* property referencing the modified feature, a *vertex*
+ * property referencing the vertex modified (always a point geometry),
+ * and a *pixel* property referencing the pixel location of the
+ * removal.
* sketchstarted - Triggered when a feature sketch bound for this layer
* is started. Listeners will receive an object with a *feature*
* property referencing the new sketch feature and a *vertex* property
@@ -110,8 +116,8 @@
"beforefeaturesremoved", "featureremoved", "featuresremoved",
"beforefeatureselected", "featureselected", "featureunselected",
"beforefeaturemodified", "featuremodified", "afterfeaturemodified",
- "vertexmodified", "sketchstarted", "sketchmodified",
- "sketchcomplete", "refresh"],
+ "vertexmodified", "vertexremoved", "sketchstarted",
+ "sketchmodified", "sketchcomplete", "refresh"],
/**
* APIProperty: isBaseLayer
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Layer.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Layer.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -81,9 +81,15 @@
* moveend - Triggered when layer is done moving, object passed as
* argument has a zoomChanged boolean property which tells that the
* zoom has changed.
+ * added - Triggered after the layer is added to a map. Listeners will
+ * receive an object with a *map* property referencing the map and a
+ * *layer* property referencing the layer.
+ * removed - Triggered after the layer is removed from the map. Listeners
+ * will receive an object with a *map* property referencing the map and
+ * a *layer* property referencing the layer.
*/
EVENT_TYPES: ["loadstart", "loadend", "loadcancel", "visibilitychanged",
- "move", "moveend"],
+ "move", "moveend", "added", "removed"],
/**
* Constant: RESOLUTION_PROPERTIES
@@ -268,6 +274,18 @@
* {Integer}
*/
numZoomLevels: null,
+
+ /**
+ * Property: restrictedMinZoom
+ * {Integer} Restriction of the minimum zoom level. This is used for layers
+ * that only use a subset of the resolutions in the <resolutions>
+ * array. This is independent of <numResolutions>, which always starts
+ * counting at zoom level 0. If restrictedMinZoom is e.g. set to 2,
+ * the first two zoom levels (0 and 1) will not be used by this layer.
+ * If the layer is a base layer, zooming to the map's maxExtent means
+ * setting the map's zoom to 2.
+ */
+ restrictedMinZoom: 0,
/**
* APIProperty: minScale
@@ -734,7 +752,8 @@
} else {
if (this.map) {
var resolution = this.map.getResolution();
- inRange = ( (resolution >= this.minResolution) &&
+ inRange = ( this.map.getZoom() >= this.restrictedMinZoom &&
+ (resolution >= this.minResolution) &&
(resolution <= this.maxResolution) );
}
}
@@ -1165,7 +1184,7 @@
}
zoom = Math.max(0, i-1);
}
- return zoom;
+ return Math.max(this.restrictedMinZoom, zoom);
},
/**
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Map.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Map.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Map.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -943,6 +943,7 @@
}
this.events.triggerEvent("addlayer", {layer: layer});
+ layer.events.triggerEvent("added", {map: this, layer: layer});
layer.afterAdd();
},
@@ -1017,6 +1018,7 @@
this.resetLayersZIndex();
this.events.triggerEvent("removelayer", {layer: layer});
+ layer.events.triggerEvent("removed", {map: this, layer: layer})
},
/**
@@ -1798,8 +1800,8 @@
* within the min/max range of zoom levels.
*/
isValidZoomLevel: function(zoomLevel) {
- return ( (zoomLevel != null) &&
- (zoomLevel >= 0) &&
+ return ( (zoomLevel != null) &&
+ (zoomLevel >= this.getRestrictedMinZoom()) &&
(zoomLevel < this.getNumZoomLevels()) );
},
@@ -1904,6 +1906,20 @@
},
/**
+ * Method: getRestricteMinZoom
+ *
+ * Returns:
+ * {Integer} the minimum zoom level allowed for the current baseLayer.
+ */
+ getRestrictedMinZoom: function() {
+ var minZoom = null;
+ if (this.baseLayer != null) {
+ minZoom = this.baseLayer.restrictedMinZoom;
+ }
+ return minZoom;
+ },
+
+ /**
* APIMethod: getNumZoomLevels
*
* Returns:
Modified: sandbox/tschaub/xdomain/lib/OpenLayers/Request.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers/Request.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers/Request.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -36,6 +36,11 @@
},
/**
+ * Constant: URL_SPLIT_REGEX
+ */
+ URL_SPLIT_REGEX: /([^:]*:)\/\/([^:]*:?[^@]*@)?([^:\/\?]*):?([^\/\?]*)/,
+
+ /**
* APIProperty: events
* {<OpenLayers.Events>} An events object that handles all
* events on the {<OpenLayers.Request>} object.
@@ -128,11 +133,28 @@
url += separator + paramString;
}
}
- if(config.proxy && (url.indexOf("http") == 0)) {
- if(typeof config.proxy == "function") {
- url = config.proxy(url);
+ var sameOrigin = !(url.indexOf("http") == 0);
+ var urlParts = !sameOrigin && url.match(this.URL_SPLIT_REGEX);
+ if (urlParts) {
+ var location = window.location;
+ sameOrigin =
+ urlParts[1] == location.protocol &&
+ urlParts[3] == location.hostname;
+ var uPort = urlParts[4], lPort = location.port;
+ if (uPort != 80 && uPort != "" || lPort != "80" && lPort != "") {
+ sameOrigin = sameOrigin && uPort == lPort;
+ }
+ }
+ if (!sameOrigin) {
+ if (config.proxy) {
+ if (typeof config.proxy == "function") {
+ url = config.proxy(url);
+ } else {
+ url = config.proxy + encodeURIComponent(url);
+ }
} else {
- url = config.proxy + encodeURIComponent(url);
+ OpenLayers.Console.warn(
+ OpenLayers.i18n("proxyNeeded"), {url: url});
}
}
request.open(
Modified: sandbox/tschaub/xdomain/lib/OpenLayers.js
===================================================================
--- sandbox/tschaub/xdomain/lib/OpenLayers.js 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/lib/OpenLayers.js 2011-01-27 20:43:53 UTC (rev 11063)
@@ -287,6 +287,7 @@
"OpenLayers/Format/WMSCapabilities/v1_1_1.js",
"OpenLayers/Format/WMSCapabilities/v1_3.js",
"OpenLayers/Format/WMSCapabilities/v1_3_0.js",
+ "OpenLayers/Format/WMSCapabilities/v1_1_1_WMSC.js",
"OpenLayers/Format/WMSGetFeatureInfo.js",
"OpenLayers/Format/SOSCapabilities.js",
"OpenLayers/Format/SOSCapabilities/v1_0_0.js",
@@ -316,28 +317,15 @@
"OpenLayers/Lang/en.js"
); // etc.
- var agent = navigator.userAgent;
- var docWrite = (agent.match("MSIE") || agent.match("Safari"));
- if(docWrite) {
- var allScriptTags = new Array(jsfiles.length);
- }
+ // use "parser-inserted scripts" for guaranteed execution order
+ // http://hsivonen.iki.fi/script-execution/
+ var allScriptTags = new Array(jsfiles.length);
var host = OpenLayers._getScriptLocation() + "lib/";
for (var i=0, len=jsfiles.length; i<len; i++) {
- if (docWrite) {
- allScriptTags[i] = "<script src='" + host + jsfiles[i] +
+ allScriptTags[i] = "<script src='" + host + jsfiles[i] +
"'></script>";
- } else {
- var s = document.createElement("script");
- s.src = host + jsfiles[i];
- var h = document.getElementsByTagName("head").length ?
- document.getElementsByTagName("head")[0] :
- document.body;
- h.appendChild(s);
- }
}
- if (docWrite) {
- document.write(allScriptTags.join(""));
- }
+ document.write(allScriptTags.join(""));
}
})();
Modified: sandbox/tschaub/xdomain/tests/BaseTypes/Bounds.html
===================================================================
--- sandbox/tschaub/xdomain/tests/BaseTypes/Bounds.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/BaseTypes/Bounds.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -126,7 +126,7 @@
}
function test_Bounds_fromString(t) {
- t.plan( 10 );
+ t.plan( 12 );
bounds = OpenLayers.Bounds.fromString("1,2,3,4");
t.ok( bounds instanceof OpenLayers.Bounds, "new OpenLayers.Bounds returns Bounds object" );
t.eq( bounds.left, 1, "bounds.left is set correctly" );
@@ -134,13 +134,18 @@
t.eq( bounds.right, 3, "bounds.right is set correctly" );
t.eq( bounds.top, 4, "bounds.top is set correctly" );
+ // reverse axis order
+ var reverseBbox = bounds.toBBOX(null, true);
+ t.eq(reverseBbox, "2,1,4,3", "toBBOX with reverseAxisOrder set to true works as expected");
+ var boundsFromReverse = OpenLayers.Bounds.fromString(reverseBbox, true);
+ t.ok(bounds.equals(boundsFromReverse), "Bounds created from string with reverseAxisOrder are correct");
+
bounds = OpenLayers.Bounds.fromString("1.1,2.2,3.3,4.4");
t.ok( bounds instanceof OpenLayers.Bounds, "new OpenLayers.Bounds returns Bounds object" );
t.eq( bounds.left, 1.1, "bounds.left is set correctly" );
t.eq( bounds.bottom, 2.2, "bounds.bottom is set correctly" );
t.eq( bounds.right, 3.3, "bounds.right is set correctly" );
t.eq( bounds.top, 4.4, "bounds.top is set correctly" );
-
}
function test_Bounds_getSize(t) {
@@ -358,7 +363,7 @@
}
function test_Bounds_fromArray(t) {
- t.plan( 5 );
+ t.plan( 7 );
var bbox = [1,2,3,4];
bounds = OpenLayers.Bounds.fromArray(bbox);
@@ -367,6 +372,12 @@
t.eq( bounds.bottom, 2, "bounds.bottom is set correctly" );
t.eq( bounds.right, 3, "bounds.right is set correctly" );
t.eq( bounds.top, 4, "bounds.top is set correctly" );
+
+ // reverse axis order
+ var reverseBbox = bounds.toArray(true);
+ t.eq(reverseBbox, [2,1,4,3], "toArray with reverseAxisOrder set to true works as expected");
+ var boundsFromReverse = OpenLayers.Bounds.fromArray(reverseBbox, true);
+ t.ok(bounds.equals(boundsFromReverse), "Bounds created from array with reverseAxisOrder are correct");
}
function test_Bounds_fromSize(t) {
Modified: sandbox/tschaub/xdomain/tests/Control/ModifyFeature.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Control/ModifyFeature.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Control/ModifyFeature.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -74,7 +74,7 @@
}
function test_handleKeypress(t) {
- t.plan(11);
+ t.plan(14);
/**
* There are two things that we want to test here
@@ -108,9 +108,17 @@
"vertex deletion: removeComponent called on parent with proper geometry");
}
};
- layer.events.on({"featuremodified": function(event) {
- t.eq(event.feature.id, poly.id, "vertex deletion: featuremodifed triggered");
- }});
+ layer.events.on({
+ "featuremodified": function(event) {
+ t.eq(event.feature.id, poly.id, "vertex deletion: featuremodifed triggered");
+ },
+ "vertexremoved": function(evt) {
+ layer.events.unregister("vertexremoved", this, arguments.callee);
+ t.eq(evt.feature.id, poly.id, "vertexremoved triggered with correct feature");
+ t.eq(evt.vertex.id, point.geometry.id, "vertexremoved triggered with correct vertex");
+ t.eq(evt.pixel, "foo", "vertexremoved triggered with correct pixel");
+ }
+ });
layer.drawFeature = function(feature) {
t.eq(feature.id, poly.id,
"vertex deletion: drawFeature called with the proper feature");
@@ -123,7 +131,7 @@
"vertex deletion: onModification called with the proper feature");
};
// run the above four tests twice
- control.handleKeypress({keyCode:delKey});
+ control.handleKeypress({keyCode:delKey, xy: "foo"});
control.handleKeypress({keyCode:dKey});
t.eq(control.feature.state, OpenLayers.State.UPDATE, "feature state set to update");
Modified: sandbox/tschaub/xdomain/tests/Control/WMSGetFeatureInfo.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Control/WMSGetFeatureInfo.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Control/WMSGetFeatureInfo.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -233,7 +233,7 @@
// Verify that things work all right when we combine different types for the STYLES and LAYERS
// params in the WMS Layers involved
function test_mixedParams(t) {
- t.plan(3);
+ t.plan(5);
var map = new OpenLayers.Map("map", {
getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
}
@@ -271,10 +271,22 @@
log.options = options;
};
click.activate();
- click.getInfoForClick({xy: {x: 50, y: 50}});
+ click.getInfoForClick({xy: {x: 50.2, y: 50.1}});
OpenLayers.Request.GET = _request;
t.eq(
+ log.options && log.options.params.X,
+ 50,
+ "X should be an integer"
+ );
+
+ t.eq(
+ log.options && log.options.params.Y,
+ 50,
+ "Y should be an integer"
+ );
+
+ t.eq(
log.options && log.options.url,
"http://localhost/wms",
"url from first layer used"
@@ -506,7 +518,7 @@
log.options = options;
};
click.activate();
- click.getInfoForClick({xy: {x: 50, y: 60}});
+ click.getInfoForClick({xy: {x: 50.1, y: 60.2}});
OpenLayers.Request.GET = _request;
t.eq(
log.options && log.options.params.CRS,
Modified: sandbox/tschaub/xdomain/tests/Format/WFST/v1.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Format/WFST/v1.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Format/WFST/v1.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -89,6 +89,32 @@
}
}
+ function test_update_null_geometry(t) {
+ var format = new OpenLayers.Format.WFST({
+ featureNS: "http://www.openplans.org/topp",
+ featureType: "states",
+ featurePrefix: "topp",
+ geometryName: "the_geom"
+ });
+
+ var feature = new OpenLayers.Feature.Vector(null, {foo: "bar"});
+ feature.state = OpenLayers.State.UPDATE;
+ feature.fid = "fid.36";
+
+ t.plan(1);
+ var snippets = {
+ "UpdateNullGeometry": feature
+ };
+
+ var arg;
+ for (var snippet in snippets) {
+ arg = snippets[snippet]
+ var expected = readXML(snippet);
+ var got = format.writers["wfs"]["Update"].apply(format, [arg]);
+ t.xml_eq(got, expected, snippet + " request with null geometry created correctly");
+ }
+ }
+
function test_write_multiple(t) {
var format = new OpenLayers.Format.WFST({
@@ -232,5 +258,19 @@
</ogc:Filter>
</wfs:Update>
--></div>
+<div id="UpdateNullGeometry"><!--
+<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="topp:states" xmlns:topp="http://www.openplans.org/topp">
+ <wfs:Property>
+ <wfs:Name>the_geom</wfs:Name>
+ </wfs:Property>
+ <wfs:Property>
+ <wfs:Name>foo</wfs:Name>
+ <wfs:Value>bar</wfs:Value>
+ </wfs:Property>
+ <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
+ <ogc:FeatureId fid="fid.36"/>
+ </ogc:Filter>
+</wfs:Update>
+--></div>
</body>
</html>
Copied: sandbox/tschaub/xdomain/tests/Format/WMSCapabilities/v1_1_1_WMSC.html (from rev 11062, trunk/openlayers/tests/Format/WMSCapabilities/v1_1_1_WMSC.html)
===================================================================
--- sandbox/tschaub/xdomain/tests/Format/WMSCapabilities/v1_1_1_WMSC.html (rev 0)
+++ sandbox/tschaub/xdomain/tests/Format/WMSCapabilities/v1_1_1_WMSC.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -0,0 +1,212 @@
+<html>
+<head>
+ <script src="../../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+
+ function test_read(t) {
+
+ t.plan(9);
+
+ var xml = document.getElementById("wmsc").firstChild.nodeValue;
+ var doc = new OpenLayers.Format.XML().read(xml);
+ var format = new OpenLayers.Format.WMSCapabilities({profile: "WMSC"});
+ var obj = format.read(doc);
+ var tilesets = obj.capability.vendorSpecific.tileSets;
+ t.eq(tilesets.length, 2, "We expect 2 tilesets to be parsed");
+ var tileset = tilesets[0];
+ t.eq(tileset.bbox["EPSG:900913"].bbox, [-13697515.466796875, 5165920.118906248, -13619243.94984375, 5244191.635859374], "BBOX correctly parsed");
+ t.eq(tileset.format, "image/png", "Format correctly parsed");
+ t.eq(tileset.height, 256, "Height correctly parsed");
+ t.eq(tileset.width, 256, "Width correctly parsed");
+ t.eq(tileset.layers, "medford:hydro", "Layers correctly parsed");
+ t.eq(tileset.srs["EPSG:900913"], true, "SRS correctly parsed");
+ t.eq(tileset.resolutions, [156543.03390625, 78271.516953125, 39135.7584765625, 19567.87923828125, 9783.939619140625, 4891.9698095703125, 2445.9849047851562, 1222.9924523925781, 611.4962261962891, 305.74811309814453, 152.87405654907226, 76.43702827453613, 38.218514137268066, 19.109257068634033, 9.554628534317017, 4.777314267158508, 2.388657133579254, 1.194328566789627, 0.5971642833948135, 0.29858214169740677, 0.14929107084870338, 0.07464553542435169, 0.037322767712175846, 0.018661383856087923, 0.009330691928043961, 0.004665345964021981], "Resolutions correctly parsed");
+ t.eq(tileset.styles, "", "Styles correctly parsed");
+ }
+
+ </script>
+</head>
+<body>
+
+<div id="wmsc"><!--
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE WMT_MS_Capabilities SYSTEM "http://schemas.opengis.net/wms/1.1.1/capabilities_1_1_1.dtd"[
+<!ELEMENT VendorSpecificCapabilities (TileSet*) >
+<!ELEMENT TileSet (SRS, BoundingBox?, Resolutions, Width, Height, Format, Layers*, Styles*) >
+<!ELEMENT Resolutions (#PCDATA) >
+<!ELEMENT Width (#PCDATA) >
+<!ELEMENT Height (#PCDATA) >
+<!ELEMENT Layers (#PCDATA) >
+<!ELEMENT Styles (#PCDATA) >
+]>
+<WMT_MS_Capabilities version="1.1.1" updateSequence="57">
+ <Service>
+ <Name>OGC:WMS</Name>
+ <Title>GeoServer Web Map Service</Title>
+ <Abstract>A compliant implementation of WMS 1.1.1 plus most of the SLD 1.0 extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
+ <KeywordList>
+ <Keyword>WFS</Keyword>
+ <Keyword>WMS</Keyword>
+ <Keyword>GEOSERVER</Keyword>
+ </KeywordList>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms"/>
+ <ContactInformation>
+ <ContactPersonPrimary>
+ <ContactPerson>OpenGeo</ContactPerson>
+ <ContactOrganization>OpenGeo</ContactOrganization>
+ </ContactPersonPrimary>
+ <ContactPosition>Outreach</ContactPosition>
+ <ContactAddress>
+ <AddressType>Work</AddressType>
+ <Address/>
+ <City>New York</City>
+ <StateOrProvince/>
+ <PostCode/>
+ <Country>USA</Country>
+ </ContactAddress>
+ <ContactVoiceTelephone/>
+ <ContactFacsimileTelephone/>
+ <ContactElectronicMailAddress>inquiry at opengeo.org</ContactElectronicMailAddress>
+ </ContactInformation>
+ <Fees>NONE</Fees>
+ <AccessConstraints>NONE</AccessConstraints>
+ </Service>
+ <Capability>
+ <Request>
+ <GetCapabilities>
+ <Format>application/vnd.ogc.wms_xml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ <Post>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Post>
+ </HTTP>
+ </DCPType>
+ </GetCapabilities>
+ <GetMap>
+ <Format>image/png</Format>
+ <Format>application/atom xml</Format>
+ <Format>application/atom+xml</Format>
+ <Format>application/openlayers</Format>
+ <Format>application/pdf</Format>
+ <Format>application/rss xml</Format>
+ <Format>application/rss+xml</Format>
+ <Format>application/vnd.google-earth.kml</Format>
+ <Format>application/vnd.google-earth.kml xml</Format>
+ <Format>application/vnd.google-earth.kml+xml</Format>
+ <Format>application/vnd.google-earth.kmz</Format>
+ <Format>application/vnd.google-earth.kmz xml</Format>
+ <Format>application/vnd.google-earth.kmz+xml</Format>
+ <Format>atom</Format>
+ <Format>image/geotiff</Format>
+ <Format>image/geotiff8</Format>
+ <Format>image/gif</Format>
+ <Format>image/jpeg</Format>
+ <Format>image/png8</Format>
+ <Format>image/svg</Format>
+ <Format>image/svg xml</Format>
+ <Format>image/svg+xml</Format>
+ <Format>image/tiff</Format>
+ <Format>image/tiff8</Format>
+ <Format>kml</Format>
+ <Format>kmz</Format>
+ <Format>openlayers</Format>
+ <Format>rss</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </GetMap>
+ <GetFeatureInfo>
+ <Format>text/plain</Format>
+ <Format>application/vnd.ogc.gml</Format>
+ <Format>text/html</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ <Post>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Post>
+ </HTTP>
+ </DCPType>
+ </GetFeatureInfo>
+ <DescribeLayer>
+ <Format>application/vnd.ogc.wms_xml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </DescribeLayer>
+ <GetLegendGraphic>
+ <Format>image/png</Format>
+ <Format>image/jpeg</Format>
+ <Format>image/gif</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </GetLegendGraphic>
+ <GetStyles>
+ <Format>application/vnd.ogc.sld+xml</Format>
+ <DCPType>
+ <HTTP>
+ <Get>
+ <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:type="simple" xlink:href="http://localhost:8080/geoserver-suite/wms?SERVICE=WMS&"/>
+ </Get>
+ </HTTP>
+ </DCPType>
+ </GetStyles>
+ </Request>
+ <Exception>
+ <Format>application/vnd.ogc.se_xml</Format>
+ <Format>application/vnd.ogc.se_inimage</Format>
+ </Exception>
+ <VendorSpecificCapabilities>
+ <TileSet>
+ <SRS>EPSG:900913</SRS>
+ <BoundingBox SRS="EPSG:900913" minx="-1.3697515466796875E7" miny="5165920.118906248" maxx="-1.361924394984375E7" maxy="5244191.635859374"/>
+ <Resolutions>156543.03390625 78271.516953125 39135.7584765625 19567.87923828125 9783.939619140625 4891.9698095703125 2445.9849047851562 1222.9924523925781 611.4962261962891 305.74811309814453 152.87405654907226 76.43702827453613 38.218514137268066 19.109257068634033 9.554628534317017 4.777314267158508 2.388657133579254 1.194328566789627 0.5971642833948135 0.29858214169740677 0.14929107084870338 0.07464553542435169 0.037322767712175846 0.018661383856087923 0.009330691928043961 0.004665345964021981 </Resolutions>
+ <Width>256</Width>
+ <Height>256</Height>
+ <Format>image/png</Format>
+ <Layers>medford:hydro</Layers>
+ <Styles/>
+ </TileSet>
+ <TileSet>
+ <SRS>EPSG:4326</SRS>
+ <BoundingBox SRS="EPSG:4326" minx="-123.046875" miny="42.1875" maxx="-122.6953125" maxy="42.5390625"/>
+ <Resolutions>0.703125 0.3515625 0.17578125 0.087890625 0.0439453125 0.02197265625 0.010986328125 0.0054931640625 0.00274658203125 0.001373291015625 6.866455078125E-4 3.4332275390625E-4 1.71661376953125E-4 8.58306884765625E-5 4.291534423828125E-5 2.1457672119140625E-5 1.0728836059570312E-5 5.364418029785156E-6 2.682209014892578E-6 1.341104507446289E-6 6.705522537231445E-7 3.3527612686157227E-7 1.6763806343078613E-7 8.381903171539307E-8 4.190951585769653E-8 2.0954757928848267E-8 </Resolutions>
+ <Width>256</Width>
+ <Height>256</Height>
+ <Format>image/gif</Format>
+ <Layers>medford</Layers>
+ <Styles/>
+ </TileSet>
+ </VendorSpecificCapabilities>
+ <UserDefinedSymbolization SupportSLD="1" UserLayer="1" UserStyle="1" RemoteWFS="1"/>
+ <Layer queryable="0" opaque="0" noSubsets="0">
+ <Title>GeoServer Web Map Service</Title>
+ <Abstract>A compliant implementation of WMS 1.1.1 plus most of the SLD 1.0 extension (dynamic styling). Can also generate PDF, SVG, KML, GeoRSS</Abstract>
+ <SRS>EPSG:4326</SRS>
+ <SRS>EPSG:900913</SRS>
+ <LatLonBoundingBox minx="-180.0" miny="-90.0" maxx="180.0" maxy="83.624"/>
+ </Layer>
+ </Capability>
+</WMT_MS_Capabilities>
+--></div>
+</body>
+</html>
Modified: sandbox/tschaub/xdomain/tests/Layer/Bing.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Layer/Bing.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Layer/Bing.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -13,18 +13,20 @@
};
function test_constructor(t) {
- t.plan(2);
+ t.plan(3);
var origProcessMetadata = OpenLayers.Layer.Bing.processMetadata;
var log = [];
OpenLayers.Layer.Bing.processMetadata = function(metadata) {
- log.push(metadata);
+ var script = document.getElementById(this._callbackId);
+ log.push(script.src);
origProcessMetadata.apply(this, arguments);
};
- layer = new OpenLayers.Layer.Bing(options);
+ layer = new OpenLayers.Layer.Bing({metadataParams: {foo: "bar"}});
t.ok(layer instanceof OpenLayers.Layer.Bing, "returns OpenLayers.Layer.Bing object" );
- t.delay_call(2, function() {
+ t.delay_call(5, function() {
t.eq(log.length, 1, "processMetadata called");
+ t.eq(OpenLayers.Util.getParameters(log[0]).foo, "bar", "metadataParams passed to url correctly.");
OpenLayers.Layer.Bing.processMetadata = origProcessMetadata;
layer.destroy();
});
@@ -64,13 +66,13 @@
})]);
map2.zoomToMaxExtent();
- t.delay_call(2.0, function() {
+ t.delay_call(5, function() {
origProcessMetadata.call(layer, meta[0]);
t.eq(extent.toBBOX(), map.getExtent().toBBOX(), "layer extent correct for base layer with zoomMin == 1.");
map.destroy();
});
- t.delay_call(2.5, function() {
+ t.delay_call(6, function() {
origProcessMetadata.call(layer2, meta[1]);
t.eq(extent2.toBBOX(), map2.getExtent().toBBOX(), "layer extent correct for base layer with zoomMin == 2.");
map2.destroy();
Modified: sandbox/tschaub/xdomain/tests/Layer/WMS.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Layer/WMS.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Layer/WMS.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -380,7 +380,7 @@
}
- function test_tileExtent(t) {
+ function test_tileOrigin(t) {
t.plan(4);
var dummy = new OpenLayers.Layer(null, {isBaseLayer: true});
@@ -392,7 +392,7 @@
var constrained = new OpenLayers.Layer.WMS(
null, "http://example.com/wms-c",
{layers: "constrained"},
- {buffer: 0, isBaseLayer: false, tileExtent: new OpenLayers.Bounds(-180, -90, 180, 90)}
+ {buffer: 0, isBaseLayer: false, tileOrigin: new OpenLayers.LonLat(-180, -90)}
);
var map = new OpenLayers.Map({
div: "map",
Modified: sandbox/tschaub/xdomain/tests/Layer.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Layer.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Layer.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -556,7 +556,7 @@
function test_Layer_getZoomForResolution(t) {
- t.plan(12);
+ t.plan(13);
var layer = new OpenLayers.Layer('Test Layer');
layer.map = {};
@@ -584,6 +584,9 @@
"(fractionalZoom) doesn't return zoom below zero");
t.eq(layer.getZoomForResolution(1).toPrecision(6), (layer.resolutions.length - 1).toPrecision(6),
"(fractionalZoom) doesn't return zoom above highest index");
+
+ layer.restrictedMinZoom = 1;
+ t.eq(layer.getZoomForResolution(200), 1, "zoom all the way out, but we have a restrictedMinZoom of 1");
}
@@ -751,16 +754,27 @@
function test_afterAdd(t) {
- t.plan(1);
+ t.plan(4);
+ var log = [];
var map = new OpenLayers.Map("map");
- var layer = new OpenLayers.Layer(null, {isBaseLayer: true});
+ var layer = new OpenLayers.Layer(null, {
+ isBaseLayer: true,
+ eventListeners: {
+ "added": function(evt) {
+ log.push(evt);
+ }
+ }
+ });
var hasBase = false;
layer.afterAdd = function() {
hasBase = !!(layer.map && layer.map.baseLayer);
}
map.addLayer(layer);
t.eq(hasBase, true, "when afterAdd is called, map has a base layer");
+ t.eq(log.length, 1, "added event triggered");
+ t.eq(log[0].map.id, map.id, "added listener argument with correct map");
+ t.eq(log[0].layer.id, layer.id, "added listener argument with correct layer");
}
@@ -806,11 +820,18 @@
function test_Layer_destroy (t) {
- t.plan( 5 );
+ t.plan( 8 );
+ var log = [];
var map = new OpenLayers.Map('map');
- layer = new OpenLayers.Layer('Test Layer');
+ layer = new OpenLayers.Layer('Test Layer', {
+ eventListeners: {
+ "removed": function(evt) {
+ log.push(evt);
+ }
+ }
+ });
map.addLayer(layer);
@@ -822,6 +843,9 @@
t.eq( layer.options, null, "layer.options is null after destroy" );
t.eq(map.layers.length, 0, "layer removed from map");
+ t.eq(log.length, 1, "removed event triggered");
+ t.eq(log[0].map.id, map.id, "removed listener argument with correct map");
+ t.eq(log[0].layer.id, layer.id, "removed listener argument with correct layer");
map.destroy();
Modified: sandbox/tschaub/xdomain/tests/Map.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Map.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Map.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -326,6 +326,34 @@
}
*/
+ function test_Map_isValidZoomLevel(t) {
+ t.plan(6);
+ var map = new OpenLayers.Map("map");
+ map.addLayer(new OpenLayers.Layer(null, {
+ isBaseLayer: true, numZoomLevels: 19
+ }))
+ var valid;
+
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [0]);
+ t.eq(valid, true, "0 is a valid zoomLevel when baseLayer has no restrictedMinZoom");
+
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [18]);
+ t.eq(valid, true, "18 is a valid zoomLevel");
+
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [19]);
+ t.eq(valid, false, "19 is not a valid zoomLevel");
+
+ map.baseLayer.restrictedMinZoom = 1;
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [0]);
+ t.eq(valid, false, "0 is not a valid zoomLevel when baseLayer has restrictedMinZoom of 1");
+
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [1]);
+ t.eq(valid, true, "1 is a valid zoomLevel");
+
+ valid = OpenLayers.Map.prototype.isValidZoomLevel.apply(map, [19]);
+ t.eq(valid, false, "19 is not a valid zoomLevel when baseLayer has restrictedMinZoom of 1");
+ }
+
function test_Map_isValidLonLat(t) {
t.plan( 3 );
@@ -699,11 +727,12 @@
function test_Map_removeLayer(t) {
t.plan(1);
var f = function() {};
+ var events = {triggerEvent: f};
var layers = [
- {name: "fee", removeMap: f},
- {name: "fi", removeMap: f},
- {name: "fo", removeMap: f},
- {name: "fum", removeMap: f}
+ {name: "fee", removeMap: f, events: events},
+ {name: "fi", removeMap: f, events: events},
+ {name: "fo", removeMap: f, events: events},
+ {name: "fum", removeMap: f, events: events}
];
var map = {
layers: layers,
@@ -1233,6 +1262,27 @@
t.ok(maxExtent == map.baseLayer.maxExtent, "null options, valid baseLayer returns map.baseLayer.maxExtent");
}
+ function test_Map_getRestrictedMinZoom(t){
+ t.plan(3);
+
+ var map = {};
+
+ //no baseLayer
+ var minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
+ t.eq(minZoom, null, "no baseLayer returns null");
+
+ map.baseLayer = new OpenLayers.Layer(null, {isBaseLayer: true});
+
+ //baseLayer
+ minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
+ t.eq(minZoom, 0, "default baseLayer.restrictedMinZoom returns 0");
+
+ //custom minZoomLevel on baseLayer
+ map.baseLayer.restrictedMinZoom = 1;
+ minZoom = OpenLayers.Map.prototype.getRestrictedMinZoom.apply(map);
+ t.eq(minZoom, map.baseLayer.restrictedMinZoom, "custom baseLayer.restrictedMinZoom returns map.baseLayer.restrictedMinZoom");
+ }
+
function test_Map_zoomToMaxExtent(t){
t.plan(4)
Modified: sandbox/tschaub/xdomain/tests/Request.html
===================================================================
--- sandbox/tschaub/xdomain/tests/Request.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/Request.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -319,7 +319,7 @@
}
function test_ProxyHost(t) {
- t.plan(4);
+ t.plan(5);
/*
* Setup
@@ -334,6 +334,7 @@
var proto = OpenLayers.Request.XMLHttpRequest.prototype;
var _open = proto.open;
var log = [];
+ var port;
proto.open = function(method, url, async, user, password) {
log.push(url);
};
@@ -349,9 +350,17 @@
OpenLayers.Request.GET({url: "http://bar?k1=v1&k2=v2"});
t.eq(log.length, 1, "[1] XHR.open called once");
t.eq(log[0], expectedURL, "[1] the URL used for XHR is correct (" + log[0] + ")");
-
+
+ // 1 test
+ log = [];
+ OpenLayers.ProxyHost = "http://fooproxy/?url=";
+ port = window.location.port ? ':'+window.location.port : '';
+ expectedURL = window.location.protocol+"//"+window.location.hostname+port+"/service";
+ OpenLayers.Request.GET({url: expectedURL});
+ t.eq(log[0], expectedURL, "[2] proxy is not used when requesting the same server");
+
// 2 tests
- log = []
+ log = [];
OpenLayers.ProxyHost = function(url) {
var p = OpenLayers.Util.getParameters(url);
var p = OpenLayers.Util.getParameterString(p);
@@ -359,8 +368,8 @@
};
expectedURL = "http://barproxy/?k1=v1&k2=v2";
OpenLayers.Request.GET({url: "http://bar?k1=v1&k2=v2"});
- t.eq(log.length, 1, "[2] XHR.open called once");
- t.eq(log[0], expectedURL, "[2] the URL used for XHR is correct (" + log[0] + ")");
+ t.eq(log.length, 1, "[3] XHR.open called once");
+ t.eq(log[0], expectedURL, "[3] the URL used for XHR is correct (" + log[0] + ")");
/*
* Teardown
Modified: sandbox/tschaub/xdomain/tests/list-tests.html
===================================================================
--- sandbox/tschaub/xdomain/tests/list-tests.html 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/tests/list-tests.html 2011-01-27 20:43:53 UTC (rev 11063)
@@ -83,6 +83,7 @@
<li>Format/WMC/v1.html</li>
<li>Format/WMSCapabilities.html</li>
<li>Format/WMSCapabilities/v1_1_1.html</li>
+ <li>Format/WMSCapabilities/v1_1_1_WMSC.html</li>
<li>Format/WMSCapabilities/v1_3_0.html</li>
<li>Format/WMSDescribeLayer.html</li>
<li>Format/WMSGetFeatureInfo.html</li>
Modified: sandbox/tschaub/xdomain/theme/default/google.css
===================================================================
--- sandbox/tschaub/xdomain/theme/default/google.css 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/theme/default/google.css 2011-01-27 20:43:53 UTC (rev 11063)
@@ -3,8 +3,15 @@
bottom: 2px;
left: auto;
}
+.olLayerGoogleV3.olLayerGoogleCopyright {
+ bottom: 0px;
+ right: 0px !important;
+}
.olLayerGooglePoweredBy {
left: 2px;
bottom: 2px;
}
+.olLayerGoogleV3.olLayerGooglePoweredBy {
+ bottom: 0px !important;
+}
Modified: sandbox/tschaub/xdomain/theme/default/style.css
===================================================================
--- sandbox/tschaub/xdomain/theme/default/style.css 2011-01-27 08:54:05 UTC (rev 11062)
+++ sandbox/tschaub/xdomain/theme/default/style.css 2011-01-27 20:43:53 UTC (rev 11063)
@@ -16,12 +16,18 @@
.olLayerGoogleCopyright {
left: 2px;
- bottom: 2px;
+ bottom: 2px;
}
+.olLayerGoogleV3.olLayerGoogleCopyright {
+ right: auto !important;
+}
.olLayerGooglePoweredBy {
left: 2px;
bottom: 15px;
}
+.olLayerGoogleV3.olLayerGooglePoweredBy {
+ bottom: 15px !important;
+}
.olControlAttribution {
font-size: smaller;
right: 3px;
More information about the Commits
mailing list