[OpenLayers-Commits] r3152 - in sandbox/tschaub/debug: doc examples lib/OpenLayers lib/OpenLayers/Control lib/OpenLayers/Format lib/OpenLayers/Layer lib/OpenLayers/Popup tests tests/Format tests/Layer tests/Marker

commits at openlayers.org commits at openlayers.org
Thu May 17 11:16:05 EDT 2007


Author: tschaub
Date: 2007-05-17 11:16:04 -0400 (Thu, 17 May 2007)
New Revision: 3152

Added:
   sandbox/tschaub/debug/examples/outOfRangeMarkers.html
   sandbox/tschaub/debug/examples/outOfRangeMarkers.txt
   sandbox/tschaub/debug/tests/Format/test_GML.html
Modified:
   sandbox/tschaub/debug/doc/authors.txt
   sandbox/tschaub/debug/examples/georss-serialize.html
   sandbox/tschaub/debug/examples/panel.html
   sandbox/tschaub/debug/examples/popups.html
   sandbox/tschaub/debug/examples/vector-features.html
   sandbox/tschaub/debug/lib/OpenLayers/BaseTypes.js
   sandbox/tschaub/debug/lib/OpenLayers/Control/OverviewMap.js
   sandbox/tschaub/debug/lib/OpenLayers/Control/Panel.js
   sandbox/tschaub/debug/lib/OpenLayers/Feature.js
   sandbox/tschaub/debug/lib/OpenLayers/Format/GML.js
   sandbox/tschaub/debug/lib/OpenLayers/Format/GeoRSS.js
   sandbox/tschaub/debug/lib/OpenLayers/Layer.js
   sandbox/tschaub/debug/lib/OpenLayers/Layer/Markers.js
   sandbox/tschaub/debug/lib/OpenLayers/Layer/Vector.js
   sandbox/tschaub/debug/lib/OpenLayers/Popup.js
   sandbox/tschaub/debug/lib/OpenLayers/Popup/AnchoredBubble.js
   sandbox/tschaub/debug/tests/Layer/test_Vector.html
   sandbox/tschaub/debug/tests/Marker/test_Box.html
   sandbox/tschaub/debug/tests/list-tests.html
   sandbox/tschaub/debug/tests/test_Popup.html
Log:
merge r3092:HEAD from trunk

Modified: sandbox/tschaub/debug/doc/authors.txt
===================================================================
--- sandbox/tschaub/debug/doc/authors.txt	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/doc/authors.txt	2007-05-17 15:16:04 UTC (rev 3152)
@@ -1,6 +1,7 @@
 OpenLayers contributors:
 Howard Butler
 Bertil Chaupis                                                               
+John Cole
 Jeff Dege
 Schuyler Erle
 Christian López Espínola

Modified: sandbox/tschaub/debug/examples/georss-serialize.html
===================================================================
--- sandbox/tschaub/debug/examples/georss-serialize.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/examples/georss-serialize.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -2,7 +2,7 @@
   <head>
     <style type="text/css">
         #map {
-            width: 512px;
+            width: 45%;
             height: 350px;
             border: 1px solid gray;
         }
@@ -42,8 +42,8 @@
   </head>
   <body onload="init()">
     <h1>OpenLayers Draw Point Example</h1>
-    <div style="float:right">
-    <textarea id="gml" cols="80" rows="30"></textarea>
+    <div style="float:right;width:50%">
+    <textarea id="gml" style="width:100%" rows="30"></textarea>
     </div>
     <div id="map"></div>
   </body>

