[OpenLayers-Commits] r11723 - in sandbox/cmoullet/openlayers: . examples lib/OpenLayers/Control lib/OpenLayers/Handler lib/OpenLayers/Layer lib/OpenLayers/Strategy tests tests/Control tests/Handler tests/Strategy

commits-20090109 at openlayers.org commits-20090109 at openlayers.org
Tue Mar 22 15:05:04 EDT 2011


Author: cmoullet
Date: 2011-03-22 12:05:03 -0700 (Tue, 22 Mar 2011)
New Revision: 11723

Added:
   sandbox/cmoullet/openlayers/examples/kml-pointtrack.html
   sandbox/cmoullet/openlayers/examples/kml-pointtrack.js
Modified:
   sandbox/cmoullet/openlayers/
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SLDSelect.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/PointTrack.js
   sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
   sandbox/cmoullet/openlayers/tests/Control/SLDSelect.html
   sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html
   sandbox/cmoullet/openlayers/tests/Handler/Point.html
   sandbox/cmoullet/openlayers/tests/Projection.html
   sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html
Log:
Merge with trunk



Property changes on: sandbox/cmoullet/openlayers
___________________________________________________________________
Modified: svn:mergeinfo
   - /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11688,11690-11714
   + /sandbox/roberthl/openlayers:9745-9748
/trunk/openlayers:11161-11688,11690-11722

Copied: sandbox/cmoullet/openlayers/examples/kml-pointtrack.html (from rev 11722, trunk/openlayers/examples/kml-pointtrack.html)
===================================================================
--- sandbox/cmoullet/openlayers/examples/kml-pointtrack.html	                        (rev 0)
+++ sandbox/cmoullet/openlayers/examples/kml-pointtrack.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -0,0 +1,38 @@
+<!DOCTYPE html>
+<html>
+    <head>
+        <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=0;" />
+        <meta name="apple-mobile-web-app-capable" content="yes" />
+        <title>OpenLayers KML Track in a PointTrack Layer Example</title>
+        <link rel="stylesheet" href="../theme/default/style.css" type="text/css">
+        <link rel="stylesheet" href="../theme/default/google.css" type="text/css">
+        <link rel="stylesheet" href="style.css" type="text/css">
+        <style>
+            .olControlAttribution {
+                bottom: 2px;
+            }
+        </style>
+        <script src="../lib/OpenLayers.js"></script>
+        <script src="kml-pointtrack.js"></script>
+    </head>
+    <body onload="init()">
+        <h1 id="title">Parsing gx:Track in KML</h1>
+        <p id="shortdesc">
+            Demonstrates populating a PointTrack layer with gx:Track elements from KML.
+        </p>
+        <div id="map" class="smallmap"></div>
+        <div id="docs">
+            <p>
+                If a KML document contains <code>&lt;gx:Track&gt;</code> 
+                elements and the extractTracks property is set true on the 
+                parser, features will be created that represent track points.
+                These track points can easily be visualized as track lines with
+                a <code>PointTrack</code> layer, preserving the KML's original
+                styles.
+            </p>
+            <p>
+                View the <a href="kml-pointtrack.js" target="_blank">kml-pointtrack.js</a>
+                source to see how this is done.
+        </div>
+    </body>
+</html>

Copied: sandbox/cmoullet/openlayers/examples/kml-pointtrack.js (from rev 11722, trunk/openlayers/examples/kml-pointtrack.js)
===================================================================
--- sandbox/cmoullet/openlayers/examples/kml-pointtrack.js	                        (rev 0)
+++ sandbox/cmoullet/openlayers/examples/kml-pointtrack.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -0,0 +1,51 @@
+var map;
+
+function init() {
+
+    var mercator = new OpenLayers.Projection("EPSG:900913");
+    var geographic = new OpenLayers.Projection("EPSG:4326");
+
+    map = new OpenLayers.Map({
+        div: "map",
+        projection: mercator,
+        layers: [
+            new OpenLayers.Layer.OSM(),
+            new OpenLayers.Layer.PointTrack("Aircraft Tracks", {
+                projection: geographic,
+                strategies: [new OpenLayers.Strategy.Fixed()],
+                protocol: new OpenLayers.Protocol.HTTP({
+                    url: "kml-track.kml",
+                    format: new OpenLayers.Format.KML({
+                        extractTracks: true,
+                        extractStyles: true
+                    })
+                }),
+                dataFrom: OpenLayers.Layer.PointTrack.TARGET_NODE,
+                styleFrom: OpenLayers.Layer.PointTrack.TARGET_NODE,
+                eventListeners: {
+                    "beforefeaturesadded": function(e) {
+                        // group the tracks by fid and create one track for
+                        // every fid
+                        var fid, points = [], feature;
+                        for (var i=0, len=e.features.length; i<len; i++) {
+                            feature = e.features[i];
+                            if (feature.fid !== fid || i === len-1) {
+                                fid = feature.fid;
+                                this.addNodes(points, {silent: true});
+                                points = [];
+                            }
+                            points.push(feature);
+                        }
+                        return false;
+                    }
+                }
+            })
+        ],
+        center: new OpenLayers.LonLat(-93.2735, 44.8349).transform(geographic, mercator),
+        zoom: 8
+    });
+
+    map.addControl(new OpenLayers.Control.LayerSwitcher());
+    
+};
+

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SLDSelect.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SLDSelect.js	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/SLDSelect.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -11,6 +11,7 @@
  * @requires OpenLayers/Handler/Path.js
  * @requires OpenLayers/Handler/Click.js
  * @requires OpenLayers/Filter/Spatial.js
