[OpenLayers-Commits] r1789 - sandbox/bertil/lib/OpenLayers/Feature/Geometry

commits at openlayers.org commits at openlayers.org
Thu Nov 9 09:07:09 EST 2006


Author: pgiraud
Date: 2006-11-09 09:07:09 -0500 (Thu, 09 Nov 2006)
New Revision: 1789

Modified:
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Aggregate.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js
Log:
formatting and commenting

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Aggregate.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Aggregate.js	2006-11-09 10:11:35 UTC (rev 1788)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Aggregate.js	2006-11-09 14:07:09 UTC (rev 1789)
@@ -1,50 +1,59 @@
-/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, published under the BSD license. */
+/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, Pierre Giraud,
+ * published under the BSD license. */
 
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.Aggregate = function() {}
 OpenLayers.Feature.Geometry.Aggregate.prototype = {
 
+    /**
+     * @returns the components of the geometry
+     */
     getComponents: function(){
-        return this.components?this.components:null;
+        return this.components ? this.components : null;
     },
 
     addComponents: function(components){
-	if(!(components instanceof Array)) {
-	    components = [components];
-	}
+        if(!(components instanceof Array)) {
+            components = [components];
+        }
 
-	if(this.components) {
-	    this.components = this.components.concat(components);
-	} else {
-	    this.components = [].concat(components);
-	}
+        if(this.components) {
+            this.components = this.components.concat(components);
+        } else {
+            this.components = [].concat(components);
+        }
     },
 
-    removeComponents: function(components){
-	if(!(components instanceof Array))
-	components = [components];
-
-	for (var i = 0; i < components.length; i++) {
-	    this.components = this.components.without(components[i]);
-	}
+    removeComponents: function(components) {
+        if(!(components instanceof Array)) {
+            components = [components];
+        }
+        
+        for (var i = 0; i < components.length; i++) {
+            this.components = this.components.without(components[i]);
+        }
     },
 
-    addSupportedComponents: function(classes){
-        if(!(classes instanceof Array))
-	classes = [classes];
-
-        if(this.SupportedComponents)
-	this.SupportedComponents = this.SupportedComponents.concat(classes);
-        else
-	this.SupportedComponents = [].concat(classes);
+    addSupportedComponents: function(classes) {
+        if(!(classes instanceof Array)) {
+            classes = [classes];
+        }
+        
+        if(this.SupportedComponents) {
+            this.SupportedComponents = this.SupportedComponents.concat(classes);
+        } else {
+            this.SupportedComponents = [].concat(classes);
     },
 
-    removeSupportedComponents: function(classes){
-	if(!(classes instanceof Array))
-	classes = [classes];
-
-	for (var i = 0; i < classes.length; i++) {
-	    this.SupportedComponents = this.SupportedComponents.without(classes[i]);
-	}
+    removeSupportedComponents: function(classes) {
+        if(!(classes instanceof Array)) {
+            classes = [classes];
+        }
+        for (var i = 0; i < classes.length; i++) {
+            this.SupportedComponents = this.SupportedComponents.without(classes[i]);
+        }
     },
 
     CLASS_NAME: "OpenLayers.Component"

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js	2006-11-09 10:11:35 UTC (rev 1788)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js	2006-11-09 14:07:09 UTC (rev 1789)
@@ -1,9 +1,23 @@
-/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, published under the BSD license. */
-
+/* Copyright (c) 2006 CampToCamp SA, Bertil Chapuis, Pierre Giraud,
+ * published under the BSD license. */
+ 
+// @requires OpenLayers/Feature/Geometry.js
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.Curve = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.Curve.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, OpenLayers.Feature.Geometry.prototype);
-OpenLayers.Feature.Geometry.Curve.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, {
+OpenLayers.Feature.Geometry.Curve.prototype = 
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype,
+        OpenLayers.Feature.Geometry.prototype);
+OpenLayers.Feature.Geometry.Curve.prototype = 
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, {
 
+
+    /**
+    * @constructor
+    *
+    * @param {array} points
+    */
     initialize: function(points) {
         OpenLayers.Feature.Geometry.prototype.initialize.apply(this, arguments);
         
@@ -18,9 +32,12 @@
         this.getBoundingBox();
     },
     
+    /**
+     * @returns the extent of the geometry
+     * @type OpenLayers.Bounds
+     */
     getBoundingBox: function(){
         if (this.path.length > 0) {
-        // compute the extent of the geometry
             var xmin, ymin, xmax, ymax = null;
             this.path.each(function(point) {
                 if (point.lon < xmin || xmin == null) {
@@ -42,7 +59,14 @@
             return this.extent;
         }        
     },
-    
+
+    /**
+     * Adds a point to geometry path at the given index (optional)
+     * or a the end of the path
+     *
+     * @param {OpenLayers.Feature.Geometry.Point} point
+     * @param {int} index
+     */    
     addPoint: function(point, index) {
         if(point && point.CLASS_NAME == "OpenLayers.Feature.Geometry.Point"){
             if (index) {
@@ -53,6 +77,9 @@
         }
     },
     
+    /**
+     * @param Point
+     */
     removePoint: function(point){
         this.path = this.path.without(point);
     },



More information about the Commits mailing list