[OpenLayers-Commits] r2384 - sandbox/vector-2.4/lib/OpenLayers/Geometry

commits at openlayers.org commits at openlayers.org
Tue Mar 6 11:25:40 EST 2007


Author: euzuro
Date: 2007-03-06 11:25:39 -0500 (Tue, 06 Mar 2007)
New Revision: 2384

Modified:
   sandbox/vector-2.4/lib/OpenLayers/Geometry/Polygon.js
Log:
sorry. forgot to update this class to the new formula. now it uses addComponent() instead of addComponents()

Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry/Polygon.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/Polygon.js	2007-03-06 16:16:46 UTC (rev 2383)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/Polygon.js	2007-03-06 16:25:39 UTC (rev 2384)
@@ -14,44 +14,26 @@
     /**
     * @constructor
     *
-    * @param {Array|OpenLayers.Geometry.Polygon}
+    * @param {Array(OpenLayers.Geometry.Polygon)}
     */
     initialize: function(components) {
     	OpenLayers.Geometry.Collection.prototype.initialize.apply(this, arguments);
-    	this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
-        
-        if (components != null) {
-            this.addComponents(components);
-        }
     },
 
     /**
-     * adds components to the MultiPolygon
+     * adds a component to the MultiPolygon, checking type
      *
-     * @param {Array|OpenLayers.Geometry.Polygon} point(s) to add
+     * @param {OpenLayers.Geometry.Polygon} point to add
      */
-    addComponents: function(components) {
-    	if(!(components instanceof Array)) {
-            components = [components];
+    addComponent: function(component) {
+        if (!(component instanceof OpenLayers.Geometry.LinearRing)) {
+            throw "component should be an OpenLayers.Geometry.LinearRing but is " + components[i].CLASS_NAME;
         }
-        for (var i = 0; i < components.length; i++) {
-            if (!(components[i] instanceof OpenLayers.Geometry.LinearRing)) {
-                throw "component should be an OpenLayers.Geometry.LinearRing but is " + components[i].CLASS_NAME;
-            }
-        }
-        OpenLayers.Geometry.Collection.prototype.addComponents.apply(this, arguments);
+        OpenLayers.Geometry.Collection.prototype.addComponent.apply(this, 
+                                                                    arguments);
     },
     
     /**
-     * removes components from the MultiPolygon
-     *
-     * @param {Array|OpenLayers.Geometry.Polygon} point(s) to add
-     */
-    removeComponents: function(components) {
-        OpenLayers.Geometry.Collection.prototype.removeComponents.apply(this, arguments);
-    },
-    
-    /**
      * Returns the length of the geometry
      */
     getLength: function() {



More information about the Commits mailing list