+ * @requires OpenLayers/Format/SLD/v1_0_0.js
  */
 
 /**
@@ -272,7 +273,7 @@
                     maxScaleDenominator: layer.options.minScale})
             ]});
         }
-        return new OpenLayers.Format.SLD().write(sld);
+        return new OpenLayers.Format.SLD({srsName: this.map.getProjection()}).write(sld);
     },
 
     /**

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Control/WMSGetFeatureInfo.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -88,7 +88,10 @@
 
     /**
      * Property: infoFormat
-     * {String} The mimetype to request from the server
+     * {String} The mimetype to request from the server. If you are using 
+     * drillDown mode and have multiple servers that do not share a common 
+     * infoFormat, you can override the control's infoFormat by providing an 
+     * INFO_FORMAT parameter in your <OpenLayers.Layer.WMS> instance(s).
      */
     infoFormat: 'text/html',
     
@@ -366,7 +369,7 @@
             height: this.map.getSize().h,
             width: this.map.getSize().w,
             format: format,
-            info_format: this.infoFormat
+            info_format: firstLayer.params.INFO_FORMAT || this.infoFormat
         }, (parseFloat(firstLayer.params.VERSION) >= 1.3) ?
             {
                 crs: projection,

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Handler/Point.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -200,13 +200,14 @@
      * pixel - {<OpenLayers.Pixel>} A pixel location on the map.
      */
     createFeature: function(pixel) {
-        if(!pixel) {
-            pixel = new OpenLayers.Pixel(-50, -50);
+        var geometry;
+        if(pixel) {
+            var lonlat = this.map.getLonLatFromPixel(pixel);
+            geometry = new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat);
+        } else {
+            geometry = new OpenLayers.Geometry.Point();
         }
-        var lonlat = this.map.getLonLatFromPixel(pixel);
-        this.point = new OpenLayers.Feature.Vector(
-            new OpenLayers.Geometry.Point(lonlat.lon, lonlat.lat)
-        );
+        this.point = new OpenLayers.Feature.Vector(geometry);
         this.callback("create", [this.point.geometry, this.point]);
         this.point.geometry.clearBounds();
         this.layer.addFeatures([this.point], {silent: true});

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/PointTrack.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/PointTrack.js	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Layer/PointTrack.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -20,13 +20,23 @@
   
     /**
      * APIProperty:
-     * dataFrom  - {<OpenLayers.Layer.PointTrack.dataFrom>} optional. If the
-     *             lines should get the data/attributes from one of the two
-     *             points, creating it, which one should it be?
+     * dataFrom  - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
+     *     {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
+     *     should get the data/attributes from one of the two points it is
+     *     composed of, which one should it be?
      */
     dataFrom: null,
     
     /**
+     * APIProperty:
+     * styleFrom  - {<OpenLayers.Layer.PointTrack.TARGET_NODE>} or
+     *     {<OpenLayers.Layer.PointTrack.SOURCE_NODE>} optional. If the lines
+     *     should get the style from one of the two points it is composed of,
+     *     which one should it be?
+     */
+    styleFrom: null,
+    
+    /**
      * Constructor: OpenLayers.PointTrack
      * Constructor for a new OpenLayers.PointTrack instance.
      *
@@ -47,9 +57,12 @@
      * 
      * Parameters:
      * pointFeatures - {Array(<OpenLayers.Feature>)}
+     * options - {Object}
      * 
+     * Supported options:
+     * silent - {Boolean} true to suppress (before)feature(s)added events
      */
-    addNodes: function(pointFeatures) {
+    addNodes: function(pointFeatures, options) {
         if (pointFeatures.length < 2) {
             OpenLayers.Console.error(
                     "At least two point features have to be added to create" +
@@ -78,26 +91,43 @@
                         (pointFeatures[i+this.dataFrom].data ||
                                 pointFeatures[i+this.dataFrom].attributes) :
                         null;
+                var style = (this.styleFrom != null) ?
+                        (pointFeatures[i+this.styleFrom].style) :
+                        null;
                 var line = new OpenLayers.Geometry.LineString([startPoint,
                         endPoint]);
                         
-                lines[i-1] = new OpenLayers.Feature.Vector(line, attributes);
+                lines[i-1] = new OpenLayers.Feature.Vector(line, attributes,
+                    style);
             }
             
             startPoint = endPoint;
         }
 
-        this.addFeatures(lines);
+        this.addFeatures(lines, options);
     },
     
     CLASS_NAME: "OpenLayers.Layer.PointTrack"
 });
 
 /**
+ * Constant: OpenLayers.Layer.PointTrack.SOURCE_NODE
+ * {Number} value for <OpenLayers.Layer.PointTrack.dataFrom> and
+ * <OpenLayers.Layer.PointTrack.styleFrom>
+ */
+OpenLayers.Layer.PointTrack.SOURCE_NODE = -1;
+
+/**
+ * Constant: OpenLayers.Layer.PointTrack.TARGET_NODE
+ * {Number} value for <OpenLayers.Layer.PointTrack.dataFrom> and
+ * <OpenLayers.Layer.PointTrack.styleFrom>
+ */
+OpenLayers.Layer.PointTrack.TARGET_NODE = 0;
+
+/**
  * Constant: OpenLayers.Layer.PointTrack.dataFrom
- * {Object} with the following keys
+ * {Object} with the following keys - *deprecated*
  * - SOURCE_NODE: take data/attributes from the source node of the line
  * - TARGET_NODE: take data/attributes from the target node of the line
  */
 OpenLayers.Layer.PointTrack.dataFrom = {'SOURCE_NODE': -1, 'TARGET_NODE': 0};
-

Modified: sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js
===================================================================
--- sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/lib/OpenLayers/Strategy/BBOX.js	2011-03-22 19:05:03 UTC (rev 11723)
@@ -134,7 +134,7 @@
                                    this.invalidBounds(mapBounds))) {
             this.calculateBounds(mapBounds);
             this.resolution = this.layer.map.getResolution(); 
-            this.triggerRead();
+            this.triggerRead(options);
         }
     },
     
