[OpenLayers-Commits] r2362 - sandbox/vector-2.4/lib/OpenLayers/Geometry
commits at openlayers.org
commits at openlayers.org
Mon Mar 5 19:58:10 EST 2007
Author: euzuro
Date: 2007-03-05 19:58:10 -0500 (Mon, 05 Mar 2007)
New Revision: 2362
Modified:
sandbox/vector-2.4/lib/OpenLayers/Geometry/LinearRing.js
Log:
coding standards LinearRing.js
Modified: sandbox/vector-2.4/lib/OpenLayers/Geometry/LinearRing.js
===================================================================
--- sandbox/vector-2.4/lib/OpenLayers/Geometry/LinearRing.js 2007-03-06 00:32:38 UTC (rev 2361)
+++ sandbox/vector-2.4/lib/OpenLayers/Geometry/LinearRing.js 2007-03-06 00:58:10 UTC (rev 2362)
@@ -8,22 +8,22 @@
* @requires OpenLayers/Geometry/LineString.js
*/
OpenLayers.Geometry.LinearRing = OpenLayers.Class.create();
-
OpenLayers.Geometry.LinearRing.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.LineString, {
/**
- * @constructor
- *
- * @param {array} points
- */
+ * @constructor
+ *
+ * @param {Array(OpenLayers.Geometry.Point)} points
+ */
initialize: function(points) {
- OpenLayers.Geometry.LineString.prototype.initialize.apply(this, arguments);
+ OpenLayers.Geometry.LineString.prototype.initialize.apply(this,
+ arguments);
},
/**
- * @returns An exact clone of this OpenLayers.Feature
- * @type OpenLayers.Feature
+ * @returns An exact clone of this OpenLayers.Geometry.LinearRing
+ * @type OpenLayers.Geometry.LinearRing
*/
clone: function (obj) {
if (obj == null) {
@@ -45,8 +45,9 @@
*/
addPoint: function(point, index) {
this.path.pop();
- if (this.path.length <= 1 || !(point.x == this.path[0].x && point.y == this.path[0].y)) {
- OpenLayers.Geometry.LineString.prototype.addPoint.apply(this, arguments);
+ if ((this.path.length <= 1) || (!point.equals(this.path[0]))) {
+ OpenLayers.Geometry.LineString.prototype.addPoint.apply(this,
+ arguments);
}
this.path.push(this.path[0]);
},
@@ -56,30 +57,34 @@
*
* @param {OpenLayers.Geometry.Point} point
*/
- removePoint: function() {
+ removePoint: function(point) {
if (this.path.length > 4) {
this.path.pop();
- OpenLayers.Geometry.LineString.prototype.removePoint.apply(this, arguments);
+ OpenLayers.Geometry.LineString.prototype.removePoint.apply(this,
+ arguments);
this.path.push(this.path[0]);
}
},
/**
* @returns the coordinates path as a string
+ * @type String
*/
toString: function() {
return this.path.toString();
},
/**
- * Returns the length of the geometry
+ * @returns the length of the geometry
+ * @type float
*/
getLength: function() {
return OpenLayers.Util.length(this.path);
},
/**
- * Returns the area of the geometry
+ * @returns the area of the geometry
+ * @type float
*/
getArea: function() {
return OpenLayers.Util.signedArea(this.path);
More information about the Commits
mailing list