Merge vector-2.4 branch back to trunk.

svn merge sandbox/vector-2.4/@2307 sandbox/vector-2.4/@HEAD trunk/openlayers/


git-svn-id: http://svn.openlayers.org/trunk/openlayers@2803 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
crschmidt
2007-03-16 13:23:56 +00:00
parent 8b9d974dc2
commit 3ca974acec
159 changed files with 10193 additions and 343 deletions

View File

@@ -0,0 +1,58 @@
/* Copyright (c) 2006 MetaCarta, Inc., published under a modified BSD license.
* See http://svn.openlayers.org/trunk/openlayers/repository-license.txt
* for the full text of the license. */
/**
* @class
*
* A Curve is a MultiPoint, whose points are assumed to be connected. To
* this end, we provide a "getLength()" function, which iterates through
* the points, summing the distances between them.
*
* @requires OpenLayers/Geometry/MultiPoint.js
*/
OpenLayers.Geometry.Curve = OpenLayers.Class.create();
OpenLayers.Geometry.Curve.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.MultiPoint, {
/**
* @constructor
*
* @param {Array(OpenLayers.Geometry.Point)} points
*/
initialize: function(points) {
OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,
arguments);
},
/**
* @returns An exact clone of this OpenLayers.Feature
* @type OpenLayers.Feature
*/
clone: function (obj) {
if (obj == null) {
obj = new OpenLayers.Geometry.Curve();
}
obj = OpenLayers.Geometry.Collection.prototype.clone.apply(this,
[obj]);
return obj;
},
/**
* @returns The length of the curve
* @type float
*/
getLength: function() {
var length = 0.0;
if ( this.components && (this.components.length > 1)) {
for(var i=1; i < this.components.length; i++) {
length += this.components[i-1].distanceTo(this.components[i]);
}
}
return length;
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Geometry.Curve"
});