@@ -210,21 +210,25 @@
     /**
      * Method: triggerRead
      *
+     * Parameters:
+     * options - Additional options for the protocol's read method (optional)
+     *
      * Returns:
      * {<OpenLayers.Protocol.Response>} The protocol response object
      *      returned by the layer protocol.
      */
-    triggerRead: function() {
+    triggerRead: function(options) {
         if (this.response) {
             this.layer.protocol.abort(this.response);
             this.layer.events.triggerEvent("loadend");
         }
         this.layer.events.triggerEvent("loadstart");
-        this.response = this.layer.protocol.read({
-            filter: this.createFilter(),
-            callback: this.merge,
-            scope: this
-        });
+        this.response = this.layer.protocol.read(
+            OpenLayers.Util.applyDefaults({
+                filter: this.createFilter(),
+                callback: this.merge,
+                scope: this
+        }, options));
     },
  
     /**

Modified: sandbox/cmoullet/openlayers/tests/Control/SLDSelect.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/SLDSelect.html	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/tests/Control/SLDSelect.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -82,7 +82,7 @@
         t.eq(map.layers.length, 2, "Selection layer has been created and added to the map");
         t.eq(map.layers[1] instanceof OpenLayers.Layer.WMS, true, "A WMS layer has been created as the selection layer");
         t.eq(map.layers[1].tileOptions.maxGetUrlLength, 2048, "Selection layer will automatically switch to HTTP Post if content gets longer than 2048");
-        var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>AAA64</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></sld:Rule></sld:Featur
 eTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
+        var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>AAA64</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></s
 ld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
 
         t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
 
@@ -169,7 +169,7 @@
         var geometry = OpenLayers.Geometry.Polygon.createRegularPolygon(
             new OpenLayers.Geometry.Point(0, 0), 5, 4);
         control.select(geometry);
-        var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>KGNAT.VKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:PolygonSymbolizer><sld:Fill><sld:CssParameter name="fill">#FF0000</sld:CssParameter></sld:Fill></sld:PolygonSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer><sl
 d:NamedLayer><sld:Name>KGNAT.LKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer><sld:NamedLayer><sld:Name>KGNAT.PKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml"><gml:coordinates de
 cimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:PointSymbolizer><sld:Graphic><sld:Mark><sld:WellKnownName>square</sld:WellKnownName><sld:Fill><sld:CssParameter name="fill">#FF0000</sld:CssParameter></sld:Fill><sld:Stroke/></sld:Mark><sld:Size>10</sld:Size></sld:Graphic></sld:PointSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
+        var expected_sld = '<sld:StyledLayerDescriptor xmlns:sld="http://www.opengis.net/sld" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengis.net/sld/1.0.0/StyledLayerDescriptor.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml"><sld:NamedLayer><sld:Name>KGNAT.VKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:PolygonSymbolizer><sld:Fill><sld:CssParameter name="fill">#FF0000</sld:CssParameter></sld:Fill></sld:PolygonSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle>
 </sld:NamedLayer><sld:NamedLayer><sld:Name>KGNAT.LKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:LineSymbolizer><sld:Stroke><sld:CssParameter name="stroke">#FF0000</sld:CssParameter><sld:CssParameter name="stroke-width">2</sld:CssParameter></sld:Stroke></sld:LineSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer><sld:NamedLayer><sld:Name>KGNAT.PKUNSTWERK</sld:Name><sld:UserStyle><sld:Name>default</sld:Name><sld:FeatureTypeStyle><sld:Rule><ogc:Filter xmlns:ogc="http://www.opengis.net/ogc"><ogc:BBOX><ogc:PropertyName>geometry</ogc:PropertyName><gml:Box xmlns:gml="http://
 www.opengis.net/gml" srsName="EPSG:4326"><gml:coordinates decimal="." cs="," ts=" ">-3.5355339059327,-3.5355339059327 3.5355339059327,3.5355339059327</gml:coordinates></gml:Box></ogc:BBOX></ogc:Filter><sld:PointSymbolizer><sld:Graphic><sld:Mark><sld:WellKnownName>square</sld:WellKnownName><sld:Fill><sld:CssParameter name="fill">#FF0000</sld:CssParameter></sld:Fill><sld:Stroke/></sld:Mark><sld:Size>10</sld:Size></sld:Graphic></sld:PointSymbolizer></sld:Rule></sld:FeatureTypeStyle></sld:UserStyle></sld:NamedLayer></sld:StyledLayerDescriptor>';
 
         t.xml_eq(map.layers[1].params.SLD_BODY, expected_sld, "SLD generated correctly");
         map.destroy();

Modified: sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/tests/Control/WMSGetFeatureInfo.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -420,7 +420,7 @@
     }
 
     function test_drillDown(t) {
-        t.plan(4);
+        t.plan(6);
         var map = new OpenLayers.Map("map", {
             getExtent: function() {return(new OpenLayers.Bounds(-180,-90,180,90));}
             }
@@ -434,14 +434,17 @@
             layers: "c"
         });
 
+        // this service does not support application/vnd.ogc.gml for GetFeatureInfo, only text/xml
         var c = new OpenLayers.Layer.WMS("dummy","http://myhost/wms", {
-            layers: "x"
+            layers: "x",
+            info_format: "text/xml"
         });
 
         map.addLayers([a, b, c]);
 
         var click = new OpenLayers.Control.WMSGetFeatureInfo({
-            drillDown: true
+            drillDown: true,
+            infoFormat: "application/vnd.ogc.gml"
         });
 
         map.addControl(click);
@@ -451,9 +454,11 @@
         OpenLayers.Request.GET = function(options) {
             count++;
             if (count == 1) {
+                t.eq(options.params["INFO_FORMAT"], "application/vnd.ogc.gml", "Default info format of the control is used");
                 t.eq(options.params["QUERY_LAYERS"].join(","), "a,c", "Layers should be grouped by service url");
                 t.eq(options.url, "http://localhost/wms", "Correct url used for first request");
             } else if (count == 2) {
+                t.eq(options.params["INFO_FORMAT"], "text/xml", "Overridden info format is used instead of the control's infoFormat");
                 t.eq(options.url, "http://myhost/wms", "Correct url used for second request");
             }
         };

Modified: sandbox/cmoullet/openlayers/tests/Handler/Point.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Handler/Point.html	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/tests/Handler/Point.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -63,7 +63,7 @@
              "activate adds the feature to the layer");
         t.eq(log.length, 1,
              "activate calls \"create\" once");
-        t.geom_eq(log[0].geometry, handler.point.geometry,
+        t.ok(log[0].geometry == handler.point.geometry,
                   "\"create\" called with expected geometry");
         t.ok(log[0].feature == handler.point,
              "\"create\" called with expected feature");
@@ -82,6 +82,32 @@
         map.destroy();
     }
 
+    // http://trac.osgeo.org/openlayers/ticket/3179
+    function test_activate_before_map_is_centered(t) {
+        t.plan(1);
+        var map = new OpenLayers.Map('map', {
+            resolutions: [1]
+        });
+        var layer = new OpenLayers.Layer.Vector("foo", {
+            maxExtent: new OpenLayers.Bounds(-10, -10, 10, 10),
+            isBaseLayer: true
+        });
+        map.addLayer(layer);
+        var control = new OpenLayers.Control();
+        var handler = new OpenLayers.Handler.Point(control, {});
+        control.handler = handler;
+        map.addControl(control);
+
+        var error;
+        try {
+            handler.activate();
+            error = false;
+        } catch(err) {
+            error = true;
+        }
+        t.ok(!error, "no error on activate");
+    }
+
     function test_Handler_Point_events(t) {
         t.plan(49);
         var log = [];
@@ -188,8 +214,8 @@
         t.eq(logs.length, 1, "[activate] called back");
         log = logs.shift();
         t.eq(log.type, "create", "[activate] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
-                  "[activate] correct point");
+        t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+             "[activate] initial point");
         // mouse down
         handler.mousedown(
             {type: "mousedown", xy: new OpenLayers.Pixel(0, 0)});
@@ -239,8 +265,8 @@
                   "[mouseup] correct point");
         log = logs.shift();
         t.eq(log.type, "create", "[mouseup] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
-                  "[activate] correct point");
+        t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+             "[mouseup] initial point");
         // mouse up on same pixel
         handler.mouseup({type: "mouseup", xy: new OpenLayers.Pixel(2, 0)});
         t.eq(logs.length, 0, "[mouseup] not called back");
@@ -249,12 +275,12 @@
         t.eq(logs.length, 2, "[cancel] called back");
         log = logs.shift();
         t.eq(log.type, "cancel", "[cancel] canced called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
-                  "[cancel] correct point");
+        t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+             "[cancel] initial point");
         log = logs.shift();
         t.eq(log.type, "create", "[cancel] create called");
-        t.geom_eq(log.args[0], new OpenLayers.Geometry.Point(-200, 125),
-                  "[cancel] correct point");
+        t.ok(isNaN(log.args[0].x) && isNaN(log.args[0].y),
+             "[] initial point");
 
         map.destroy();
     }

Modified: sandbox/cmoullet/openlayers/tests/Projection.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Projection.html	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/tests/Projection.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -58,7 +58,7 @@
          t.eq(proj2.equals(proj5), false, "Projection.equals() returns false for unknown projections with proj4js");
          
          if (!hasProj) {
-             delete window.Proj4js
+             window.Proj4js = undefined;
          }
          
      }

Modified: sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html
===================================================================
--- sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html	2011-03-22 13:46:33 UTC (rev 11722)
+++ sandbox/cmoullet/openlayers/tests/Strategy/BBOX.html	2011-03-22 19:05:03 UTC (rev 11723)
@@ -87,7 +87,7 @@
     
     function test_events(t) {
         
-        t.plan(2);
+        t.plan(3);
         var log = {
             loadstart: 0,
             loadend: 0
@@ -117,6 +117,14 @@
         t.eq(log.loadstart, 1, "loadstart triggered");
         t.eq(log.loadend, 1, "loadend triggered");
         
+        log = {};
+        layer.protocol.read = function(obj) {
+            log.obj = obj;
+        }
+        layer.refresh({force: true, whee: 'chicken'});
+
+        t.eq(log.obj && log.obj.whee, "chicken", "properties passed to read on refresh correctly.");
+
         map.destroy();
         
     }



More information about the Commits mailing list