[OpenLayers-Commits] r1993 - sandbox/vector/lib/OpenLayers/Renderer

commits at openlayers.org commits at openlayers.org
Sun Dec 3 10:50:49 EST 2006


Author: pgiraud
Date: 2006-12-03 10:50:47 -0500 (Sun, 03 Dec 2006)
New Revision: 1993

Modified:
   sandbox/vector/lib/OpenLayers/Renderer/Svg.js
Log:
multi linearRings polygons (with holes) management

Modified: sandbox/vector/lib/OpenLayers/Renderer/Svg.js
===================================================================
--- sandbox/vector/lib/OpenLayers/Renderer/Svg.js	2006-12-02 08:32:35 UTC (rev 1992)
+++ sandbox/vector/lib/OpenLayers/Renderer/Svg.js	2006-12-03 15:50:47 UTC (rev 1993)
@@ -190,9 +190,19 @@
      * @param style {Style} a style to use when drawing
      */
     drawPolygon: function(geometry, style) {
-        var node = this._nodeFactory("polygon", geometry.id);
+        var node = this._nodeFactory("path", geometry.id);
         node.geometry = geometry;
-        node.setAttributeNS(null, "points", geometry.linearRings[0].path);
+
+        var d = '';
+        for (var j = 0;j < geometry.linearRings.length; j++) {
+        	var linearRing = geometry.linearRings[j];
+        	d += " M";
+        	for (var i = 0; i < linearRing.path.length; i++) {
+                d += " " + linearRing.path[i];
+	        }
+        }
+        node.setAttributeNS(null, "d", d);
+        
         this._setStyle(node, style, true, true); 
         this.root.appendChild(node);
     },



More information about the Commits mailing list