[OpenLayers-Commits] r11679 - in sandbox/cmoullet/openlayers: .
examples lib lib/OpenLayers lib/OpenLayers/Control
lib/OpenLayers/Format lib/OpenLayers/Format/OWSContext
lib/OpenLayers/Format/WFSCapabilities lib/OpenLayers/Handler
lib/OpenLayers/Layer lib/OpenLayers/Protocol
lib/OpenLayers/Protocol/WFS lib/OpenLayers/Renderer
lib/OpenLayers/Strategy lib/Rico tests tests/Control
tests/Format tests/Format/OWSContext
tests/Format/WFSCapabilities tests/Handler tests/Protocol
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Tue Mar 8 16:36:51 EST 2011
Author: cmoullet
Date: 2011-03-08 13:36:50 -0800 (Tue, 08 Mar 2011)
New Revision: 11679
Added:
sandbox/cmoullet/openlayers/examples/mobile-drawing.html
sandbox/cmoullet/openlayers/examples/mobile-drawing.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js
sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html
Modified:
sandbox/cmoullet/openlayers/
sandbox/cmoullet/openlayers/examples/geolocation.js
sandbox/cmoullet/openlayers/examples/split-feature.html
sandbox/cmoullet/openlayers/lib/OpenLayers.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoom.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Atom.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/JSON.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OSM.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext/v0_3_1.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SLD.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSCapabilities.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetObservation.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSCapabilities.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSDescribeLayer.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMTSCapabilities.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Cluster.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Fixed.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Paging.js
sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Refresh.js
sandbox/cmoullet/openlayers/lib/Rico/Color.js
sandbox/cmoullet/openlayers/tests/Control.html
sandbox/cmoullet/openlayers/tests/Control/KeyboardDefaults.html
sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html
sandbox/cmoullet/openlayers/tests/Control/SelectFeature.html
sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html
sandbox/cmoullet/openlayers/tests/Format/KML.html
sandbox/cmoullet/openlayers/tests/Format/OSM.html
sandbox/cmoullet/openlayers/tests/Format/OWSContext/v0_3_1.html
sandbox/cmoullet/openlayers/tests/Format/WFSCapabilities/v1.html
sandbox/cmoullet/openlayers/tests/Handler/Drag.html
sandbox/cmoullet/openlayers/tests/Map.html
sandbox/cmoullet/openlayers/tests/Protocol/HTTP.html
sandbox/cmoullet/openlayers/tests/Protocol/WFS.html
sandbox/cmoullet/openlayers/tests/list-tests.html
Log:
Merge with trunk
Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
- /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11618
+ /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11678
Modified: sandbox/cmoullet/openlayers/examples/geolocation.js
===================================================================
--- sandbox/cmoullet/openlayers/examples/geolocation.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/examples/geolocation.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -2,7 +2,7 @@
fillColor: '#000',
fillOpacity: 0.1,
strokeWidth: 0
-}
+};
var map = new OpenLayers.Map('map');
var layer = new OpenLayers.Layer.OSM( "Simple OSM Map");
@@ -24,7 +24,9 @@
grow = 'up';
var resize = function(){
- if (count>16) clearInterval(window.resizeInterval);
+ if (count>16) {
+ clearInterval(window.resizeInterval);
+ }
var interval = radius * 0.03;
var ratio = interval/radius;
switch(count) {
@@ -40,7 +42,7 @@
feature.geometry.resize(1+ratio, point);
vector.drawFeature(feature);
count++;
- }
+ };
window.resizeInterval = window.setInterval(resize, 50, point, radius);
};
Copied: sandbox/cmoullet/openlayers/examples/mobile-drawing.html (from rev 11678, trunk/openlayers/examples/mobile-drawing.html)
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-drawing.html (rev 0)
+++ sandbox/cmoullet/openlayers/examples/mobile-drawing.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -0,0 +1,45 @@
+<!DOCTYPE html>
+<html>
+ <head>
+ <title>OpenLayers Mobile Drawing</title>
+ <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0;">
+ <meta name="apple-mobile-web-app-capable" content="yes">
+ <link rel="stylesheet" href="style.mobile.css" type="text/css">
+ <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+ <script src="../lib/OpenLayers.js"></script>
+ <script src="mobile-drawing.js"></script>
+ <style>
+ html, body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+ }
+ #map {
+ position: relative;
+ width: 100%;
+ height: 100%;
+ }
+ .olControlAttribution {
+ font-size: 10px;
+ bottom: 5px;
+ right: 5px;
+ }
+ #title, #tags, #shortdesc {
+ display: none;
+ }
+ </style>
+ </head>
+ <body>
+ <h1 id="title">Mobile Drawing Example</h1>
+ <div id="tags">
+ mobile, drawing
+ </div>
+ <p id="shortdesc">
+ A full-screen map with drawing tools for mobile devices.
+ </p>
+ <div id="map"></div>
+ <script>
+ init();
+ </script>
+ </body>
+</html>
Copied: sandbox/cmoullet/openlayers/examples/mobile-drawing.js (from rev 11678, trunk/openlayers/examples/mobile-drawing.js)
===================================================================
--- sandbox/cmoullet/openlayers/examples/mobile-drawing.js (rev 0)
+++ sandbox/cmoullet/openlayers/examples/mobile-drawing.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -0,0 +1,33 @@
+
+function init() {
+
+ var vector = new OpenLayers.Layer.Vector();
+ var toolbar = new OpenLayers.Control.EditingToolbar(vector);
+
+ map = new OpenLayers.Map({
+ div: 'map',
+ projection: 'EPSG:900913',
+ units: 'm',
+ numZoomLevels: 18,
+ maxResolution: 156543.0339,
+ maxExtent: new OpenLayers.Bounds(
+ -20037508.34, -20037508.34, 20037508.34, 20037508.34
+ ),
+ controls: [
+ new OpenLayers.Control.TouchNavigation({
+ dragPanOptions: {
+ interval: 100
+ }
+ }),
+ new OpenLayers.Control.ZoomPanel(),
+ toolbar
+ ],
+ layers: [new OpenLayers.Layer.OSM(), vector],
+ center: new OpenLayers.LonLat(0, 0),
+ zoom: 1,
+ theme: null
+ });
+
+ toolbar.controls[0].activate();
+
+};
Modified: sandbox/cmoullet/openlayers/examples/split-feature.html
===================================================================
--- sandbox/cmoullet/openlayers/examples/split-feature.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/examples/split-feature.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -68,9 +68,10 @@
}
});
map.addControl(split);
- split.activate();
+
map.zoomToMaxExtent();
+ split.activate();
}
function flashFeatures(features, index) {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ArgParser.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -54,6 +54,16 @@
*/
displayProjection: null,
+ /**
+ * Constructor: OpenLayers.Control.ArgParser
+ *
+ * Parameters:
+ * options - {Object}
+ */
+
+ /**
+ * Method: getParameters
+ */
getParameters: function(url) {
url = url || window.location.href;
var parameters = OpenLayers.Util.getParameters(url);
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/Attribution.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -24,6 +24,13 @@
*/
separator: ", ",
+ /**
+ * Constructor: OpenLayers.Control.Attribution
+ *
+ * Parameters:
+ * options - {Object} Options for control.
+ */
+
/**
* Method: destroy
* Destroy control.
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/KeyboardDefaults.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -33,19 +33,11 @@
* Pixels to slide by.
*/
slideFactor: 75,
-
+
/**
- * APIMethod: destroy
+ * Constructor: OpenLayers.Control.KeyboardDefaults
*/
- destroy: function() {
- if (this.handler) {
- this.handler.destroy();
- }
- this.handler = null;
- OpenLayers.Control.prototype.destroy.apply(this, arguments);
- },
-
/**
* Method: draw
* Create handler.
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/MousePosition.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -82,6 +82,13 @@
displayProjection: null,
/**
+ * Constructor: OpenLayers.Control.MousePosition
+ *
+ * Parameters:
+ * options - {Object} Options for control.
+ */
+
+ /**
* Method: destroy
*/
destroy: function() {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoom.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoom.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoom.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -64,10 +64,10 @@
* APIMethod: destroy
*/
destroy: function() {
- OpenLayers.Control.prototype.destroy.apply(this, arguments);
this.removeButtons();
this.buttons = null;
this.position = null;
+ OpenLayers.Control.prototype.destroy.apply(this, arguments);
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PanZoomBar.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -85,6 +85,10 @@
zoomStart: null,
/**
+ * Constructor: OpenLayers.Control.PanZoomBar
+ */
+
+ /**
* APIMethod: destroy
*/
destroy: function() {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/PinchZoom.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+/* 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. */
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/ScaleLine.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -73,6 +73,15 @@
geodesic: false,
/**
+ * Constructor: OpenLayers.Control.ScaleLine
+ * Create a new scale line control.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be used
+ * to extend the control.
+ */
+
+ /**
* Method: draw
*
* Returns:
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SelectFeature.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -463,8 +463,23 @@
*/
unhighlight: function(feature) {
var layer = feature.layer;
- feature._lastHighlighter = feature._prevHighlighter;
- delete feature._prevHighlighter;
+ // three cases:
+ // 1. there's no other highlighter, in that case _prev is undefined,
+ // and we just need to undef _last
+ // 2. another control highlighted the feature after we did it, in
+ // that case _last references this other control, and we just
+ // need to undef _prev
+ // 3. another control highlighted the feature before we did it, in
+ // that case _prev references this other control, and we need to
+ // set _last to _prev and undef _prev
+ if(feature._prevHighlighter == undefined) {
+ delete feature._lastHighlighter;
+ } else if(feature._prevHighlighter == this.id) {
+ delete feature._prevHighlighter;
+ } else {
+ feature._lastHighlighter = feature._prevHighlighter;
+ delete feature._prevHighlighter;
+ }
layer.drawFeature(feature, feature.style || feature.layer.style ||
"default");
this.events.triggerEvent("featureunhighlighted", {feature : feature});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/TouchNavigation.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2010 by OpenLayers Contributors (see authors.txt for
+/* 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. */
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -229,6 +229,7 @@
this.map.removeControl(this);
this.map = null;
}
+ this.div = null;
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Atom.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Atom.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Atom.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -67,9 +67,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/Filter.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -47,9 +47,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: write
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoJSON.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -40,9 +40,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.JSON.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/GeoRSS.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -83,9 +83,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* Method: createGeometryFromItem
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/JSON.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/JSON.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/JSON.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -75,9 +75,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/KML.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -1222,7 +1222,8 @@
* {DOMElement}
*/
buildGeometryNode: function(geometry) {
- if (this.internalProjection && this.externalProjection) {
+ if (this.internalProjection && this.externalProjection &&
+ !(geometry instanceof OpenLayers.Geometry.Collection)) {
geometry = geometry.clone();
geometry.transform(this.internalProjection,
this.externalProjection);
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OSM.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OSM.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OSM.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -347,6 +347,13 @@
'point': function(point) {
var id = null;
var geometry = point.geometry ? point.geometry : point;
+
+ if (this.internalProjection && this.externalProjection) {
+ geometry = geometry.clone();
+ geometry.transform(this.internalProjection,
+ this.externalProjection);
+ }
+
var already_exists = false; // We don't return anything if the node
// has already been created
if (point.osm_id) {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext/v0_3_1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext/v0_3_1.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext/v0_3_1.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -179,9 +179,10 @@
decomposeNestingPath: function(nPath){
var a = [];
if (nPath instanceof Array) {
- while (nPath.length > 0) {
- a.push(nPath.slice());
- nPath.pop();
+ var path = nPath.slice();
+ while (path.length > 0) {
+ a.push(path.slice());
+ path.pop();
}
a.reverse();
}
@@ -440,7 +441,9 @@
var node = this.createElementNSPlus("Style");
this.writeNode("Name", style, node);
this.writeNode("Title", style, node);
- this.writeNode("LegendURL", style, node);
+ if (style.legend) {
+ this.writeNode("LegendURL", style, node);
+ }
return node;
},
"Name": function(obj) {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/OWSContext.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -23,6 +23,15 @@
* {String} Version number to assume if none found. Default is "0.3.1".
*/
defaultVersion: "0.3.1",
+
+ /**
+ * Constructor: OpenLayers.Format.OWSContext
+ * Create a new parser for OWS Context documents.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
/**
* Method: getParser
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SLD.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SLD.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SLD.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -58,9 +58,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: write
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSCapabilities.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSCapabilities.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSCapabilities.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -36,16 +36,12 @@
/**
* Constructor: OpenLayers.Format.SOSCapabilities
- * Create a new parser for SOS capabilities.
+ * Create a new parser for SOS Capabilities.
*
* Parameters:
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- this.options = options;
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetFeatureOfInterest.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -66,9 +66,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetObservation.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetObservation.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/SOSGetObservation.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -68,9 +68,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* Method: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_0_0.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -151,7 +151,17 @@
read_cap_Post: function(obj, node) {
obj.post = node.getAttribute("onlineResource");
},
+
+ /**
+ * Method: read_cap_SRS
+ */
+ read_cap_SRS: function(obj, node) {
+ var srs = this.getChildValue(node);
+ if (srs) {
+ obj.srs = srs;
+ }
+ },
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_0_0"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities/v1_1_0.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -31,6 +31,16 @@
);
},
+ /**
+ * Method: read_cap_DefaultSRS
+ */
+ read_cap_DefaultSRS: function(obj, node) {
+ var defaultSRS = this.getChildValue(node);
+ if (defaultSRS) {
+ obj.srs = defaultSRS;
+ }
+ },
+
CLASS_NAME: "OpenLayers.Format.WFSCapabilities.v1_1_0"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSCapabilities.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -36,10 +36,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- this.options = options;
- },
/**
* APIMethod: read
@@ -77,4 +73,4 @@
CLASS_NAME: "OpenLayers.Format.WFSCapabilities"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WFSDescribeFeatureType.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -31,9 +31,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- },
/**
* Property: readers
@@ -195,4 +192,4 @@
CLASS_NAME: "OpenLayers.Format.WFSDescribeFeatureType"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMC.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -22,6 +22,15 @@
* {String} Version number to assume if none found. Default is "1.1.0".
*/
defaultVersion: "1.1.0",
+
+ /**
+ * Constructor: OpenLayers.Format.WMC
+ * Create a new parser for Web Map Context documents.
+ *
+ * Parameters:
+ * options - {Object} An optional object whose properties will be set on
+ * this instance.
+ */
/**
* Method: getParser
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSCapabilities.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSCapabilities.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSCapabilities.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -51,10 +51,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- this.options = options;
- },
/**
* APIMethod: read
@@ -90,4 +86,4 @@
CLASS_NAME: "OpenLayers.Format.WMSCapabilities"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSDescribeLayer.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSDescribeLayer.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSDescribeLayer.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -37,10 +37,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- this.options = options;
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMSGetFeatureInfo.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -56,11 +56,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, arguments);
- OpenLayers.Util.extend(this, options);
- this.options = options;
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMTSCapabilities.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMTSCapabilities.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Format/WMTSCapabilities.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -55,10 +55,6 @@
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
- initialize: function(options) {
- OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
- this.options = options;
- },
/**
* APIMethod: read
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Drag.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -63,6 +63,14 @@
start: null,
/**
+ * Property: lastMoveEvt
+ * {Object} The last mousemove event that occurred. Used to
+ * position the map correctly when our "delay drag"
+ * timeout expired.
+ */
+ lastMoveEvt: null,
+
+ /**
* Property: oldOnselectstart
* {Function}
*/
@@ -184,6 +192,7 @@
* {Boolean} Let the event propagate.
*/
dragmove: function (evt) {
+ this.lastMoveEvt = evt;
if (this.started && !this.timeoutId && (evt.xy.x != this.last.x ||
evt.xy.y != this.last.y)) {
if(this.documentDrag === true && this.documentEvents) {
@@ -209,7 +218,7 @@
this.oldOnselectstart = document.onselectstart;
document.onselectstart = OpenLayers.Function.False;
}
- this.last = this.evt.xy;
+ this.last = evt.xy;
}
return true;
},
@@ -364,6 +373,12 @@
*/
removeTimeout: function() {
this.timeoutId = null;
+ // if timeout expires while we're still dragging (mouseup
+ // hasn't occurred) then call mousemove to move to the
+ // correct position
+ if(this.dragging) {
+ this.mousemove(this.lastMoveEvt);
+ }
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Grid.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -701,7 +701,7 @@
var tlLayer = this.grid[0][0].position;
var offsetX = parseInt(this.map.layerContainerDiv.style.left);
var offsetY = parseInt(this.map.layerContainerDiv.style.top);
- tlViewPort = tlLayer.add(offsetX, offsetY);
+ var tlViewPort = tlLayer.add(offsetX, offsetY);
if (tlViewPort.x > -this.tileSize.w * (buffer - 1)) {
this.shiftColumn(true);
} else if (tlViewPort.x < -this.tileSize.w * buffer) {
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/Vector.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -472,7 +472,7 @@
moveTo: function(bounds, zoomChanged, dragging) {
OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
- var ng = (this.renderer instanceof OpenLayers.Renderer.NG);
+ var ng = (OpenLayers.Renderer.NG && this.renderer instanceof OpenLayers.Renderer.NG);
if (ng) {
zoomChanged && this.renderer.updateDimensions();
} else {
@@ -522,7 +522,7 @@
* {Boolean} The layer was redrawn.
*/
redraw: function() {
- if (this.renderer instanceof OpenLayers.Renderer.NG) {
+ if (OpenLayers.Renderer.NG && this.renderer instanceof OpenLayers.Renderer.NG) {
this.drawn = false;
}
return OpenLayers.Layer.prototype.redraw.apply(this, arguments);
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Map.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -510,6 +510,12 @@
this.div = document.createElement("div");
this.div.style.height = "1px";
this.div.style.width = "1px";
+
+ // Adding this to the DOM is a fix for Safari SVG rendering bugs;
+ // See #2392. On initial render(), it is removed from the dom,
+ // and a new div is added.
+ this.div.style.display = "none";
+ document.body.appendChild(this.div);
}
OpenLayers.Element.addClass(this.div, 'olMap');
@@ -644,6 +650,11 @@
* will be moved from the current to the new container.
*/
render: function(div) {
+ // Fix for Safari SVG rendering bugs; See #2392
+ if(this.div && this.div.parentNode) {
+ this.div.parentNode.removeChild(this.div);
+ }
+
this.div = OpenLayers.Util.getElement(div);
OpenLayers.Element.addClass(this.div, 'olMap');
this.viewPortDiv.parentNode.removeChild(this.viewPortDiv);
@@ -1570,21 +1581,20 @@
this.moveByPx(dx, dy);
}
} else {
- // if we don't have a center, we were using moveByPx previously
- var forceSetCenter = !this.center;
-
// getCenter
var centerPx = this.getViewPortPxFromLonLat(this.getCachedCenter());
// adjust
var newCenterPx = centerPx.add(dx, dy);
- if (forceSetCenter || !newCenterPx.equals(centerPx)) {
+ if (this.dragging || !newCenterPx.equals(centerPx)) {
var newCenterLonLat = this.getLonLatFromViewPortPx(newCenterPx);
if (options.animate) {
this.panTo(newCenterLonLat);
} else {
- this.setCenter(newCenterLonLat, null, options.dragging);
+ this.moveTo(newCenterLonLat);
+ this.dragging = false;
+ this.events.triggerEvent("moveend");
}
}
}
@@ -1607,8 +1617,7 @@
var center = this.getCachedCenter();
// center will not change, don't do nothing
- if (lonlat.lon == center.lon &&
- lonlat.lat == center.lat) {
+ if (lonlat.equals(center)) {
return;
}
@@ -1619,9 +1628,6 @@
this.panTween.start( { x: 0, y: 0 }, vector, this.panDuration, {
callbacks: {
- start: OpenLayers.Function.bind(function() {
- this.events.triggerEvent("movestart");
- }, this),
eachStep: OpenLayers.Function.bind(function(px) {
var x = px.x - last.x,
y = px.y - last.y;
@@ -1630,7 +1636,8 @@
last.y = Math.round(px.y);
}, this),
done: OpenLayers.Function.bind(function(px) {
- this.moveTo(lonlat, this.zoom, {noEvent: true});
+ this.moveTo(lonlat);
+ this.dragging = false;
this.events.triggerEvent("moveend");
}, this)
}
@@ -1655,10 +1662,10 @@
* TBD: reconsider forceZoomChange in 3.0
*/
setCenter: function(lonlat, zoom, dragging, forceZoomChange) {
+ this.panTween && this.panTween.stop();
this.moveTo(lonlat, zoom, {
'dragging': dragging,
- 'forceZoomChange': forceZoomChange,
- 'caller': 'setCenter'
+ 'forceZoomChange': forceZoomChange
});
},
@@ -1678,7 +1685,8 @@
var x = hw + dx;
var y = hh + dy;
var wrapDateLine = this.baseLayer.wrapDateLine;
- var xRestriction = yRestriction = 0;
+ var xRestriction = 0;
+ var yRestriction = 0;
if (this.restrictedExtent) {
xRestriction = hw;
yRestriction = hh;
@@ -1694,6 +1702,10 @@
x >= this.minPx.x + xRestriction;
}
if (valid) {
+ if (!this.dragging) {
+ this.dragging = true;
+ this.events.triggerEvent("movestart");
+ }
this.center = null;
if (dx) {
this.layerContainerDiv.style.left =
@@ -1746,16 +1758,10 @@
}
}
// dragging is false by default
- var dragging = options.dragging;
+ var dragging = options.dragging || this.dragging;
// forceZoomChange is false by default
var forceZoomChange = options.forceZoomChange;
- // noEvent is false by default
- var noEvent = options.noEvent;
- if (this.panTween && options.caller == "setCenter") {
- this.panTween.stop();
- }
-
if (!this.getCachedCenter() && !this.isValidLonLat(lonlat)) {
lonlat = this.maxExtent.getCenterLonLat();
}
@@ -1801,14 +1807,10 @@
var centerChanged = (this.isValidLonLat(lonlat)) &&
(!lonlat.equals(this.center));
-
// if neither center nor zoom will change, no need to do anything
- if (zoomChanged || centerChanged || !dragging) {
+ if (zoomChanged || centerChanged || dragging) {
+ dragging || this.events.triggerEvent("movestart");
- if (!this.dragging && !noEvent) {
- this.events.triggerEvent("movestart");
- }
-
if (centerChanged) {
if (!zoomChanged && this.center) {
// if zoom hasnt changed, just slide layerContainer
@@ -1849,14 +1851,10 @@
//send the move call to the baselayer and all the overlays
if(this.baseLayer.visibility) {
- this.baseLayer.moveTo(bounds, zoomChanged, dragging);
- if(dragging) {
- this.baseLayer.events.triggerEvent("move");
- } else {
- this.baseLayer.events.triggerEvent("moveend",
- {"zoomChanged": zoomChanged}
- );
- }
+ this.baseLayer.moveTo(bounds, zoomChanged, options.dragging);
+ options.dragging || this.baseLayer.events.triggerEvent(
+ "moveend", {zoomChanged: zoomChanged}
+ );
}
bounds = this.baseLayer.getExtent();
@@ -1879,38 +1877,25 @@
});
}
if (inRange && layer.visibility) {
- layer.moveTo(bounds, zoomChanged, dragging);
- if(dragging) {
- layer.events.triggerEvent("move");
- } else {
- layer.events.triggerEvent("moveend",
- {"zoomChanged": zoomChanged}
- );
- }
+ layer.moveTo(bounds, zoomChanged, options.dragging);
+ options.dragging || layer.events.triggerEvent(
+ "moveend", {zoomChanged: zoomChanged}
+ );
}
}
}
+ this.events.triggerEvent("move");
+ dragging || this.events.triggerEvent("moveend");
+
if (zoomChanged) {
//redraw popups
for (var i=0, len=this.popups.length; i<len; i++) {
this.popups[i].updatePosition();
}
- }
-
- this.events.triggerEvent("move");
-
- if (zoomChanged) { this.events.triggerEvent("zoomend"); }
+ this.events.triggerEvent("zoomend");
+ }
}
-
- // even if nothing was done, we want to notify of this
- if (!dragging && !noEvent) {
- this.events.triggerEvent("moveend");
- }
-
- // Store the map dragging state for later use
- this.dragging = !!dragging;
-
},
/**
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/HTTP.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -14,6 +14,11 @@
*/
/**
+ * TODO: remove this dependency in 3.0
+ * @requires OpenLayers/Protocol/SimpleFilterSerializer.js
+ */
+
+/**
* Class: OpenLayers.Protocol.HTTP
* A basic HTTP protocol for vector layers. Create a new instance with the
* <OpenLayers.Protocol.HTTP> constructor.
@@ -109,6 +114,12 @@
this.params = {};
this.headers = {};
OpenLayers.Protocol.prototype.initialize.apply(this, arguments);
+
+ if (!this.filterToParams && OpenLayers.Protocol.simpleFilterSerializer) {
+ this.filterToParams = OpenLayers.Function.bind(
+ OpenLayers.Protocol.simpleFilterSerializer, this
+ );
+ }
},
/**
@@ -120,8 +131,23 @@
this.headers = null;
OpenLayers.Protocol.prototype.destroy.apply(this);
},
-
+
/**
+ * APIMethod: filterToParams
+ * Optional method to translate an <OpenLayers.Filter> object into an object
+ * that can be serialized as request query string provided. If a custom
+ * method is not provided, the filter will be serialized using the
+ * <OpenLayers.Protocol.simpleFilterSerializer> method.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter>} filter to convert.
+ * params - {Object} The parameters object.
+ *
+ * Returns:
+ * {Object} The resulting parameters object.
+ */
+
+ /**
* APIMethod: read
* Construct a request for reading new features.
*
@@ -148,9 +174,10 @@
options = OpenLayers.Util.applyDefaults(options, this.options);
options.params = OpenLayers.Util.applyDefaults(
options.params, this.options.params);
- if(options.filter) {
+ if (options.filter && this.filterToParams) {
options.params = this.filterToParams(
- options.filter, options.params);
+ options.filter, options.params
+ );
}
var readWithPOST = (options.readWithPOST !== undefined) ?
options.readWithPOST : this.readWithPOST;
@@ -190,124 +217,6 @@
},
/**
- * Method: filterToParams
- * Convert an <OpenLayers.Filter> object to parameters.
- *
- * Parameters:
- * filter - {OpenLayers.Filter} filter to convert.
- * params - {Object} The parameters object.
- *
- * Returns:
- * {Object} The resulting parameters object.
- */
- filterToParams: function(filter, params) {
- params = params || {};
- var className = filter.CLASS_NAME;
- var filterType = className.substring(className.lastIndexOf(".") + 1);
- switch(filterType) {
- case "Spatial":
- switch(filter.type) {
- case OpenLayers.Filter.Spatial.BBOX:
- params.bbox = filter.value.toArray();
- if (this.srsInBBOX && filter.projection) {
- params.bbox.push(filter.projection.getCode());
- }
- break;
- case OpenLayers.Filter.Spatial.DWITHIN:
- params.tolerance = filter.distance;
- // no break here
- case OpenLayers.Filter.Spatial.WITHIN:
- params.lon = filter.value.x;
- params.lat = filter.value.y;
- break;
- default:
- OpenLayers.Console.warn(
- "Unknown spatial filter type " + filter.type);
- }
- break;
- case "Comparison":
- var op = OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR[filter.type];
- if(op !== undefined) {
- var value = filter.value;
- if(filter.type == OpenLayers.Filter.Comparison.LIKE) {
- value = this.regex2value(value);
- if(this.wildcarded) {
- value = "%" + value + "%";
- }
- }
- params[filter.property + "__" + op] = value;
- params.queryable = params.queryable || [];
- params.queryable.push(filter.property);
- } else {
- OpenLayers.Console.warn(
- "Unknown comparison filter type " + filter.type);
- }
- break;
- case "Logical":
- if(filter.type === OpenLayers.Filter.Logical.AND) {
- for(var i=0,len=filter.filters.length; i<len; i++) {
- params = this.filterToParams(filter.filters[i], params);
- }
- } else {
- OpenLayers.Console.warn(
- "Unsupported logical filter type " + filter.type);
- }
- break;
- default:
- OpenLayers.Console.warn("Unknown filter type " + filterType);
- }
- return params;
- },
-
- /**
- * Method: regex2value
- * Convert the value from a regular expression string to a LIKE/ILIKE
- * string known to the web service.
- *
- * Parameters:
- * value - {String} The regex string.
- *
- * Returns:
- * {String} The converted string.
- */
- regex2value: function(value) {
-
- // highly sensitive!! Do not change this without running the
- // Protocol/HTTP.html unit tests
-
- // convert % to \%
- value = value.replace(/%/g, "\\%");
-
- // convert \\. to \\_ (\\.* occurences converted later)
- value = value.replace(/\\\\\.(\*)?/g, function($0, $1) {
- return $1 ? $0 : "\\\\_";
- });
-
- // convert \\.* to \\%
- value = value.replace(/\\\\\.\*/g, "\\\\%");
-
- // convert . to _ (\. and .* occurences converted later)
- value = value.replace(/(\\)?\.(\*)?/g, function($0, $1, $2) {
- return $1 || $2 ? $0 : "_";
- });
-
- // convert .* to % (\.* occurnces converted later)
- value = value.replace(/(\\)?\.\*/g, function($0, $1) {
- return $1 ? $0 : "%";
- });
-
- // convert \. to .
- value = value.replace(/\\\./g, ".");
-
- // replace \* with * (watching out for \\*)
- value = value.replace(/(\\)?\\\*/g, function($0, $1) {
- return $1 ? $0 : "*";
- });
-
- return value;
- },
-
- /**
* APIMethod: create
* Construct a request for writing newly created features.
*
@@ -648,21 +557,3 @@
CLASS_NAME: "OpenLayers.Protocol.HTTP"
});
-
-/**
- * Property: OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR
- * {Object} A private class-level property mapping the
- * OpenLayers.Filter.Comparison types to the operation
- * strings of the protocol.
- */
-(function() {
- var o = OpenLayers.Protocol.HTTP.COMP_TYPE_TO_OP_STR = {};
- o[OpenLayers.Filter.Comparison.EQUAL_TO] = "eq";
- o[OpenLayers.Filter.Comparison.NOT_EQUAL_TO] = "ne";
- o[OpenLayers.Filter.Comparison.LESS_THAN] = "lt";
- o[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO] = "lte";
- o[OpenLayers.Filter.Comparison.GREATER_THAN] = "gt";
- o[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO] = "gte";
- o[OpenLayers.Filter.Comparison.LIKE] = "ilike";
-})();
-
Copied: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js (from rev 11678, trunk/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js)
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js (rev 0)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/SimpleFilterSerializer.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -0,0 +1,145 @@
+/* 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/Protocol.js
+ */
+
+/**
+ * Function: OpenLayers.Protocol.simpleFilterSerializer
+ * Serialize an <OpenLayers.Filter> objects using the "simple" filter syntax for
+ * query string parameters. This function must be called as a method of
+ * a protocol instance.
+ *
+ * Parameters:
+ * filter - {<OpenLayers.Filter>} filter to convert.
+ * params - {Object} The parameters object.
+ *
+ * Returns:
+ * {Object} The resulting parameters object.
+ */
+OpenLayers.Protocol.simpleFilterSerializer = (function() {
+
+ /**
+ * Map the OpenLayers.Filter.Comparison types to the operation strings of
+ * the protocol.
+ */
+ var cmpToStr = {};
+ cmpToStr[OpenLayers.Filter.Comparison.EQUAL_TO] = "eq";
+ cmpToStr[OpenLayers.Filter.Comparison.NOT_EQUAL_TO] = "ne";
+ cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN] = "lt";
+ cmpToStr[OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO] = "lte";
+ cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN] = "gt";
+ cmpToStr[OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO] = "gte";
+ cmpToStr[OpenLayers.Filter.Comparison.LIKE] = "ilike";
+
+ /**
+ * Function: regex2value
+ * Convert the value from a regular expression string to a LIKE/ILIKE
+ * string known to the web service.
+ *
+ * Parameters:
+ * value - {String} The regex string.
+ *
+ * Returns:
+ * {String} The converted string.
+ */
+ function regex2value(value) {
+
+ // highly sensitive!! Do not change this without running the
+ // Protocol/HTTP.html unit tests
+
+ // convert % to \%
+ value = value.replace(/%/g, "\\%");
+
+ // convert \\. to \\_ (\\.* occurences converted later)
+ value = value.replace(/\\\\\.(\*)?/g, function($0, $1) {
+ return $1 ? $0 : "\\\\_";
+ });
+
+ // convert \\.* to \\%
+ value = value.replace(/\\\\\.\*/g, "\\\\%");
+
+ // convert . to _ (\. and .* occurences converted later)
+ value = value.replace(/(\\)?\.(\*)?/g, function($0, $1, $2) {
+ return $1 || $2 ? $0 : "_";
+ });
+
+ // convert .* to % (\.* occurnces converted later)
+ value = value.replace(/(\\)?\.\*/g, function($0, $1) {
+ return $1 ? $0 : "%";
+ });
+
+ // convert \. to .
+ value = value.replace(/\\\./g, ".");
+
+ // replace \* with * (watching out for \\*)
+ value = value.replace(/(\\)?\\\*/g, function($0, $1) {
+ return $1 ? $0 : "*";
+ });
+
+ return value;
+ }
+
+ return function simpleFilterSerializer(filter, params) {
+ params = params || {};
+ var className = filter.CLASS_NAME;
+ var filterType = className.substring(className.lastIndexOf(".") + 1);
+ switch (filterType) {
+ case "Spatial":
+ switch (filter.type) {
+ case OpenLayers.Filter.Spatial.BBOX:
+ params.bbox = filter.value.toArray();
+ if (this.srsInBBOX && filter.projection) {
+ params.bbox.push(filter.projection.getCode());
+ }
+ break;
+ case OpenLayers.Filter.Spatial.DWITHIN:
+ params.tolerance = filter.distance;
+ // no break here
+ case OpenLayers.Filter.Spatial.WITHIN:
+ params.lon = filter.value.x;
+ params.lat = filter.value.y;
+ break;
+ default:
+ OpenLayers.Console.warn(
+ "Unknown spatial filter type " + filter.type);
+ }
+ break;
+ case "Comparison":
+ var op = cmpToStr[filter.type];
+ if (op !== undefined) {
+ var value = filter.value;
+ if (filter.type == OpenLayers.Filter.Comparison.LIKE) {
+ value = regex2value(value);
+ if (this.wildcarded) {
+ value = "%" + value + "%";
+ }
+ }
+ params[filter.property + "__" + op] = value;
+ params.queryable = params.queryable || [];
+ params.queryable.push(filter.property);
+ } else {
+ OpenLayers.Console.warn(
+ "Unknown comparison filter type " + filter.type);
+ }
+ break;
+ case "Logical":
+ if (filter.type === OpenLayers.Filter.Logical.AND) {
+ for (var i=0,len=filter.filters.length; i<len; i++) {
+ params = this.filterToParams(filter.filters[i], params);
+ }
+ } else {
+ OpenLayers.Console.warn(
+ "Unsupported logical filter type " + filter.type);
+ }
+ break;
+ default:
+ OpenLayers.Console.warn("Unknown filter type " + filterType);
+ }
+ return params;
+ };
+
+})();
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Protocol/WFS/v1.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -183,6 +183,30 @@
return response;
},
+
+ /**
+ * APIMethod: setFeatureType
+ * Change the feature type on the fly.
+ *
+ * Parameters:
+ * featureType - {String} Local (without prefix) feature typeName.
+ */
+ setFeatureType: function(featureType) {
+ this.featureType = featureType;
+ this.format.featureType = featureType;
+ },
+
+ /**
+ * APIMethod: setGeometryName
+ * Sets the geometryName option after instantiation.
+ *
+ * Parameters:
+ * geometryName - {String} Name of geometry attribute.
+ */
+ setGeometryName: function(geometryName) {
+ this.geometryName = geometryName;
+ this.format.geometryName = geometryName;
+ },
/**
* Method: handleRead
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/NG.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -124,8 +124,8 @@
label._x = location.x;
label._y = location.y;
if(style.labelXOffset || style.labelYOffset) {
- xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
- yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
+ var xOffset = isNaN(style.labelXOffset) ? 0 : style.labelXOffset;
+ var yOffset = isNaN(style.labelYOffset) ? 0 : style.labelYOffset;
var res = this.getResolution();
location.move(xOffset*res, yOffset*res);
}
@@ -138,4 +138,4 @@
},
CLASS_NAME: "OpenLayers.Renderer.NG"
-});
\ No newline at end of file
+});
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Renderer/SVG2.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -651,9 +651,8 @@
getComponentsString: function(components, separator) {
var len = components.length;
var strings = new Array(len);
- for(var i=0; i<len; i++) {
- component = components[i];
- strings[i] = this.getShortString(component);
+ for (var i=0; i<len; i++) {
+ strings[i] = this.getShortString(components[i]);
}
return strings.join(separator || ",");
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -68,9 +68,6 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
* Method: activate
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Cluster.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Cluster.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Cluster.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -66,9 +66,6 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: activate
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Filter.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -47,9 +47,6 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: activate
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Fixed.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Fixed.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Fixed.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -32,19 +32,8 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
- * APIMethod: destroy
- * Clean up the strategy.
- */
- destroy: function() {
- OpenLayers.Strategy.prototype.destroy.apply(this, arguments);
- },
-
- /**
* Method: activate
* Activate the strategy: load data or add listener to load when visible
*
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Paging.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Paging.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Paging.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -48,9 +48,6 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: activate
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Refresh.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Refresh.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/Refresh.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -45,9 +45,6 @@
* options - {Object} Optional object whose properties will be set on the
* instance.
*/
- initialize: function(options) {
- OpenLayers.Strategy.prototype.initialize.apply(this, [options]);
- },
/**
* APIMethod: activate
Modified: sandbox/cmoullet/openlayers/lib/OpenLayers.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -245,6 +245,7 @@
"OpenLayers/Filter/Spatial.js",
"OpenLayers/Protocol.js",
"OpenLayers/Protocol/HTTP.js",
+ "OpenLayers/Protocol/SimpleFilterSerializer.js",
"OpenLayers/Protocol/SQL.js",
"OpenLayers/Protocol/SQL/Gears.js",
"OpenLayers/Protocol/WFS.js",
Modified: sandbox/cmoullet/openlayers/lib/Rico/Color.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/Rico/Color.js 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/lib/Rico/Color.js 2011-03-08 21:36:50 UTC (rev 11679)
@@ -1,5 +1,6 @@
/**
* @requires OpenLayers/BaseTypes/Class.js
+ * @requires OpenLayers/BaseTypes/Element.js
*/
@@ -124,9 +125,8 @@
OpenLayers.Rico.Color.createColorFromBackground = function(elem) {
var actualColor =
- RicoUtil.getElementsComputedStyle(OpenLayers.Util.getElement(elem),
- "backgroundColor",
- "background-color");
+ OpenLayers.Element.getStyle(OpenLayers.Util.getElement(elem),
+ "backgroundColor");
if ( actualColor == "transparent" && elem.parentNode ) {
return OpenLayers.Rico.Color.createColorFromBackground(elem.parentNode);
Modified: sandbox/cmoullet/openlayers/tests/Control/KeyboardDefaults.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/KeyboardDefaults.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Control/KeyboardDefaults.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -12,6 +12,18 @@
t.eq( control.displayClass, "olControlKeyboardDefaults", "displayClass is correct" );
}
+ function test_Control_KeyboardDefaults_destroy (t) {
+ t.plan(2);
+
+ map = new OpenLayers.Map('map');
+ var control = new OpenLayers.Control.KeyboardDefaults();
+ map.addControl(control);
+ t.ok(control.handler != null, "control.handler is created");
+ control.destroy();
+ t.ok(control.handler == null, "control.handler is null after destroy");
+ map.destroy();
+ }
+
function test_Control_KeyboardDefaults_addControl (t) {
t.plan( 4 );
Modified: sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Control/PanZoomBar.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -44,8 +44,9 @@
control = new OpenLayers.Control.PanZoomBar();
map.addControl(control);
control.removeButtons();
+ var div = control.div;
map.destroy();
- t.eq(control.div.childNodes.length, 0, "control's div cleared.");
+ t.eq(div.childNodes.length, 0, "control's div cleared.");
t.eq(control.zoombarDiv, null, "zoombar div nullified.")
}
Modified: sandbox/cmoullet/openlayers/tests/Control/SelectFeature.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/SelectFeature.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Control/SelectFeature.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -373,6 +373,114 @@
map.events.triggerEvent("click", evt);
}
+ // test for http://trac.openlayers.org/ticket/2812
+ function test_highlightOnly_toggle(t) {
+ t.plan(8);
+
+ /*
+ * setup
+ */
+
+ var map, layer, ctrl1, ctrl2, _feature, feature, evt, _style;
+
+ map = new OpenLayers.Map("map");
+ layer = new OpenLayers.Layer.Vector("name", {isBaseLayer: true});
+ map.addLayer(layer);
+
+ ctrl1 = new OpenLayers.Control.SelectFeature(layer, {
+ highlightOnly: false,
+ hover: false,
+ clickout: false,
+ toggle: true
+ });
+ map.addControl(ctrl1);
+
+ ctrl2 = new OpenLayers.Control.SelectFeature(layer, {
+ highlightOnly: true,
+ hover: true
+ });
+ map.addControl(ctrl2);
+
+ ctrl2.activate();
+ ctrl1.activate();
+
+ feature = new OpenLayers.Feature.Vector();
+ feature.layer = layer;
+
+ // override the layer's getFeatureFromEvent func so that it always
+ // returns the feature referenced to by _feature
+ layer.getFeatureFromEvent = function(evt) { return _feature; };
+
+ evt = {xy: new OpenLayers.Pixel(Math.random(), Math.random())};
+
+ map.zoomToMaxExtent();
+
+ /*
+ * tests
+ */
+
+ // with renderIntent
+
+ ctrl1.renderIntent = "select";
+ ctrl2.renderIntent = "temporary";
+
+ // mouse over feature, feature is drawn with "temporary"
+ _feature = feature;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "temporary",
+ "feature drawn with expected render intent after \"mouseover\"");
+
+ // click in feature, feature is drawn with "select"
+ _feature = feature;
+ evt.type = "click";
+ map.events.triggerEvent("click", evt);
+ t.eq(feature.renderIntent, "select",
+ "feature drawn with expected render intent after \"clickin\"");
+
+ // mouse out of feature, feature is still drawn with "select"
+ _feature = null;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "select",
+ "feature drawn with expected render intent after \"mouseout\"");
+
+ // mouse over feature again, feature is drawn with "temporary"
+ _feature = feature;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "temporary",
+ "feature drawn with expected render intent after \"mouseover\"");
+
+ // click in feature again, feature is drawn with "default"
+ _feature = feature;
+ evt.type = "click";
+ map.events.triggerEvent("click", evt);
+ t.eq(feature.renderIntent, "default",
+ "feature drawn with expected render intent after \"clickin\"");
+
+ // mouse out of feature again, feature is still drawn with "default"
+ _feature = null;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "default",
+ "feature drawn with expected render intent after \"mouseout\"");
+
+ // mouse over feature again, feature is drawn with "temporary"
+ _feature = feature;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "temporary",
+ "feature drawn with expected render intent after \"mouseover\"");
+
+ // mouse out of feature again, feature is still drawn with "default"
+ _feature = null;
+ evt.type = "mousemove";
+ map.events.triggerEvent("mousemove", evt);
+ t.eq(feature.renderIntent, "default",
+ "feature drawn with expected render intent after \"mouseout\"");
+ }
+
function test_setLayer(t) {
t.plan(5);
var map = new OpenLayers.Map("map");
Modified: sandbox/cmoullet/openlayers/tests/Control.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Control.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -60,7 +60,7 @@
}
function test_Control_destroy(t) {
- t.plan(3);
+ t.plan(4);
var map = new OpenLayers.Map('map');
var control = new OpenLayers.Control();
@@ -70,6 +70,7 @@
t.ok(map.controls[map.controls.length - 1] != control, "map.controls doesn't contains control");
t.ok(control.map == null, "Control.map is null");
+ t.ok(control.div == null, "Control.div is null");
t.ok(control.handler == null, "Control.handler is null");
}
Modified: sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Format/GeoJSON.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -95,6 +95,19 @@
t.eq(data.components[1].y, 1, "y of second component is right");
}
+ function test_Format_GeoJSON_multipoint_projected(t) {
+ t.plan(1);
+ var f = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint([
+ new OpenLayers.Geometry.Point(15555162, 4247484)]));
+ var format = new OpenLayers.Format.GeoJSON({
+ internalProjection: new OpenLayers.Projection("EPSG:900913"),
+ externalProjection: new OpenLayers.Projection("EPSG:4326")
+ });
+ var data = format.write(f);
+ var found = (data.search('139.734') != -1);
+ t.ok(found, "Found 139.734 (correct reprojection) in data output.");
+ }
+
function test_Format_GeoJSON_multiline(t) {
t.plan(3);
Modified: sandbox/cmoullet/openlayers/tests/Format/KML.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/KML.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Format/KML.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -9,7 +9,6 @@
var test_style_outline = '<kml xmlns="http://earth.google.com/kml/2.0"> <Placemark> <Style> <PolyStyle> <outline>0</outline> <color>870000ff</color> <width>10</width> </PolyStyle> </Style> <LineString> <coordinates> -112,36 -113,37 </coordinates> </LineString> </Placemark></kml>';
var test_style_font = '<kml xmlns="http://earth.google.com/kml/2.0"> <Placemark><Style><LabelStyle><color>870000ff</color><scale>1.5</scale></LabelStyle></Style><LineString><coordinates> -112,36 -113,37 </coordinates></LineString></Placemark></kml>';
var test_nl = '<kml xmlns="http://earth.google.com/kml/2.2"> <Document> <NetworkLink> <Link> <href>http://maker.geocommons.com/maps/1717/overlays/0</href> </Link> </NetworkLink> </Document></kml>';
-
function test_Format_KML_constructor(t) {
t.plan(5);
@@ -23,7 +22,20 @@
t.eq(format.externalProjection.getCode(), "EPSG:4326",
"default external projection is EPSG:4326");
}
-
+ function test_Format_KML_multipoint(t) {
+ t.plan(1);
+ var f = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.MultiPoint([
+ new OpenLayers.Geometry.Point(15555162, 4247484)]));
+ var format = new OpenLayers.Format.KML({
+ extractStyles: true,
+ extractAttributes: true,
+ internalProjection: new OpenLayers.Projection("EPSG:900913"),
+ externalProjection: new OpenLayers.Projection("EPSG:4326")
+ });
+ var data = format.write(f);
+ var found = (data.search('139.734') != -1);
+ t.ok(found, "Found 139.734 (correct reprojection) in data output.");
+ }
function test_Format_KML_read(t) {
t.plan(5);
var features = (new OpenLayers.Format.KML()).read(this.test_content);
@@ -35,6 +47,7 @@
"read geometry collection");
}
+
function test_Format_KML_readCdataAttributes_20(t) {
t.plan(2);
var cdata = '<kml xmlns="http://earth.google.com/kml/2.0"><Document><Placemark><name><![CDATA[Pezinok]]> </name><description><![CDATA[Full of text.]]></description><styleUrl>#rel1.0</styleUrl><Point> <coordinates>17.266666, 48.283333</coordinates></Point></Placemark></Document></kml>';
Modified: sandbox/cmoullet/openlayers/tests/Format/OSM.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/OSM.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Format/OSM.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -95,6 +95,18 @@
output = output.replace(/<\?[^>]*\?>/, '');
t.eq(output, osm_serialized_data[key], key + " serialized correctly");
}
+ }
+ function test_Format_OSM_write_reproject(t) {
+ t.plan(1);
+ var f = new OpenLayers.Format.OSM({'internalProjection': new OpenLayers.Projection("EPSG:900913")});
+ var feat = new OpenLayers.Feature.Vector(
+ new OpenLayers.Geometry.Point(100000, 100000)
+ );
+ var data = f.write([feat]);
+ var f = new OpenLayers.Format.OSM();
+ var features = f.read(data);
+
+ t.eq(OpenLayers.Util.toFloat(features[0].geometry.x, 3), .898, "exported to lonlat and re-read as lonlat correctly")
}
</script>
</head>
Modified: sandbox/cmoullet/openlayers/tests/Format/OWSContext/v0_3_1.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/OWSContext/v0_3_1.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Format/OWSContext/v0_3_1.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read_wmswfs(t) {
- t.plan(16);
+ t.plan(17);
// taken from http://www.ogcnetwork.net/schemas/owc/0.3.1/context_nested.xml
// adapted: add an extra slash (roads/railways) in the Title of the WMS layer to test nesting
var text = '<?xml version="1.0" encoding="UTF-8"?>' +
@@ -61,6 +61,7 @@
map.zoomToExtent(new OpenLayers.Bounds(-117, 32, -116, 33));
var owc = parser.write(map, {id: 'ows-context-ex-1-v3', title: 'OWS Context version 0.3.1 showing nested layers'});
t.xml_eq(text, owc, "Can we roundtrip this nested OWSContext with a WMS and WFS layer?");
+ t.eq(context.layers[1].metadata.nestingPath[0], "Tiger 2005fe major roads/railways", "Nesting path is preserved even after calling write");
}
function test_write_wmswfs(t) {
Modified: sandbox/cmoullet/openlayers/tests/Format/WFSCapabilities/v1.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Format/WFSCapabilities/v1.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Format/WFSCapabilities/v1.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -4,7 +4,7 @@
<script type="text/javascript">
function test_read(t) {
- t.plan(30);
+ t.plan(33);
var parser = new OpenLayers.Format.WFSCapabilities();
@@ -17,6 +17,7 @@
t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct");
t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct");
+ t.eq(ft[0]["srs"], "urn:x-ogc:def:crs:EPSG:4326", "srs of first feature type correct");
// GeoServer, v1.0.0
text = '<?xml version="1.0" encoding="UTF-8"?><WFS_Capabilities version="1.0.0" xmlns="http://www.opengis.net/wfs" xmlns:it.geosolutions="http://www.geo-solutions.it" xmlns:cite="http://www.opengeospatial.net/cite" xmlns:tiger="http://www.census.gov" xmlns:sde="http://geoserver.sf.net" xmlns:topp="http://www.openplans.org/topp" xmlns:sf="http://www.openplans.org/spearfish" xmlns:nurc="http://www.nurc.nato.int" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:80/geoserver/schemas/wfs/1.0.0/WFS-capabilities.xsd"><Service><Name>WFS</Name><Title>GeoServer Web Feature Service</Title><Abstract>This is the reference implementation of WFS 1.0.0 and WFS 1.1.0, supports all WFS operations including Transaction.</Abstract><Keywords>WFS, WMS, GEOSERVER</Keywords><OnlineResource>http://localhost:80/geoserver/wfs</OnlineResource><Fees>NONE</Fees><AccessConstraints>NONE</Acce
ssConstraints></Service><Capability><Request><GetCapabilities><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=GetCapabilities"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></GetCapabilities><DescribeFeatureType><SchemaDescriptionLanguage><XMLSCHEMA/></SchemaDescriptionLanguage><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=DescribeFeatureType"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></DescribeFeatureType><GetFeature><ResultFormat><GML2/><SHAPE-ZIP/><GEOJSON/><csv/><GML3/></ResultFormat><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=GetFeature"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></GetFeature><Transaction><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=T
ransaction"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></Transaction><LockFeature><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=LockFeature"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></LockFeature><GetFeatureWithLock><ResultFormat><GML2/></ResultFormat><DCPType><HTTP><Get onlineResource="http://localhost:80/geoserver/wfs?request=GetFeatureWithLock"/></HTTP></DCPType><DCPType><HTTP><Post onlineResource="http://localhost:80/geoserver/wfs?"/></HTTP></DCPType></GetFeatureWithLock></Request></Capability><FeatureTypeList><Operations><Query/><Insert/><Update/><Delete/><Lock/></Operations><FeatureType><Name>tiger:poly_landmarks</Name><Title>Manhattan (NY) landmarks</Title><Abstract>Manhattan landmarks, identifies water, lakes, parks, interesting buildilngs</Abstract><Keywords>DS_poly_landmarks, poly_landmarks, landmarks,
manhattan</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="-74.047185" miny="40.679648" maxx="-73.90782" maxy="40.882078"/></FeatureType><FeatureType><Name>tiger:poi</Name><Title>Manhattan (NY) points of interest</Title><Abstract>Points of interest in New York, New York (on Manhattan). One of the attributes contains the name of a file with a picture of the point of interest.</Abstract><Keywords>poi, DS_poi, points_of_interest, Manhattan</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="-74.0118315772888" miny="40.70754683896324" maxx="-74.00857344353275" maxy="40.711945649065406"/></FeatureType><FeatureType><Name>tiger:tiger_roads</Name><Title>Manhattan (NY) roads</Title><Abstract>Highly simplified road layout of Manhattan in New York..</Abstract><Keywords>DS_tiger_roads, tiger_roads, roads</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="-74.02722" miny="40.684221" maxx="-73.907005" maxy="40.878178"/></FeatureType><FeatureType><Name>sf:archsites</Name><
Title>Spearfish archeological sites</Title><Abstract>Sample data from GRASS, archeological sites location, Spearfish, South Dakota, USA</Abstract><Keywords>archsites, sfArchsites, spearfish, archeology</Keywords><SRS>EPSG:26713</SRS><LatLongBoundingBox minx="-103.8725637911543" miny="44.37740330855979" maxx="-103.63794182141925" maxy="44.48804280772808"/></FeatureType><FeatureType><Name>sf:bugsites</Name><Title>Spearfish bug locations</Title><Abstract>Sample data from GRASS, bug sites location, Spearfish, South Dakota, USA</Abstract><Keywords>sfBugsites, bugsites, insects, spearfish, tiger_beetles</Keywords><SRS>EPSG:26713</SRS><LatLongBoundingBox minx="-103.86796131703647" miny="44.373938816704396" maxx="-103.63773523234195" maxy="44.43418821380063"/></FeatureType><FeatureType><Name>sf:restricted</Name><Title>Spearfish restricted areas</Title><Abstract>Sample data from GRASS, restricted areas, Spearfish, South Dakota, USA</Abstract><Keywords>restricted, sfRestricted, spearf
ish, areas</Keywords><SRS>EPSG:26713</SRS><LatLongBoundingBox minx="-103.85057172920756" miny="44.39436387625042" maxx="-103.74741494853805" maxy="44.48215752041131"/></FeatureType><FeatureType><Name>sf:roads</Name><Title>Spearfish roads</Title><Abstract>Sample data from GRASS, road layout, Spearfish, South Dakota, USA</Abstract><Keywords>sfRoads, roads, spearfish</Keywords><SRS>EPSG:26713</SRS><LatLongBoundingBox minx="-103.87741691493184" miny="44.37087275281798" maxx="-103.62231404880659" maxy="44.50015918338962"/></FeatureType><FeatureType><Name>sf:streams</Name><Title>Spearfish streams</Title><Abstract>Sample data from GRASS, streams, Spearfish, South Dakota, USA</Abstract><Keywords>sfStreams, streams, spearfish</Keywords><SRS>EPSG:26713</SRS><LatLongBoundingBox minx="-103.87789019829768" miny="44.372335260095554" maxx="-103.62287788915457" maxy="44.502218486214815"/></FeatureType><FeatureType><Name>topp:tasmania_cities</Name><Title>Tasmania cities</Title><Abstract>Citi
es in Tasmania (actually, just the capital)</Abstract><Keywords>cities, Tasmania</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="145.19754" miny="-43.423512" maxx="148.27298000000002" maxy="-40.852802"/></FeatureType><FeatureType><Name>topp:tasmania_roads</Name><Title>Tasmania roads</Title><Abstract>Main Tasmania roads</Abstract><Keywords>Roads, Tasmania</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="145.19754" miny="-43.423512" maxx="148.27298000000002" maxy="-40.852802"/></FeatureType><FeatureType><Name>topp:tasmania_state_boundaries</Name><Title>Tasmania state boundaries</Title><Abstract>Tasmania state boundaries</Abstract><Keywords>tasmania_state_boundaries, Tasmania, boundaries</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="143.83482400000003" miny="-43.648056" maxx="148.47914100000003" maxy="-39.573891"/></FeatureType><FeatureType><Name>topp:tasmania_water_bodies</Name><Title>Tasmania water bodies</Title><Abstract>Tasmania water bodies</Abstra
ct><Keywords>Lakes, Bodies, Australia, Water, Tasmania</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="145.97161899999998" miny="-43.031944" maxx="147.219696" maxy="-41.775558"/></FeatureType><FeatureType><Name>topp:states</Name><Title>USA Population</Title><Abstract>This is some census data on the states.</Abstract><Keywords>census, united, boundaries, state, states</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="-124.731422" miny="24.955967" maxx="-66.969849" maxy="49.371735"/></FeatureType><FeatureType><Name>tiger:giant_polygon</Name><Title>World rectangle</Title><Abstract>A simple rectangular polygon covering most of the world, it\'s only used for the purpose of providing a background (WMS bgcolor could be used instead)</Abstract><Keywords>DS_giant_polygon, giant_polygon</Keywords><SRS>EPSG:4326</SRS><LatLongBoundingBox minx="-180.0" miny="-90.0" maxx="180.0" maxy="90.0"/></FeatureType></FeatureTypeList><ogc:Filter_Capabilities><ogc:Spatial_Capabilities><
ogc:Spatial_Operators><ogc:Disjoint/><ogc:Equals/><ogc:DWithin/><ogc:Beyond/><ogc:Intersect/><ogc:Touches/><ogc:Crosses/><ogc:Within/><ogc:Contains/><ogc:Overlaps/><ogc:BBOX/></ogc:Spatial_Operators></ogc:Spatial_Capabilities><ogc:Scalar_Capabilities><ogc:Logical_Operators/><ogc:Comparison_Operators><ogc:Simple_Comparisons/><ogc:Between/><ogc:Like/><ogc:NullCheck/></ogc:Comparison_Operators><ogc:Arithmetic_Operators><ogc:Simple_Arithmetic/><ogc:Functions><ogc:Function_Names><ogc:Function_Name nArgs="1">abs</ogc:Function_Name><ogc:Function_Name nArgs="1">abs_2</ogc:Function_Name><ogc:Function_Name nArgs="1">abs_3</ogc:Function_Name><ogc:Function_Name nArgs="1">abs_4</ogc:Function_Name><ogc:Function_Name nArgs="1">acos</ogc:Function_Name><ogc:Function_Name nArgs="1">Area</ogc:Function_Name><ogc:Function_Name nArgs="1">asin</ogc:Function_Name><ogc:Function_Name nArgs="1">atan</ogc:Function_Name><ogc:Function_Name nArgs="2">atan2</ogc:Function_Name><ogc:Function_Name nArgs="3">b
etween</ogc:Function_Name><ogc:Function_Name nArgs="1">boundary</ogc:Function_Name><ogc:Function_Name nArgs="1">boundaryDimension</ogc:Function_Name><ogc:Function_Name nArgs="2">buffer</ogc:Function_Name><ogc:Function_Name nArgs="3">bufferWithSegments</ogc:Function_Name><ogc:Function_Name nArgs="1">ceil</ogc:Function_Name><ogc:Function_Name nArgs="1">centroid</ogc:Function_Name><ogc:Function_Name nArgs="2">classify</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Average</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Bounds</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Count</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Max</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Median</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Min</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Sum</ogc:Function_Name><ogc:Function_Name nArgs="1">Collection_Unique</ogc:Function_Name><ogc:Function_Name nArgs="2">Con
catenate</ogc:Function_Name><ogc:Function_Name nArgs="2">contains</ogc:Function_Name><ogc:Function_Name nArgs="1">convexHull</ogc:Function_Name><ogc:Function_Name nArgs="1">cos</ogc:Function_Name><ogc:Function_Name nArgs="2">crosses</ogc:Function_Name><ogc:Function_Name nArgs="2">dateFormat</ogc:Function_Name><ogc:Function_Name nArgs="2">dateParse</ogc:Function_Name><ogc:Function_Name nArgs="2">difference</ogc:Function_Name><ogc:Function_Name nArgs="1">dimension</ogc:Function_Name><ogc:Function_Name nArgs="2">disjoint</ogc:Function_Name><ogc:Function_Name nArgs="2">distance</ogc:Function_Name><ogc:Function_Name nArgs="1">double2bool</ogc:Function_Name><ogc:Function_Name nArgs="1">endPoint</ogc:Function_Name><ogc:Function_Name nArgs="1">envelope</ogc:Function_Name><ogc:Function_Name nArgs="2">EqualInterval</ogc:Function_Name><ogc:Function_Name nArgs="2">equalsExact</ogc:Function_Name><ogc:Function_Name nArgs="3">equalsExactTolerance</ogc:Function_Name><ogc:Function_Name nArgs
="2">equalTo</ogc:Function_Name><ogc:Function_Name nArgs="1">exp</ogc:Function_Name><ogc:Function_Name nArgs="1">exteriorRing</ogc:Function_Name><ogc:Function_Name nArgs="1">floor</ogc:Function_Name><ogc:Function_Name nArgs="1">geometryType</ogc:Function_Name><ogc:Function_Name nArgs="1">geomFromWKT</ogc:Function_Name><ogc:Function_Name nArgs="1">geomLength</ogc:Function_Name><ogc:Function_Name nArgs="2">getGeometryN</ogc:Function_Name><ogc:Function_Name nArgs="1">getX</ogc:Function_Name><ogc:Function_Name nArgs="1">getY</ogc:Function_Name><ogc:Function_Name nArgs="1">getZ</ogc:Function_Name><ogc:Function_Name nArgs="2">greaterEqualThan</ogc:Function_Name><ogc:Function_Name nArgs="2">greaterThan</ogc:Function_Name><ogc:Function_Name nArgs="0">id</ogc:Function_Name><ogc:Function_Name nArgs="2">IEEEremainder</ogc:Function_Name><ogc:Function_Name nArgs="3">if_then_else</ogc:Function_Name><ogc:Function_Name nArgs="11">in10</ogc:Function_Name><ogc:Function_Name nArgs="3">in2</ogc
:Function_Name><ogc:Function_Name nArgs="4">in3</ogc:Function_Name><ogc:Function_Name nArgs="5">in4</ogc:Function_Name><ogc:Function_Name nArgs="6">in5</ogc:Function_Name><ogc:Function_Name nArgs="7">in6</ogc:Function_Name><ogc:Function_Name nArgs="8">in7</ogc:Function_Name><ogc:Function_Name nArgs="9">in8</ogc:Function_Name><ogc:Function_Name nArgs="10">in9</ogc:Function_Name><ogc:Function_Name nArgs="1">int2bbool</ogc:Function_Name><ogc:Function_Name nArgs="1">int2ddouble</ogc:Function_Name><ogc:Function_Name nArgs="1">interiorPoint</ogc:Function_Name><ogc:Function_Name nArgs="2">interiorRingN</ogc:Function_Name><ogc:Function_Name nArgs="2">intersection</ogc:Function_Name><ogc:Function_Name nArgs="2">intersects</ogc:Function_Name><ogc:Function_Name nArgs="1">isClosed</ogc:Function_Name><ogc:Function_Name nArgs="1">isEmpty</ogc:Function_Name><ogc:Function_Name nArgs="2">isLike</ogc:Function_Name><ogc:Function_Name nArgs="1">isNull</ogc:Function_Name><ogc:Function_Name nArgs
="1">isRing</ogc:Function_Name><ogc:Function_Name nArgs="1">isSimple</ogc:Function_Name><ogc:Function_Name nArgs="1">isValid</ogc:Function_Name><ogc:Function_Name nArgs="3">isWithinDistance</ogc:Function_Name><ogc:Function_Name nArgs="1">length</ogc:Function_Name><ogc:Function_Name nArgs="2">lessEqualThan</ogc:Function_Name><ogc:Function_Name nArgs="2">lessThan</ogc:Function_Name><ogc:Function_Name nArgs="1">log</ogc:Function_Name><ogc:Function_Name nArgs="2">max</ogc:Function_Name><ogc:Function_Name nArgs="2">max_2</ogc:Function_Name><ogc:Function_Name nArgs="2">max_3</ogc:Function_Name><ogc:Function_Name nArgs="2">max_4</ogc:Function_Name><ogc:Function_Name nArgs="2">min</ogc:Function_Name><ogc:Function_Name nArgs="2">min_2</ogc:Function_Name><ogc:Function_Name nArgs="2">min_3</ogc:Function_Name><ogc:Function_Name nArgs="2">min_4</ogc:Function_Name><ogc:Function_Name nArgs="1">not</ogc:Function_Name><ogc:Function_Name nArgs="2">notEqualTo</ogc:Function_Name><ogc:Function_N
ame nArgs="1">numGeometries</ogc:Function_Name><ogc:Function_Name nArgs="1">numInteriorRing</ogc:Function_Name><ogc:Function_Name nArgs="1">numPoints</ogc:Function_Name><ogc:Function_Name nArgs="2">overlaps</ogc:Function_Name><ogc:Function_Name nArgs="1">parseBoolean</ogc:Function_Name><ogc:Function_Name nArgs="1">parseDouble</ogc:Function_Name><ogc:Function_Name nArgs="1">parseInt</ogc:Function_Name><ogc:Function_Name nArgs="0">pi</ogc:Function_Name><ogc:Function_Name nArgs="2">pointN</ogc:Function_Name><ogc:Function_Name nArgs="2">pow</ogc:Function_Name><ogc:Function_Name nArgs="1">PropertyExists</ogc:Function_Name><ogc:Function_Name nArgs="2">Quantile</ogc:Function_Name><ogc:Function_Name nArgs="0">random</ogc:Function_Name><ogc:Function_Name nArgs="2">relate</ogc:Function_Name><ogc:Function_Name nArgs="3">relatePattern</ogc:Function_Name><ogc:Function_Name nArgs="1">rint</ogc:Function_Name><ogc:Function_Name nArgs="1">round</ogc:Function_Name><ogc:Function_Name nArgs="1"
>round_2</ogc:Function_Name><ogc:Function_Name nArgs="1">roundDouble</ogc:Function_Name><ogc:Function_Name nArgs="1">sin</ogc:Function_Name><ogc:Function_Name nArgs="1">sqrt</ogc:Function_Name><ogc:Function_Name nArgs="2">StandardDeviation</ogc:Function_Name><ogc:Function_Name nArgs="1">startPoint</ogc:Function_Name><ogc:Function_Name nArgs="2">strConcat</ogc:Function_Name><ogc:Function_Name nArgs="2">strEndsWith</ogc:Function_Name><ogc:Function_Name nArgs="2">strEqualsIgnoreCase</ogc:Function_Name><ogc:Function_Name nArgs="2">strIndexOf</ogc:Function_Name><ogc:Function_Name nArgs="2">strLastIndexOf</ogc:Function_Name><ogc:Function_Name nArgs="1">strLength</ogc:Function_Name><ogc:Function_Name nArgs="2">strMatches</ogc:Function_Name><ogc:Function_Name nArgs="4">strReplace</ogc:Function_Name><ogc:Function_Name nArgs="2">strStartsWith</ogc:Function_Name><ogc:Function_Name nArgs="3">strSubstring</ogc:Function_Name><ogc:Function_Name nArgs="2">strSubstringStart</ogc:Function_Nam
e><ogc:Function_Name nArgs="1">strToLowerCase</ogc:Function_Name><ogc:Function_Name nArgs="1">strToUpperCase</ogc:Function_Name><ogc:Function_Name nArgs="1">strTrim</ogc:Function_Name><ogc:Function_Name nArgs="2">symDifference</ogc:Function_Name><ogc:Function_Name nArgs="1">tan</ogc:Function_Name><ogc:Function_Name nArgs="1">toDegrees</ogc:Function_Name><ogc:Function_Name nArgs="1">toRadians</ogc:Function_Name><ogc:Function_Name nArgs="2">touches</ogc:Function_Name><ogc:Function_Name nArgs="1">toWKT</ogc:Function_Name><ogc:Function_Name nArgs="2">union</ogc:Function_Name><ogc:Function_Name nArgs="2">UniqueInterval</ogc:Function_Name><ogc:Function_Name nArgs="2">within</ogc:Function_Name></ogc:Function_Names></ogc:Functions></ogc:Arithmetic_Operators></ogc:Scalar_Capabilities></ogc:Filter_Capabilities></WFS_Capabilities>';
@@ -27,6 +28,7 @@
t.eq(ft[0]["title"], "Manhattan (NY) landmarks", "title of first feature type correct");
t.eq(ft[0]["name"], "poly_landmarks", "name of first feature type correct");
t.eq(ft[0]["featureNS"], "http://www.census.gov", "ns of first feature type correct");
+ t.eq(ft[0]["srs"], "EPSG:4326", "srs of first feature type correct");
var service = res.service;
t.eq(service.name, 'WFS', "service name correct");
@@ -137,6 +139,7 @@
t.eq(ft.length, 2, "number of feature types correct");
t.eq(ft[0]["title"], "Parks", "title of first feature type correct");
t.eq(ft[0]["name"], "park", "name of first feature type correct");
+ t.eq(ft[0]["srs"], "EPSG:42304", "srs of first feature type correct");
var service = res.service;
t.eq(service.name, 'MapServer WFS', "service name correct");
Modified: sandbox/cmoullet/openlayers/tests/Handler/Drag.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Drag.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Handler/Drag.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -440,7 +440,159 @@
"deactivate sets start to null");
}
+ function test_interval_timer_after_mouseup(t) {
+ t.plan(5);
+ // set up
+
+ var map = new OpenLayers.Map('map');
+
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+
+ var moveCnt;
+
+ var handler = new OpenLayers.Handler.Drag(control, {}, {
+ interval: 1,
+ move: function() {
+ moveCnt++;
+ }
+ });
+ handler.activate();
+
+ handler.checkModifiers = function() { return true; };
+
+ var ilc = OpenLayers.Event.isLeftClick;
+ OpenLayers.Event.isLeftClick = function() { return true; };
+
+ // test
+
+ moveCnt = 0;
+
+ var xy1 = new OpenLayers.Pixel(1, 2);
+ handler.mousedown({xy: xy1});
+ t.ok(handler.last == xy1, "[mousedown] last is as expected");
+ var xy2 = new OpenLayers.Pixel(2, 3);
+ handler.mousemove({xy: xy2});
+ t.ok(handler.last == xy2, "[mousemove 1] last is as expected");
+ t.ok(handler.timeoutId != null, "[mousemove 1] timeoutId is set");
+ var xy3 = new OpenLayers.Pixel(3, 4);
+ handler.mousemove({xy: xy3});
+ t.ok(handler.last == xy2, "[mousemove 2] last is as expected");
+ var xy4 = new OpenLayers.Pixel(4, 5);
+ handler.mouseup({xy: xy4});
+
+ t.delay_call(3, function() {
+ // the timer should not cause a move
+ t.eq(moveCnt, 1, "move called once");
+ // tear down
+ OpenLayers.Event.isLeftClick = ilc;
+ });
+ }
+
+ function test_interval_timer_after_mousedown(t) {
+ t.plan(5);
+
+ // set up
+
+ var map = new OpenLayers.Map('map');
+
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+
+ var moveCnt;
+
+ var handler = new OpenLayers.Handler.Drag(control, {}, {
+ interval: 1,
+ move: function() {
+ moveCnt++;
+ }
+ });
+ handler.activate();
+
+ handler.checkModifiers = function() { return true; };
+
+ var ilc = OpenLayers.Event.isLeftClick;
+ OpenLayers.Event.isLeftClick = function() { return true; };
+
+ // test
+
+ moveCnt = 0;
+
+ var xy1 = new OpenLayers.Pixel(1, 2);
+ handler.mousedown({xy: xy1});
+ t.ok(handler.last == xy1, "[mousedown] last is as expected");
+ var xy2 = new OpenLayers.Pixel(2, 3);
+ handler.mousemove({xy: xy2});
+ t.ok(handler.last == xy2, "[mousemove 1] last is as expected");
+ t.ok(handler.timeoutId != null, "[mousemove 1] timeoutId is set");
+ var xy3 = new OpenLayers.Pixel(3, 4);
+ handler.mousemove({xy: xy3});
+ t.ok(handler.last == xy2, "[mousemove 2] last is as expected");
+ var xy4 = new OpenLayers.Pixel(4, 5);
+ handler.mouseup({xy: xy4});
+ var xy5 = new OpenLayers.Pixel(5, 6);
+ handler.mousedown({xy: xy4});
+
+ t.delay_call(3, function() {
+ // the timer should not cause a move
+ t.eq(moveCnt, 1, "move called once");
+ // tear down
+ OpenLayers.Event.isLeftClick = ilc;
+ });
+ }
+
+ function test_interval_timer_before_mouseup(t) {
+ t.plan(5);
+
+ // set up
+
+ var map = new OpenLayers.Map('map');
+
+ var control = new OpenLayers.Control();
+ map.addControl(control);
+
+ var moveCnt;
+
+ var handler = new OpenLayers.Handler.Drag(control, {}, {
+ interval: 1,
+ move: function() {
+ moveCnt++;
+ }
+ });
+ handler.activate();
+
+ handler.checkModifiers = function() { return true; };
+
+ var ilc = OpenLayers.Event.isLeftClick;
+ OpenLayers.Event.isLeftClick = function() { return true; };
+
+ // test
+
+ moveCnt = 0;
+
+ var xy1 = new OpenLayers.Pixel(1, 2);
+ handler.mousedown({xy: xy1});
+ t.ok(handler.last == xy1, "[mousedown] last is as expected");
+ var xy2 = new OpenLayers.Pixel(2, 3);
+ handler.mousemove({xy: xy2});
+ t.ok(handler.last == xy2, "[mousemove 1] last is as expected");
+ t.ok(handler.timeoutId != null, "[mousemove 1] timeoutId is set");
+ var xy3 = new OpenLayers.Pixel(3, 4);
+ handler.mousemove({xy: xy3});
+ t.ok(handler.last == xy2, "[mousemove 2] last is as expected");
+
+ t.delay_call(3, function() {
+ // the timer should cause a move
+ t.eq(moveCnt, 2, "move called twice");
+ var xy4 = new OpenLayers.Pixel(4, 5);
+ handler.mouseup({xy: xy4});
+ // tear down
+ OpenLayers.Event.isLeftClick = ilc;
+ });
+ }
+
+
</script>
</head>
<body>
Modified: sandbox/cmoullet/openlayers/tests/Map.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Map.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Map.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -163,8 +163,15 @@
}
function test_Map_center(t) {
- t.plan(8);
- map = new OpenLayers.Map('map');
+ t.plan(11);
+ var log = [];
+ map = new OpenLayers.Map('map', {
+ eventListeners: {
+ "movestart": function() {log.push("movestart");},
+ "move": function() {log.push("move");},
+ "moveend": function() {log.push("moveend");}
+ }
+ });
var baseLayer = new OpenLayers.Layer.WMS("Test Layer",
"http://octo.metacarta.com/cgi-bin/mapserv?",
{map: "/mapdata/vmap_wms.map", layers: "basic"} );
@@ -180,7 +187,11 @@
map.zoomOut();
t.eq( map.getZoom(), 0, "map.zoom is correct after calling setCenter,zoom in, zoom out");
+ log = [];
map.zoomTo(5);
+ t.eq(log[0], "movestart", "zoomTo fires movestart event");
+ t.eq(log[1], "move", "zoomTo fires move event");
+ t.eq(log[2], "moveend", "zoomTo fires moveend event");
t.eq( map.getZoom(), 5, "map.zoom is correct after calling zoomTo" );
/**
@@ -1527,20 +1538,60 @@
function test_panTo(t) {
- t.plan(2);
+ t.plan(6);
- var map = new OpenLayers.Map("map");
+ var log = [];
+ var map = new OpenLayers.Map("map", {
+ eventListeners: {
+ "movestart": function() {log.push("movestart");},
+ "move": function() {log.push("move");},
+ "moveend": function() {log.push("moveend");}
+ }
+ });
map.addLayer(
new OpenLayers.Layer(null, {isBaseLayer: true})
);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
+ t.eq(log[log.length-1], "moveend", "moveend fired when map center is set");
+ log = [];
map.panTo(new OpenLayers.LonLat(1, 0));
t.eq(map.panTween.playing, true, "the map pan tween is playing before destroy");
- map.destroy();
- t.ok(!map.panTween || !map.panTween.playing, "the map pan tween is not playing after destroy");
+ t.delay_call(2, function() {
+ t.eq(log[0], "movestart", "panTo starts with movestart event");
+ t.eq(log[1], "move", "move events fired while panning");
+ t.eq(log[log.length-1], "moveend", "panTo finishes with moveend event");
+ map.destroy();
+ t.ok(!map.panTween || !map.panTween.playing, "the map pan tween is not playing after destroy");
+ });
}
+
+ function test_pan(t) {
+ t.plan(4);
+
+ var map = new OpenLayers.Map("map");
+ map.addLayer(
+ new OpenLayers.Layer(null, {isBaseLayer: true})
+ );
+ map.setCenter(new OpenLayers.LonLat(0, 0), 5);
+ var log = [];
+ map.events.on({
+ "movestart": function() {log.push("movestart");},
+ "move": function() {log.push("move");},
+ "moveend": function() {log.push("moveend");}
+ });
+
+ // simulate the drag sequence of the DragPan control;
+ map.pan(5,5, {animate: false, dragging: true});
+ map.pan(1,1, {animate: false, dragging: false});
+
+ t.eq(log[0], "movestart", "pan sequence starts with movestart");
+ t.eq(log[1], "move", "followed by move,");
+ t.eq(log[log.length-2], "move", "move again before we stop panning,");
+ t.eq(log[log.length-1], "moveend", "and moveend when we're done.");
+
+ }
function test_updateSize(t) {
t.plan(2);
Modified: sandbox/cmoullet/openlayers/tests/Protocol/HTTP.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Protocol/HTTP.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Protocol/HTTP.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -287,291 +287,6 @@
t.eq(ret, null, 'parseFeatures returns expected value');
}
- function test_filterToParams(t) {
- t.plan(30);
-
- // setup
-
- var protocol, filter, params;
-
- protocol = new OpenLayers.Protocol.HTTP();
-
- // 1 test
- var filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 1, 2, 3)
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 1, 2, 3],
- "filterToParams sets correct bbox param if passed a BBOX filter");
-
- // 3 tests
- var lon = 100, lat = 200, tolerance = 10;
- filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.DWITHIN,
- value: new OpenLayers.Geometry.Point(lon, lat),
- distance: tolerance
- });
- params = protocol.filterToParams(filter);
- t.eq(params.lon, lon,
- "filterToParams sets correct lon param if passed a DWITHIN filter");
- t.eq(params.lat, lat,
- "filterToParams sets correct lat param if passed a DWITHIN filter");
- t.eq(params.tolerance, tolerance,
- "filterToParams sets correct tolerance param if passed a DWITHIN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.WITHIN,
- value: new OpenLayers.Geometry.Point(lon, lat)
- });
- params = protocol.filterToParams(filter);
- t.eq(params.lon, lon,
- "filterToParams sets correct lon param if passed a WITHIN filter");
- t.eq(params.lat, lat,
- "filterToParams sets correct lat param if passed a WITHIN filter");
-
- // Some bbox filters used in the next tests.
-
- var bboxFilter1 = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 0, 10, 10)
- });
-
- var bboxFilter2 = new OpenLayers.Filter.Spatial({
- type: OpenLayers.Filter.Spatial.BBOX,
- value: new OpenLayers.Bounds(0, 0, 20, 20)
- });
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: []
- });
- params = protocol.filterToParams(filter);
- t.eq(params, {},
- "filterToParams returns empty object if given empty AND Logical filter");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.OR,
- filters: [
- bboxFilter1
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params, {},
- "filterToParams does not support OR Logical filter");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- bboxFilter1
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 0, 10, 10],
- "filterToParams sets correct bbox param if passed " +
- "a Logical filter containing a BBOX");
-
- // 1 test
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- bboxFilter1, bboxFilter2
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.bbox, [0, 0, 20, 20],
- "filterToParams sets correct bbox param if passed " +
- "multiple BBOX filter in a Logical filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an EQUAL_TO filter");
- t.eq(params["foo__eq"], "bar",
- "filterToParams sets correct param key and value if passed an EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an NOT_EQUAL_TO filter");
- t.eq(params["foo__ne"], "bar",
- "filterToParams sets correct param key and value if passed an NOT_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN,
- property: "foo",
- value: "bar"
- });
- var params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an LESS_THAN filter");
- t.eq(params["foo__lt"], "bar",
- "filterToParams sets correct param key and value if passed an LESS_THAN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- var params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an LESS_THAN_OR_EQUAL_TO filter");
- t.eq(params["foo__lte"], "bar",
- "filterToParams sets correct param key and value if passed an LESS_THAN_OR_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.GREATER_THAN,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an GREATER_THAN filter");
- t.eq(params["foo__gt"], "bar",
- "filterToParams sets correct param key and value if passed an GREATER_THAN filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an GREATER_THAN_OR_EQUAL_TO filter");
- t.eq(params["foo__gte"], "bar",
- "filterToParams sets correct param key and value if passed an GREATER_THAN_OR_EQUAL_TO filter");
-
- // 2 tests
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed a LIKE filter");
- t.eq(params["foo__ilike"], "bar",
- "filterToParams sets correct param key and value if passed an LIKE filter");
-
- // 4 tests
- filter = new OpenLayers.Filter.Logical({
- type: OpenLayers.Filter.Logical.AND,
- filters: [
- new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.EQUAL_TO,
- property: "foo",
- value: "bar"
- }),
- new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LESS_THAN,
- property: "foo2",
- value: "baz"
- })
- ]
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed an EQUAL_TO filter within a AND filter");
- t.eq(params["foo__eq"], "bar",
- "filterToParams sets correct param key and value if passed an EQUAL_TO filter within a AND filter");
- t.eq(params.queryable[1], "foo2",
- "filterToParams sets correct queryable param if passed a LESS_THAN filter within a AND filter");
- t.eq(params["foo2__lt"], "baz",
- "filterToParams sets correct param key and value if passed a LESS_THAN filter within a AND filter");
-
- // 2 tests
- protocol = new OpenLayers.Protocol.HTTP({wildcarded: true});
- filter = new OpenLayers.Filter.Comparison({
- type: OpenLayers.Filter.Comparison.LIKE,
- property: "foo",
- value: "bar"
- });
- params = protocol.filterToParams(filter);
- t.eq(params.queryable[0], "foo",
- "filterToParams sets correct queryable param if passed a LIKE filter (wildcarded true)");
- t.eq(params["foo__ilike"], "%bar%",
- "filterToParams sets correct param key and value if passed an LIKE filter (wildcarded true)");
- }
-
- function test_regex2value(t) {
- t.plan(16);
-
- // setup
-
- var protocol = new OpenLayers.Protocol.HTTP();
- var value;
-
- // test
-
- value = protocol.regex2value("foo");
- t.eq(value, "foo", 'regex2value converts "foo" to "foo"');
-
- value = protocol.regex2value("foo%");
- t.eq(value, "foo\\%", 'regex2value converts "foo%" to "foo\\%"');
-
- value = protocol.regex2value("foo.*");
- t.eq(value, "foo%", 'regex2value converts "foo.*" to "foo%"');
-
- value = protocol.regex2value("f.*oo.*");
- t.eq(value, "f%oo%", 'regex2value converts "f.*oo.*" to "f%oo%"');
-
- value = protocol.regex2value("foo.");
- t.eq(value, "foo_", 'regex2value converts "foo." to "foo_"');
-
- value = protocol.regex2value("f.oo.");
- t.eq(value, "f_oo_", 'regex2value converts "f.oo." to "f_oo_"');
-
- value = protocol.regex2value("f.oo.*");
- t.eq(value, "f_oo%", 'regex2value converts "f.oo.*" to "f_oo%"');
-
- value = protocol.regex2value("foo\\\\");
- t.eq(value, "foo\\\\", 'regex2value converts "foo\\\\" to "foo\\\\"');
-
- value = protocol.regex2value("foo\\.");
- t.eq(value, "foo.", 'regex2value converts "foo\\." to "foo."');
-
- value = protocol.regex2value("foo\\\\.");
- t.eq(value, "foo\\\\_", 'regex2value converts "foo\\\\." to "foo\\\\_"');
-
- value = protocol.regex2value("foo\\*");
- t.eq(value, "foo*", 'regex2value converts "foo\\*" to "foo*"');
-
- value = protocol.regex2value("foo\\\\*");
- t.eq(value, "foo\\\\*", 'regex2value converts "foo\\\\*" to "foo\\\\*"');
-
- value = protocol.regex2value("foo\\\\.*");
- t.eq(value, "foo\\\\%", 'regex2value converts "foo\\\\.*" to "foo\\\\%"');
-
- value = protocol.regex2value("fo\\.o.*");
- t.eq(value, "fo.o%", 'regex2value converts from "fo\\.o.*" to "fo.o%"');
-
- value = protocol.regex2value("fo.*o\\.");
- t.eq(value, "fo%o.", 'regex2value converts from "fo.*o\\." to "to%o."');
-
- value = protocol.regex2value("\\*\\..*.\\\\.*\\\\.%");
- t.eq(value, "*.%_\\\\%\\\\_\\%",
- 'regex2value converts from "\\*\\..*.\\\\.*\\\\.%" ' +
- 'to "*.%_\\\\%\\\\_\\%"');
- }
-
function test_create(t) {
t.plan(10);
var protocol = new OpenLayers.Protocol.HTTP({
Copied: sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html (from rev 11678, trunk/openlayers/tests/Protocol/SimpleFilterSerializer.html)
===================================================================
--- sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html (rev 0)
+++ sandbox/cmoullet/openlayers/tests/Protocol/SimpleFilterSerializer.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -0,0 +1,310 @@
+<html>
+<head>
+ <script src="../../lib/OpenLayers.js"></script>
+ <script type="text/javascript">
+
+
+ function test_filterToParams(t) {
+ t.plan(30);
+
+ // setup
+
+ var protocol, filter, params;
+
+ protocol = new OpenLayers.Protocol.HTTP({
+ filterToParams: OpenLayers.Protocol.simpleFilterSerializer
+ });
+
+ // 1 test
+ var filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 1, 2, 3)
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.bbox, [0, 1, 2, 3],
+ "filterToParams sets correct bbox param if passed a BBOX filter");
+
+ // 3 tests
+ var lon = 100, lat = 200, tolerance = 10;
+ filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.DWITHIN,
+ value: new OpenLayers.Geometry.Point(lon, lat),
+ distance: tolerance
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.lon, lon,
+ "filterToParams sets correct lon param if passed a DWITHIN filter");
+ t.eq(params.lat, lat,
+ "filterToParams sets correct lat param if passed a DWITHIN filter");
+ t.eq(params.tolerance, tolerance,
+ "filterToParams sets correct tolerance param if passed a DWITHIN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.WITHIN,
+ value: new OpenLayers.Geometry.Point(lon, lat)
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.lon, lon,
+ "filterToParams sets correct lon param if passed a WITHIN filter");
+ t.eq(params.lat, lat,
+ "filterToParams sets correct lat param if passed a WITHIN filter");
+
+ // Some bbox filters used in the next tests.
+
+ var bboxFilter1 = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 0, 10, 10)
+ });
+
+ var bboxFilter2 = new OpenLayers.Filter.Spatial({
+ type: OpenLayers.Filter.Spatial.BBOX,
+ value: new OpenLayers.Bounds(0, 0, 20, 20)
+ });
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: []
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params, {},
+ "filterToParams returns empty object if given empty AND Logical filter");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.OR,
+ filters: [
+ bboxFilter1
+ ]
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params, {},
+ "filterToParams does not support OR Logical filter");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ bboxFilter1
+ ]
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.bbox, [0, 0, 10, 10],
+ "filterToParams sets correct bbox param if passed " +
+ "a Logical filter containing a BBOX");
+
+ // 1 test
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ bboxFilter1, bboxFilter2
+ ]
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.bbox, [0, 0, 20, 20],
+ "filterToParams sets correct bbox param if passed " +
+ "multiple BBOX filter in a Logical filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an EQUAL_TO filter");
+ t.eq(params["foo__eq"], "bar",
+ "filterToParams sets correct param key and value if passed an EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.NOT_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an NOT_EQUAL_TO filter");
+ t.eq(params["foo__ne"], "bar",
+ "filterToParams sets correct param key and value if passed an NOT_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN,
+ property: "foo",
+ value: "bar"
+ });
+ var params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an LESS_THAN filter");
+ t.eq(params["foo__lt"], "bar",
+ "filterToParams sets correct param key and value if passed an LESS_THAN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN_OR_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ var params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an LESS_THAN_OR_EQUAL_TO filter");
+ t.eq(params["foo__lte"], "bar",
+ "filterToParams sets correct param key and value if passed an LESS_THAN_OR_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.GREATER_THAN,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an GREATER_THAN filter");
+ t.eq(params["foo__gt"], "bar",
+ "filterToParams sets correct param key and value if passed an GREATER_THAN filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.GREATER_THAN_OR_EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an GREATER_THAN_OR_EQUAL_TO filter");
+ t.eq(params["foo__gte"], "bar",
+ "filterToParams sets correct param key and value if passed an GREATER_THAN_OR_EQUAL_TO filter");
+
+ // 2 tests
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed a LIKE filter");
+ t.eq(params["foo__ilike"], "bar",
+ "filterToParams sets correct param key and value if passed an LIKE filter");
+
+ // 4 tests
+ filter = new OpenLayers.Filter.Logical({
+ type: OpenLayers.Filter.Logical.AND,
+ filters: [
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.EQUAL_TO,
+ property: "foo",
+ value: "bar"
+ }),
+ new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LESS_THAN,
+ property: "foo2",
+ value: "baz"
+ })
+ ]
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed an EQUAL_TO filter within a AND filter");
+ t.eq(params["foo__eq"], "bar",
+ "filterToParams sets correct param key and value if passed an EQUAL_TO filter within a AND filter");
+ t.eq(params.queryable[1], "foo2",
+ "filterToParams sets correct queryable param if passed a LESS_THAN filter within a AND filter");
+ t.eq(params["foo2__lt"], "baz",
+ "filterToParams sets correct param key and value if passed a LESS_THAN filter within a AND filter");
+
+ // 2 tests
+ protocol = new OpenLayers.Protocol.HTTP({wildcarded: true});
+ filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "foo",
+ value: "bar"
+ });
+ params = protocol.filterToParams(filter);
+ t.eq(params.queryable[0], "foo",
+ "filterToParams sets correct queryable param if passed a LIKE filter (wildcarded true)");
+ t.eq(params["foo__ilike"], "%bar%",
+ "filterToParams sets correct param key and value if passed an LIKE filter (wildcarded true)");
+ }
+
+ function test_regex2value(t) {
+ t.plan(16);
+
+ // setup
+
+ var protocol = new OpenLayers.Protocol.HTTP({
+ filterToParams: OpenLayers.Protocol.simpleFilterSerializer
+ });
+
+ var value;
+ var filter = new OpenLayers.Filter.Comparison({
+ type: OpenLayers.Filter.Comparison.LIKE,
+ property: "prop"
+ });
+
+ function serialize(value) {
+ filter.value = value;
+ return protocol.filterToParams(filter).prop__ilike;
+ }
+
+ // test
+
+ value = serialize("foo");
+ t.eq(value, "foo", 'regex2value converts "foo" to "foo"');
+
+ value = serialize("foo%");
+ t.eq(value, "foo\\%", 'regex2value converts "foo%" to "foo\\%"');
+
+ value = serialize("foo.*");
+ t.eq(value, "foo%", 'regex2value converts "foo.*" to "foo%"');
+
+ value = serialize("f.*oo.*");
+ t.eq(value, "f%oo%", 'regex2value converts "f.*oo.*" to "f%oo%"');
+
+ value = serialize("foo.");
+ t.eq(value, "foo_", 'regex2value converts "foo." to "foo_"');
+
+ value = serialize("f.oo.");
+ t.eq(value, "f_oo_", 'regex2value converts "f.oo." to "f_oo_"');
+
+ value = serialize("f.oo.*");
+ t.eq(value, "f_oo%", 'regex2value converts "f.oo.*" to "f_oo%"');
+
+ value = serialize("foo\\\\");
+ t.eq(value, "foo\\\\", 'regex2value converts "foo\\\\" to "foo\\\\"');
+
+ value = serialize("foo\\.");
+ t.eq(value, "foo.", 'regex2value converts "foo\\." to "foo."');
+
+ value = serialize("foo\\\\.");
+ t.eq(value, "foo\\\\_", 'regex2value converts "foo\\\\." to "foo\\\\_"');
+
+ value = serialize("foo\\*");
+ t.eq(value, "foo*", 'regex2value converts "foo\\*" to "foo*"');
+
+ value = serialize("foo\\\\*");
+ t.eq(value, "foo\\\\*", 'regex2value converts "foo\\\\*" to "foo\\\\*"');
+
+ value = serialize("foo\\\\.*");
+ t.eq(value, "foo\\\\%", 'regex2value converts "foo\\\\.*" to "foo\\\\%"');
+
+ value = serialize("fo\\.o.*");
+ t.eq(value, "fo.o%", 'regex2value converts from "fo\\.o.*" to "fo.o%"');
+
+ value = serialize("fo.*o\\.");
+ t.eq(value, "fo%o.", 'regex2value converts from "fo.*o\\." to "to%o."');
+
+ value = serialize("\\*\\..*.\\\\.*\\\\.%");
+ t.eq(value, "*.%_\\\\%\\\\_\\%",
+ 'regex2value converts from "\\*\\..*.\\\\.*\\\\.%" ' +
+ 'to "*.%_\\\\%\\\\_\\%"');
+ }
+
+ </script>
+</head>
+<body>
+</body>
+</html>
Modified: sandbox/cmoullet/openlayers/tests/Protocol/WFS.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Protocol/WFS.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/Protocol/WFS.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -24,6 +24,39 @@
"initialize returns instance of custom versioned protocol")
}
+ function test_setGeometryName(t) {
+ t.plan(4);
+ var protocol = new OpenLayers.Protocol.WFS({
+ url: "http://some.url.org",
+ featureNS: "http://namespace.org",
+ featureType: "type",
+ geometryName: "geom"
+ });
+ t.eq(protocol.geometryName, "geom", "geometryName set correctly by constructor");
+ t.eq(protocol.format.geometryName, "geom", "geometryName correctly set on format by constructor");
+ // change the geometryName on the fly
+ protocol.setGeometryName("SHAPE");
+ t.eq(protocol.geometryName, "SHAPE", "geometryName changed correctly by setGeometryName");
+ t.eq(protocol.format.geometryName, "SHAPE", "geometryName correctly changed on format by setGeometryName");
+ protocol.destroy();
+ }
+
+ function test_setFeatureType(t) {
+ t.plan(4);
+ var protocol = new OpenLayers.Protocol.WFS({
+ url: "http://some.url.org",
+ featureNS: "http://namespace.org",
+ featureType: "type"
+ });
+ t.eq(protocol.featureType, "type", "featureType set correctly by constructor");
+ t.eq(protocol.format.featureType, "type", "featureType correctly set on format by constructor");
+ // change the feature type on the fly
+ protocol.setFeatureType("foo");
+ t.eq(protocol.featureType, "foo", "featureType changed correctly by setFeatureType");
+ t.eq(protocol.format.featureType, "foo", "featureType correctly changed on format by setFeatureType");
+ protocol.destroy();
+ }
+
function test_read(t) {
t.plan(7);
Modified: sandbox/cmoullet/openlayers/tests/list-tests.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/list-tests.html 2011-03-08 16:31:36 UTC (rev 11678)
+++ sandbox/cmoullet/openlayers/tests/list-tests.html 2011-03-08 21:36:50 UTC (rev 11679)
@@ -177,6 +177,7 @@
<li>Projection.html</li>
<li>Protocol.html</li>
<li>Protocol/HTTP.html</li>
+ <li>Protocol/SimpleFilterSerializer.html</li>
<li>Protocol/SQL.html</li>
<li>Protocol/SQL/Gears.html</li>
<li>Protocol/WFS.html</li>
More information about the Commits
mailing list