[OpenLayers-Commits] r1790 - in sandbox/bertil/lib/OpenLayers/Feature: . Geometry

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


Author: pgiraud
Date: 2006-11-09 09:38:20 -0500 (Thu, 09 Nov 2006)
New Revision: 1790

Modified:
   sandbox/bertil/lib/OpenLayers/Feature/Geometry.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineSegment.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineString.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/LinearRing.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Point.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Polygon.js
   sandbox/bertil/lib/OpenLayers/Feature/Geometry/Surface.js
Log:
formatting and commenting

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Curve.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -12,7 +12,6 @@
 OpenLayers.Feature.Geometry.Curve.prototype = 
     OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Curve.prototype, {
 
-
     /**
     * @constructor
     *
@@ -66,7 +65,7 @@
      *
      * @param {OpenLayers.Feature.Geometry.Point} point
      * @param {int} index
-     */    
+     */
     addPoint: function(point, index) {
         if(point && point.CLASS_NAME == "OpenLayers.Feature.Geometry.Point"){
             if (index) {
@@ -78,7 +77,9 @@
     },
     
     /**
-     * @param Point
+     * Removes a point from geometry path
+     *
+     * @param {OpenLayers.Feature.Geometry.Point} point
      */
     removePoint: function(point){
         this.path = this.path.without(point);

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineSegment.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineSegment.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineSegment.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -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/LineString.js
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.LineSegment = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.LineSegment.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineSegment.prototype, OpenLayers.Feature.Geometry.LineString.prototype);
-OpenLayers.Feature.Geometry.LineSegment.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineSegment.prototype, {
+OpenLayers.Feature.Geometry.LineSegment.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineSegment.prototype,
+        OpenLayers.Feature.Geometry.LineString.prototype);
+OpenLayers.Feature.Geometry.LineSegment.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineSegment.prototype, {
 
+    /**
+    * @constructor
+    *
+    * @param {OpenLayers.Feature.Geometry.Point} point
+    * @param {OpenLayers.Feature.Geometry.Point} point
+    */
     initialize: function(point1, point2) {
         arguments = [[point1, point2]]
         OpenLayers.Feature.Geometry.LineString.prototype.initialize.apply(this, arguments);

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineString.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineString.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/LineString.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,10 +1,20 @@
-/* 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/Curve.js
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.LineString = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.LineString.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineString.prototype, OpenLayers.Feature.Geometry.Curve.prototype);
-OpenLayers.Feature.Geometry.LineString.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineString.prototype, {
+OpenLayers.Feature.Geometry.LineString.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineString.prototype,
+        OpenLayers.Feature.Geometry.Curve.prototype);
+OpenLayers.Feature.Geometry.LineString.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LineString.prototype, {
 
-
+    /**
+     * @returns the coordinates path as a string
+     */
     toString: function() {
         return this.path.toString();
     },

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/LinearRing.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/LinearRing.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/LinearRing.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,26 +1,53 @@
-/* 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/LineString.js
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.LinearRing = OpenLayers.Class.create();
 
-OpenLayers.Feature.Geometry.LinearRing.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LinearRing.prototype, OpenLayers.Feature.Geometry.LineString.prototype);
-OpenLayers.Feature.Geometry.LinearRing.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LinearRing.prototype, {
+OpenLayers.Feature.Geometry.LinearRing.prototype = 
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LinearRing.prototype,
+        OpenLayers.Feature.Geometry.LineString.prototype);
+OpenLayers.Feature.Geometry.LinearRing.prototype = 
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.LinearRing.prototype, {
 
+    /**
+    * @constructor
+    *
+    * @param {array} points
+    */
     initialize: function(points) {
         OpenLayers.Feature.Geometry.LineString.prototype.initialize.apply(this, arguments);
     },
     
+    /**
+     * Adds a point to geometry path
+     *
+     * @param {OpenLayers.Feature.Geometry.Point} point
+     * @param {int} index
+     */ 
     addPoint: function() {
         this.path.pop();
         OpenLayers.Feature.Geometry.LineString.prototype.addPoint.apply(this, arguments);
         this.path.push(this.path.first());
     },
     
+    /**
+     * Removes a point from geometry path
+     *
+     * @param {OpenLayers.Feature.Geometry.Point} point
+     */
     removePoint: function() {
         this.path.pop();
         OpenLayers.Feature.Geometry.LineString.prototype.removePoint.apply(this, arguments);
         this.path.push(this.path.first());
     },
 
+    /**
+     * @returns the coordinates path as a string
+     */
     toString: function() {
         return this.path.toString();
     },

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Point.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Point.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Point.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,12 +1,28 @@
-/* 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.Point = OpenLayers.Class.create();
 
-OpenLayers.Feature.Geometry.Point.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype, OpenLayers.Feature.Geometry.prototype);
-OpenLayers.Feature.Geometry.Point.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype, OpenLayers.LonLat.prototype);
-OpenLayers.Feature.Geometry.Point.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype, {
+OpenLayers.Feature.Geometry.Point.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype,
+        OpenLayers.Feature.Geometry.prototype);
+OpenLayers.Feature.Geometry.Point.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype,
+        OpenLayers.LonLat.prototype);
+OpenLayers.Feature.Geometry.Point.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Point.prototype, {
 
-    initialize: function(x, y){
+    /**
+    * @constructor
+    *
+    * @param {float} x
+    * @param {float} y
+    */
+    initialize: function(x, y) {
     	OpenLayers.LonLat.prototype.initialize.apply(this, arguments);
     	OpenLayers.Feature.Geometry.prototype.initialize.apply(this, arguments);
     	this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME+"_");
@@ -14,25 +30,44 @@
     	this.y = this.lat;
     },
 
-    setX: function(x){
+    /**
+     * Sets the x coordinate
+     *
+     * @param {float} x
+     */
+    setX: function(x) {
     	this.lon = x;
     	this.x = x;
     },
-
-    setY: function(y){
+    
+    /**
+     * Sets the y coordinate
+     *
+     * @param {float} y
+     */
+    setY: function(y) {
     	this.lat = y;
     	this.y = y;
     },
 
-    getX: function(){
+    /**
+     * @returns float
+     */
+    getX: function() {
 	   return this.lon;
     },
 
-    getY: function(){
+    /**
+     * @returns float
+     */
+    getY: function() {
 	   return this.lat;
     },
 
-    toString: function(){
+    /**
+     * @returns the coordinates as a string
+     */
+    toString: function() {
 	   return this.lon+","+this.lat;
     },
 

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Polygon.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Polygon.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Polygon.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,11 +1,25 @@
-/* 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/Surface.js
+/**
+ * @class
+ */
 OpenLayers.Feature.Geometry.Polygon = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.Polygon.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Polygon.prototype, OpenLayers.Feature.Geometry.Surface.prototype);
-OpenLayers.Feature.Geometry.Polygon.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Polygon.prototype, {
+OpenLayers.Feature.Geometry.Polygon.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Polygon.prototype,
+        OpenLayers.Feature.Geometry.Surface.prototype);
+OpenLayers.Feature.Geometry.Polygon.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Polygon.prototype, {
     
+    /**
+    * @constructor
+    *
+    * @param {array} linearRings
+    */
     initialize: function(linearRings) {
-        OpenLayers.Feature.Geometry.Surface.prototype.initialize.apply(this, arguments);
+        OpenLayers.Feature.Geometry.Surface.prototype.initialize.apply(this,
+            arguments);
         
         this.linearRings = [];
         
@@ -14,6 +28,9 @@
         }
     },
 
+    /**
+     * @returns the coordinates path as a string
+     */
     toString: function() {
         return this.path.toString();
     },

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry/Surface.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry/Surface.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry/Surface.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,8 +1,16 @@
-/* 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.Surface = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.Surface.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Surface.prototype, OpenLayers.Feature.Geometry.prototype);
-OpenLayers.Feature.Geometry.Surface.prototype = OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Surface.prototype, {
+OpenLayers.Feature.Geometry.Surface.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Surface.prototype,
+        OpenLayers.Feature.Geometry.prototype);
+OpenLayers.Feature.Geometry.Surface.prototype =
+    OpenLayers.Util.extend(OpenLayers.Feature.Geometry.Surface.prototype, {
 
     CLASS_NAME: "OpenLayers.Feature.Geometry.Surface"
     

Modified: sandbox/bertil/lib/OpenLayers/Feature/Geometry.js
===================================================================
--- sandbox/bertil/lib/OpenLayers/Feature/Geometry.js	2006-11-09 14:07:09 UTC (rev 1789)
+++ sandbox/bertil/lib/OpenLayers/Feature/Geometry.js	2006-11-09 14:38:20 UTC (rev 1790)
@@ -1,17 +1,35 @@
-/* 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 = OpenLayers.Class.create();
-OpenLayers.Feature.Geometry.prototype = OpenLayers.Class.inherit( OpenLayers.Feature, {
+OpenLayers.Feature.Geometry.prototype =
+    OpenLayers.Class.inherit( OpenLayers.Feature, {
 
+    /** @type array */
     attributes: [],
         
     /** @type OpenLayers.Bounds */
     extent: null,
     
+    /**
+     * @constructor
+     *
+     * @param {array} linearRings
+     */
     initialize: function() {
         this.id = OpenLayers.Util.createUniqueID(this.CLASS_NAME+ "_");
     },
     
+    /**
+     * Adds attributes to the feature
+     * (should not be in geometry but in feature class)
+     *
+     * @param {?} attributes to add, can be an array
+     */
     addAttributes: function(attributes) {
         if (!(attributes instanceof Array)){
             attributes = [attributes];
@@ -24,10 +42,19 @@
         }
     },
 
+    /**
+     * Removes attributes from the feature
+     * (should not be in geometry but in feature class)
+     *
+     * @param {?} attributes to remove, can be an array
+     */
     removeAttributes: function(attributes) {
         if (!(attributes instanceof Array)) {
             attributes = [attributes];
         }
+        
+        // do something to remove attributes
+        // not implemented yet
     },
     
     CLASS_NAME: "OpenLayers.Feature.Geometry"



More information about the Commits mailing list