Copied: sandbox/tschaub/debug/examples/outOfRangeMarkers.html (from rev 3151, trunk/openlayers/examples/outOfRangeMarkers.html)
===================================================================
--- sandbox/tschaub/debug/examples/outOfRangeMarkers.html	                        (rev 0)
+++ sandbox/tschaub/debug/examples/outOfRangeMarkers.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -0,0 +1,54 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+    <style type="text/css">
+        #map {
+            width: 650px;
+            height: 550px;
+            border: 1px solid black;
+        }
+    </style>
+    <script src='http://maps.google.com/maps?file=api&amp;v=2&amp;key=ABQIAAAAKsGpqSOKkB-Ih2JopAmNbBTv_3ENzieGiNBMV02NiUJp8KZGIRTQWhul8K0wiNOHDxOF0-W2RmFoRg'></script>
+    <script src="../lib/OpenLayers.js"></script>
+    <script type="text/javascript">
+        <!--
+        function init(){
+            
+            // Variables
+            var map = new OpenLayers.Map('map', { controls: [] });
+            var lon = 35;
+            var lat = -6;
+            var zoom = 6;
+            var map, layer;
+
+            // Map Controls
+            map.addControl(new OpenLayers.Control.PanZoomBar());
+            map.addControl(new OpenLayers.Control.MouseToolbar());
+            map.addControl(new OpenLayers.Control.LayerSwitcher({'ascending':false}));
+            map.addControl(new OpenLayers.Control.MousePosition());
+
+
+            // Map Layers
+            var GMapsSat = new OpenLayers.Layer.Google( "Google Satellite" , {type: G_SATELLITE_MAP, 'maxZoomLevel':18} );
+            var GMapsHybr = new OpenLayers.Layer.Google( "Google Hybrid" , {type: G_HYBRID_TYPE, 'maxZoomLevel':18} );
+            var GMapsStreets = new OpenLayers.Layer.Google( "Google Steets" , {type: G_NORMAL_MAP, 'maxZoomLevel':18} );
+            var MarkersLayer2 = new OpenLayers.Layer.Text( "Region info", {location: "outOfRangeMarkers.txt", maxResolution: 0.02});
+
+            // Add Layers
+            map.addLayers([GMapsHybr, GMapsStreets, GMapsSat, MarkersLayer2]);
+            
+
+            // Visual
+            map.setCenter(new OpenLayers.LonLat(lon, lat), zoom);
+            if (!map.getCenter()) map.zoomToMaxExtent();
+        }
+        // -->
+    </script>
+ </head>
+
+
+ <body onload="init()">
+
+    <div id="map"></div>
+
+  </body>
+</html>

Copied: sandbox/tschaub/debug/examples/outOfRangeMarkers.txt (from rev 3151, trunk/openlayers/examples/outOfRangeMarkers.txt)
===================================================================
--- sandbox/tschaub/debug/examples/outOfRangeMarkers.txt	                        (rev 0)
+++ sandbox/tschaub/debug/examples/outOfRangeMarkers.txt	2007-05-17 15:16:04 UTC (rev 3152)
@@ -0,0 +1,3 @@
+point	title	description	icon
+-4.14,37.90	 	Kilimanjaro Beskrivning	http://www.villageografica.com/Africa-Webmap/img/marker-blue.png
+-3.24,34.35	 	Shinyanga Beskrivning	http://www.villageografica.com/Africa-Webmap/img/marker-blue.png

Modified: sandbox/tschaub/debug/examples/panel.html
===================================================================
--- sandbox/tschaub/debug/examples/panel.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/examples/panel.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -69,7 +69,7 @@
             
             
             zb = new OpenLayers.Control.ZoomBox();
-            panel = new OpenLayers.Control.Panel({defaultControl: zb});
+            var panel = new OpenLayers.Control.Panel({defaultControl: zb});
             panel.addControls([
                 new OpenLayers.Control.MouseDefaults(),
                 zb,

Modified: sandbox/tschaub/debug/examples/popups.html
===================================================================
--- sandbox/tschaub/debug/examples/popups.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/examples/popups.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -47,7 +47,7 @@
             popup = new OpenLayers.Popup.Anchored("chicken", 
                                          new OpenLayers.LonLat(5,40),
                                          new OpenLayers.Size(200,200),
-                                         "example popup");
+                                         "example popup", true);
         
             map.addPopup(popup);
         }        
@@ -69,8 +69,17 @@
         }
         
         function mousedown(evt) {
+             // check to see if the popup was hidden by the close box
+             // if so, then destroy it before continuing
+            if (popup != null) {
+                if (!popup.visible()) {
+                    markers.map.removePopup(popup);
+                    popup.destroy();
+                    popup = null;
+                }
+            }
             if (popup == null) {
-                popup = feature.createPopup();
+                popup = feature.createPopup(true);
                 popup.setContentHTML("<a href='http://www.somethingconstructive.net' target='_blank'>click me</a>");
                 popup.setBackgroundColor("yellow");
                 popup.setOpacity(0.7);

Modified: sandbox/tschaub/debug/examples/vector-features.html
===================================================================
--- sandbox/tschaub/debug/examples/vector-features.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/examples/vector-features.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -17,11 +17,23 @@
             var layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                     "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
             map.addLayer(layer);
+            
+            var style_blue = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['default']);
+            style_blue.strokeColor = "blue"; 
+            style_blue.fillColor = "blue"; 
+            var style_green = {
+                strokeColor: "#00FF00",
+                strokeOpacity: 1,
+                strokeWidth: 3,
+                pointRadius: 6,
+                pointerEvents: "visiblePainted"
+            };
+            
             var vectorLayer = new OpenLayers.Layer.Vector("Simple Geometry");
             
             // create a point feature
             var point = new OpenLayers.Geometry.Point(-111.04, 45.68);
-            var pointFeature = new OpenLayers.Feature.Vector(point);
+            var pointFeature = new OpenLayers.Feature.Vector(point,null,style_blue);
             
             // create a line feature from a list of points
             var pointList = [];
@@ -32,7 +44,7 @@
                 pointList.push(newPoint);
             }
             var lineFeature = new OpenLayers.Feature.Vector(
-                new OpenLayers.Geometry.LineString(pointList));
+                new OpenLayers.Geometry.LineString(pointList),null,style_green);
             
             // create a polygon feature from a linear ring of points
             var pointList = [];
@@ -59,5 +71,9 @@
   </head>
   <body onload="init()">
     <div id="map"></div>
+    <p>This example shows drawing simple vector features -- point, line, polygon
+       in different styles, created 'manually', by constructing the entire style
+       object, via 'copy', extending the default style object, and by 
+       inheriting the default style from the layer.</p>
   </body>
 </html>

Modified: sandbox/tschaub/debug/lib/OpenLayers/BaseTypes.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/BaseTypes.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/BaseTypes.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -31,8 +31,9 @@
             //  so the util.extend() doesnt copy it over. we do it manually.
             // 
             // to be revisited in 3.0
-            // 
-            if (arguments[i].hasOwnProperty('toString')) {
+            //
+            if((arguments[i].hasOwnProperty && arguments[i].hasOwnProperty('toString')) ||
+               (!arguments[i].hasOwnProperty && arguments[i].toString)) {
                 proto.toString = arguments[i].toString;
             }
         }

Modified: sandbox/tschaub/debug/lib/OpenLayers/Control/OverviewMap.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Control/OverviewMap.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Control/OverviewMap.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -180,7 +180,8 @@
         this.elementEvents.register('dblclick', this, function(e) {
             OpenLayers.Event.stop(e);
         });
-        this.rectEvents = new OpenLayers.Events(this, this.extentRectangle);
+        this.rectEvents = new OpenLayers.Events(this, this.extentRectangle,
+                                                null, true);
         this.rectEvents.register('mouseout', this, this.rectMouseOut);
         this.rectEvents.register('mousedown', this, this.rectMouseDown);
         this.rectEvents.register('mousemove', this, this.rectMouseMove);
@@ -520,8 +521,8 @@
                              this.ovmap.size.w - this.wComp);
         this.extentRectangle.style.top = parseInt(top) + 'px';
         this.extentRectangle.style.left = parseInt(left) + 'px';
-        this.extentRectangle.style.height = parseInt(bottom - top)+ 'px';
-        this.extentRectangle.style.width = parseInt(right - left) + 'px';
+        this.extentRectangle.style.height = parseInt(Math.max(bottom - top, 0))+ 'px';
+        this.extentRectangle.style.width = parseInt(Math.max(right - left, 0)) + 'px';
     },
 
     /**

Modified: sandbox/tschaub/debug/lib/OpenLayers/Control/Panel.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Control/Panel.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Control/Panel.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -129,6 +129,8 @@
         // Give each control a panel_div which will be used later.
         // Access to this div is via the panel_div attribute of the 
         // control added to the panel.
+        // Also, stop mousedowns and clicks, but don't stop mouseup,
+        // since they need to pass through.
         for (var i = 0; i < controls.length; i++) {
             var element = document.createElement("div");
             var textNode = document.createTextNode(" ");
@@ -137,8 +139,6 @@
                                      this.onClick.bind(this, controls[i]));
             OpenLayers.Event.observe(controls[i].panel_div, "mousedown", 
                               OpenLayers.Event.stop.bindAsEventListener());
-            OpenLayers.Event.observe(controls[i].panel_div, "mouseup", 
-                                  OpenLayers.Event.stop.bindAsEventListener());
         }    
 
         if (this.map) { // map.addControl() has already been called on the panel

Modified: sandbox/tschaub/debug/lib/OpenLayers/Feature.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Feature.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Feature.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -121,6 +121,7 @@
     },
 
     /**
+     * @param {Boolean} closeBox create popup with closebox or not
      * @returns A Popup Object created from the 'lonlat', 'popupSize',
      *          and 'popupContentHTML' properties set in this.data. It uses
      *          this.marker.icon as default anchor. 
@@ -132,7 +133,7 @@
      * 
      * @type OpenLayers.Popup.AnchoredBubble
      */
-    createPopup: function() {
+    createPopup: function(closeBox) {
 
         if (this.lonlat != null) {
             
@@ -143,7 +144,7 @@
                                                     this.lonlat,
                                                     this.data.popupSize,
                                                     this.data.popupContentHTML,
-                                                    anchor); 
+                                                    anchor, closeBox); 
         }        
         return this.popup;
     },

Modified: sandbox/tschaub/debug/lib/OpenLayers/Format/GML.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Format/GML.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Format/GML.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -84,13 +84,11 @@
 
         var feature = new OpenLayers.Feature.Vector();
 
-        if (xmlNode.firstChild.attributes && xmlNode.firstChild.attributes['fid']) {
-            feature.fid = xmlNode.firstChild.attributes['fid'].nodeValue;
-        }
-        
         // match MultiPolygon
         if (OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon").length != 0) {
             var multipolygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode, this.gmlns, "gml", "MultiPolygon")[0];
+            feature.fid = multipolygon.parentNode.parentNode.getAttribute('fid');
+
             geom = new OpenLayers.Geometry.MultiPolygon();
             var polygons = OpenLayers.Ajax.getElementsByTagNameNS(multipolygon,
                 this.gmlns, "gml", "Polygon");
@@ -104,6 +102,7 @@
             this.gmlns, "gml", "MultiLineString").length != 0) {
             var multilinestring = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
             this.gmlns, "gml", "MultiLineString")[0];
+            feature.fid = multilinestring.parentNode.parentNode.getAttribute('fid');
             
             geom = new OpenLayers.Geometry.MultiLineString();
             var lineStrings = OpenLayers.Ajax.getElementsByTagNameNS(multilinestring, this.gmlns, "gml", "LineString");
@@ -122,6 +121,7 @@
             this.gmlns, "gml", "MultiPoint").length != 0) {
             var multiPoint = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
                 this.gmlns, "gml", "MultiPoint")[0];
+            feature.fid = multiPoint.parentNode.parentNode.getAttribute('fid');
                 
             geom = new OpenLayers.Geometry.MultiPoint();
             
@@ -138,6 +138,7 @@
             this.gmlns, "gml", "Polygon").length != 0) {
             var polygon = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
                 this.gmlns, "gml", "Polygon")[0];
+            feature.fid = polygon.parentNode.parentNode.getAttribute('fid');
             
             geom = this.parsePolygonNode(polygon);
         }
@@ -146,6 +147,8 @@
             this.gmlns, "gml", "LineString").length != 0) {
             var lineString = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
                 this.gmlns, "gml", "LineString")[0];
+            feature.fid = lineString.parentNode.parentNode.getAttribute('fid');
+
             p = this.parseCoords(lineString);
             if (p.points) {
                 geom = new OpenLayers.Geometry.LineString(p.points);
@@ -157,6 +160,7 @@
             this.gmlns, "gml", "Point").length != 0) {
             var point = OpenLayers.Ajax.getElementsByTagNameNS(xmlNode,
                 this.gmlns, "gml", "Point")[0];
+            feature.fid = point.parentNode.parentNode.getAttribute('fid');
             
             p = this.parseCoords(point);
             if (p.points) {

Modified: sandbox/tschaub/debug/lib/OpenLayers/Format/GeoRSS.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Format/GeoRSS.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Format/GeoRSS.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -97,10 +97,10 @@
         var path = "";
         if (points) {
             for (var i = 0; i < points.length; i++) {
-                path += points[i].lat + " " + points[i].lon + " ";
+                path += points[i].y + " " + points[i].x + " ";
             }
         } else {
-           path += geometry.lat + " " + geometry.lon + " ";
+           path += geometry.y + " " + geometry.x + " ";
         }
         return document.createTextNode(path);
     },

Modified: sandbox/tschaub/debug/lib/OpenLayers/Layer/Markers.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Layer/Markers.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Layer/Markers.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -21,6 +21,15 @@
     /** internal marker list
     * @type Array(OpenLayers.Marker) */
     markers: null,
+
+
+    /** internal state of drawing. This is a workaround for the fact
+     *  that the map does not call moveTo with a zoomChanged when the
+     *  map is first starting up. This lets us catch the case where we
+     *  have *never* drawn the layer, and draw it even if the zoom hasn't
+     *  changed. 
+     * @type Boolean */
+    drawn: false,
     
     /**
     * @constructor
@@ -51,8 +60,9 @@
     moveTo:function(bounds, zoomChanged, dragging) {
         OpenLayers.Layer.prototype.moveTo.apply(this, arguments);
 
-        if (zoomChanged) {
+        if (zoomChanged || !this.drawn) {
             this.redraw();
+            this.drawn = true;
         }
     },
 

Modified: sandbox/tschaub/debug/lib/OpenLayers/Layer/Vector.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Layer/Vector.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Layer/Vector.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -97,8 +97,7 @@
     destroy: function() {
         OpenLayers.Layer.prototype.destroy.apply(this, arguments);  
 
-        // HACK HACK -- I believe we should be iterating and 
-        //              calling feature[i].destroy() here. 
+        this.destroyFeatures();
         this.features = null;
         this.selectedFeatures = null;
         if (this.renderer) {
@@ -248,6 +247,12 @@
             this.features = OpenLayers.Util.removeItem(this.features, feature);
 
             this.renderer.eraseGeometry(feature.geometry);
+            
+            //in the case that this feature is one of the selected features, 
+            // remove it from that array as well.
+            if (OpenLayers.Util.indexOf(this.selectedFeatures, feature) != -1){
+                OpenLayers.Util.removeItem(this.selectedFeatures, feature);
+            }
         }
     },
 

Modified: sandbox/tschaub/debug/lib/OpenLayers/Layer.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Layer.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Layer.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -286,6 +286,8 @@
             
             if (!this.isBaseLayer) {
                 this.inRange = this.calculateInRange();
+                var show = ((this.visibility) && (this.inRange));
+                this.div.style.display = show ? "" : "none";
             }
             
             // deal with gutters

Modified: sandbox/tschaub/debug/lib/OpenLayers/Popup/AnchoredBubble.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Popup/AnchoredBubble.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Popup/AnchoredBubble.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -139,7 +139,7 @@
         if (firstTime) {
             OpenLayers.Rico.Corner.round(this.div, options);
         } else {
-            OpenLayers.Rico.Corner.reRound(this.contentDiv, options);
+            OpenLayers.Rico.Corner.reRound(this.groupDiv, options);
             //set the popup color and opacity
             this.setBackgroundColor(); 
             this.setOpacity();

Modified: sandbox/tschaub/debug/lib/OpenLayers/Popup.js
===================================================================
--- sandbox/tschaub/debug/lib/OpenLayers/Popup.js	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/lib/OpenLayers/Popup.js	2007-05-17 15:16:04 UTC (rev 3152)
@@ -45,6 +45,9 @@
     
     /** @type DOMElement */
     contentDiv:null,
+    
+    /** @type DOMElement */
+    groupDiv:null,
 
     /** @type int */
     padding: 5,
@@ -84,13 +87,18 @@
         this.div = OpenLayers.Util.createDiv(this.id, null, null, 
                                              null, null, null, "hidden");
         this.div.className = 'olPopup';
+        
+        this.groupDiv = OpenLayers.Util.createDiv(null, null, null, 
+                                                    null, "relative", null,
+                                                    "hidden");
 
         var id = this.div.id + "_contentDiv";
         this.contentDiv = OpenLayers.Util.createDiv(id, null, this.size.clone(), 
                                                     null, "relative", null,
                                                     "hidden");
         this.contentDiv.className = 'olPopupContent';                                            
-        this.div.appendChild(this.contentDiv);
+        this.groupDiv.appendChild(this.contentDiv);
+        this.div.appendChild(this.groupDiv);
 
         if (closeBox == true) {
            // close icon
@@ -102,7 +110,7 @@
                                                                 img);
             closeImg.style.right = this.padding + "px";
             closeImg.style.top = this.padding + "px";
-            this.div.appendChild(closeImg);
+            this.groupDiv.appendChild(closeImg);
 
             var closePopup = function(e) {
                 this.hide();

Copied: sandbox/tschaub/debug/tests/Format/test_GML.html (from rev 3151, trunk/openlayers/tests/Format/test_GML.html)
===================================================================
--- sandbox/tschaub/debug/tests/Format/test_GML.html	                        (rev 0)
+++ sandbox/tschaub/debug/tests/Format/test_GML.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -0,0 +1,57 @@
+<html> 
+<head> 
+    <script src="../../lib/OpenLayers.js"></script> 
+    <script type="text/javascript"><!-- 
+
+    var test_content = '<wfs:FeatureCollection' + 
+ '   xmlns:fs="http://example.com/featureserver"' + 
+ '   xmlns:wfs="http://www.opengis.net/wfs"' + 
+ '   xmlns:gml="http://www.opengis.net/gml"' + 
+ '   xmlns:ogc="http://www.opengis.net/ogc"' + 
+ '   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' + 
+ '   xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengeospatial.net//wfs/1.0.0/WFS-basic.xsd">' + 
+ '        ' + 
+ '' + 
+ '        <gml:featureMember>' + 
+ '  \n<fs:scribble fid="221">' + 
+ '        <fs:geometry>' + 
+ '        <gml:Polygon>' + 
+ '              ' + 
+ '              <gml:outerBoundaryIs><gml:LinearRing>' + 
+ '              <gml:coordinates>149.105072021,-35.1816558838 149.100608826,-35.1844024658 149.098892212,-35.1898956299  149.105072021,-35.1816558838</gml:coordinates>' + 
+ '              </gml:LinearRing></gml:outerBoundaryIs>' + 
+ '             ' + 
+ '              </gml:Polygon>' + 
+ '        </fs:geometry>' + 
+ '        <fs:title>random test features</fs:title>' + 
+ '        </fs:scribble>' + 
+ '</gml:featureMember> ' +
+ ' <gml:featureMember><fs:scribble fid="8">    <fs:geometry>        <gml:Point><gml:coordinates>-81.38671875,27.0703125</gml:coordinates></gml:Point>         </fs:geometry> ' +
+ '        <fs:down>south</fs:down><fs:title>Florida</fs:title>        </fs:scribble></gml:featureMember>' + 
+ '</wfs:FeatureCollection>'; 
+
+     
+    function test_Format_GML_constructor(t) { 
+        t.plan(4); 
+         
+        var options = {'foo': 'bar'}; 
+        var format = new OpenLayers.Format.GML(options); 
+        t.ok(format instanceof OpenLayers.Format.GML, 
+             "new OpenLayers.Format.GML returns object" ); 
+        t.eq(format.foo, "bar", "constructor sets options correctly"); 
+        t.eq(typeof format.read, "function", "format has a read function"); 
+        t.eq(typeof format.write, "function", "format has a write function"); 
+    } 
+    function test_Format_GML_getFid(t) { 
+        t.plan(2);
+        var parser = new OpenLayers.Format.GML();
+        data = parser.read(test_content);
+        t.eq(data[0].fid, '221', 'fid on polygons set correctly (with whitespace)');
+        t.eq(data[1].fid, '8', 'fid on linestrings set correctly with whitespace'); 
+    }
+    // --> 
+    </script> 
+</head> 
+<body> 
+</body> 
+</html> 

Modified: sandbox/tschaub/debug/tests/Layer/test_Vector.html
===================================================================
--- sandbox/tschaub/debug/tests/Layer/test_Vector.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/tests/Layer/test_Vector.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -29,7 +29,7 @@
     }
 
     function test_03_Layer_Vector_removeFeatures(t) {
-        t.plan(2);
+        t.plan(3);
     
         var layer = new OpenLayers.Layer.Vector(name);
 
@@ -43,6 +43,9 @@
         
         t.ok(layer.features.length == 1, "OpenLayers.Layer.Vector.removeFeatures removes a feature from the features array");
         layer.addFeatures([pointFeature1.clone(), pointFeature2.clone()]);
+        layer.selectedFeatures.push(layer.features[0]); 
+        layer.removeFeatures(layer.features[0]);
+        t.eq(layer.selectedFeatures, [], "Remove features removes selected features");
         var features = layer.removeFeatures(layer.features);
         
         t.ok(layer.features.length == 0,
@@ -69,12 +72,16 @@
         var feature = new OpenLayers.Feature.Vector(geometry);
         
         var f, s;
+        
+        // Layer renderer needs a destroy, and draw, for functional tests. 
         layer.renderer = {
             drawFeature: function(feature, style) {
                 f = feature;
                 s = style;
-            }
+            },
+            destroy: function() { }
         };
+        
 
         layer.drawFeature(feature);
         t.ok(geometry.equals(f.geometry),
@@ -112,7 +119,8 @@
         layer.renderer = {
             eraseFeatures: function(features) {
                 f = features[0];
-            }
+            },
+            destroy: function() { }
         };
 
         layer.eraseFeatures([feature]);

Modified: sandbox/tschaub/debug/tests/Marker/test_Box.html
===================================================================
--- sandbox/tschaub/debug/tests/Marker/test_Box.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/tests/Marker/test_Box.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -178,185 +178,4 @@
 <body>
     <div id="map" style="width:500px;height:550px"></div>
 </body>
-</html>
-<html>
-<head>
-  <script src="../../lib/OpenLayers.js"></script>
-  <script type="text/javascript"><!--
-    var box; 
-    
-    function test_01_Box_constructor (t) {
-        t.plan( 7 );
-
-        OpenLayers.Marker.Box.prototype._setBorder = 
-            OpenLayers.Marker.Box.prototype.setBorder;
-        OpenLayers.Marker.Box.prototype.setBorder = function (x,y) {
-            g_Color = x;
-            g_Width = y;
-        };
-
-        var bounds = new OpenLayers.Bounds(1,2,3,4);
-        var borderColor = "blue";
-        var borderWidth = 55;
-
-
-        g_Color = g_Width = null;
-        box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
-
-        t.ok( box instanceof OpenLayers.Marker.Box, "new OpenLayers.Marker.Box returns Box object" );
-        t.ok( box.bounds.equals(bounds), "bounds object correctly set");
-        t.ok( box.div != null, "div created");
-        t.eq( box.div.style.overflow, "hidden", "div style overflow hidden");
-        t.ok( box.events != null, "events object created");
-        t.eq( g_Color, borderColor, "setBorder called with correct border color");        
-        t.eq( g_Width, borderWidth, "setBorder called with correct border width");        
-        
-
-        OpenLayers.Marker.Box.prototype.setBorder = 
-            OpenLayers.Marker.Box.prototype._setBorder;
-    }
-
-
-    function test_02_Box_setBorder(t) {
-        t.plan( 2 );
-
-        var box = {
-            div: {
-                style: {}
-            }
-        };
-
-      //defaults
-        var args = [];
-        OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
-        t.eq(box.div.style.border, "2px solid red", "style correctly set with no good values (defaults work)");
-
-      //good vals
-        var borderColor = "blue";
-        var borderWidth = 55;
-
-        args = [borderColor, borderWidth];
-        OpenLayers.Marker.Box.prototype.setBorder.apply(box, args);
-        t.eq(box.div.style.border, borderWidth + "px solid " + borderColor, "style correctly set with both good values");
-
-    }
-    function test_03_Box_draw(t) {
-        t.plan( 5 );
-
-        OpenLayers.Util._modifyDOMElement = 
-            OpenLayers.Util.modifyDOMElement;
-        OpenLayers.Util.modifyDOMElement = 
-            function (element, id, px, sz) {
-                g_Element = element;
-                g_Id = id;
-                g_Px = px;
-                g_Sz = sz;
-            };
-
-        var box = {
-            div: {}
-        };
-
-        
-        var px = {};
-        var sz = {};
-        var args = [px, sz];
-
-        g_Element = g_Id = g_Px = g_Sz = null;
-        var retVal = OpenLayers.Marker.Box.prototype.draw.apply(box, args);
-
-        t.eq(g_Element, box.div, "modifyDOMElement passes box's div for element");
-        t.eq(g_Id, null, "modifyDOMElement passes null for id");
-        t.eq(g_Px, px, "modifyDOMElement passes new px value for px");
-        t.eq(g_Sz, sz, "modifyDOMElement passes new sz value for sz");
-        t.ok(retVal == box.div, "draw returns box's div");
-
-        OpenLayers.Util.modifyDOMElement = 
-            OpenLayers.Util._modifyDOMElement;
-
-    }
-
-    function test_04_Box_onScreen(t) {
-        t.plan( 2 );
-
-        var map = new OpenLayers.Map("map");
-
-        var url = "http://octo.metacarta.com/cgi-bin/mapserv";
-        layer = new OpenLayers.Layer.WMS(name, url);
-
-        map.addLayer(layer);
-        
-        mlayer = new OpenLayers.Layer.Boxes('Test Layer');
-        map.addLayer(mlayer);
-               
-        map.zoomToExtent(new OpenLayers.Bounds(-50,-50,50,50));
-
-        //onscreen box
-        var bounds = new OpenLayers.Bounds(-1,-1,1,1);
-        var box = new OpenLayers.Marker.Box(bounds);
-        mlayer.addMarker(box);
-        
-        t.ok( box.onScreen(), "box knows it's onscreen" );
-
-        //offscreen box
-        var bounds = new OpenLayers.Bounds(100,100,150,150);
-        var box2 = new OpenLayers.Marker.Box(bounds);
-        mlayer.addMarker(box2);
-
-        t.ok( !box2.onScreen(), "box knows it's offscreen" );
-        map.destroy();
-    }
-
-    function test_05_Box_display(t) {
-        t.plan( 2 );
-
-        var box = {
-            div: {
-                style: {}
-            }
-        };
-
-      //display(true)
-        var args = [true];
-        OpenLayers.Marker.Box.prototype.display.apply(box, args);
-        t.eq(box.div.style.display, "", "style.display correctly set to '' when display(true)");
-
-      //display(false)
-        var args = [false];
-        OpenLayers.Marker.Box.prototype.display.apply(box, args);
-        t.eq(box.div.style.display, "none", "style.display correctly set to 'none' when display(false)");
-    }
-
-    function test_99_Box_destroy(t) {
-        t.plan(3);
-        
-        OpenLayers.Marker.prototype._destroy = 
-            OpenLayers.Marker.prototype.destroy;
-        OpenLayers.Marker.prototype.destroy = function() {
-            g_Destroy = true;
-        }
-                
-        var bounds = new OpenLayers.Bounds(1,2,3,4);
-        var borderColor = "blue";
-        var borderWidth = 55;
-
-        g_Destroy = null;
-        box = new OpenLayers.Marker.Box(bounds, borderColor, borderWidth);
-        box.destroy();
-
-        t.eq(box.bounds, null, "bounds nullified");
-        t.eq(box.div, null, "div nullified");
-        t.ok(g_Destroy == true, "OpenLayers.Marker.destroy() called");
-
-
-        OpenLayers.Marker.prototype.destroy = 
-            OpenLayers.Marker.prototype._destroy;
-    }
-    
-  // -->
-  </script>
-</head>
-<body>
-    <div id="map" style="width:500px;height:550px"></div>
-</body>
-</html>
+</html>
\ No newline at end of file

Modified: sandbox/tschaub/debug/tests/list-tests.html
===================================================================
--- sandbox/tschaub/debug/tests/list-tests.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/tests/list-tests.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -18,6 +18,8 @@
     <li>Geometry/test_Rectangle.html</li>
     <li>Geometry/test_Surface.html</li>
     <li>test_Format.html</li>
+    <li>Format/test_GeoRSS.html</li>
+    <li>Format/test_GML.html</li>
     <li>Format/test_WKT.html</li>
     <li>test_Icon.html</li>
     <li>test_Marker.html</li>
@@ -58,6 +60,5 @@
     <li>Control/test_PanZoomBar.html</li>
     <li>Control/test_Permalink.html</li>
     <li>Control/test_Scale.html</li>
-    <li>test_Format.html</li>
     <li>test_Map.html</li>
 </ul>

Modified: sandbox/tschaub/debug/tests/test_Popup.html
===================================================================
--- sandbox/tschaub/debug/tests/test_Popup.html	2007-05-15 21:14:26 UTC (rev 3151)
+++ sandbox/tschaub/debug/tests/test_Popup.html	2007-05-17 15:16:04 UTC (rev 3152)
@@ -80,7 +80,7 @@
         t.eq(popup.div.style.width, w + "px", "width position of popup.div set correctly");
         t.eq(popup.div.style.height, h + "px", "heightposition of popup.div set correctly");
 
-        var contentDiv = popup.div.childNodes[0];
+        var contentDiv = popup.div.childNodes[0].childNodes[0];
         
         t.eq(contentDiv.className, "olPopupContent", "correct content div className");
         t.eq(contentDiv.id, "chicken_contentDiv", "correct content div id");



More information about the Commits mailing list