Files
openlayers/lib/OpenLayers/Geometry/LineString.js
crschmidt 044368664f Tag OpenLayers 2.4-rc3.
git-svn-id: http://svn.openlayers.org/tags/openlayers/release-2.4-rc3@3113 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
2007-05-02 14:20:28 +00:00

41 lines
1.3 KiB
JavaScript

/* Copyright (c) 2006 MetaCarta, Inc., published under the BSD license.
* See http://svn.openlayers.org/trunk/openlayers/release-license.txt
* for the full text of the license. */
/**
* @class
*
* A LineString is a Curve which, once two points have been added to it, can
* never be less than two points long.
*
* @requires OpenLayers/Geometry/Curve.js
*/
OpenLayers.Geometry.LineString = OpenLayers.Class.create();
OpenLayers.Geometry.LineString.prototype =
OpenLayers.Class.inherit(OpenLayers.Geometry.Curve, {
/**
* @constructor
*
* @param {Array(OpenLayers.Geometry.Point)} points
*/
initialize: function(points) {
OpenLayers.Geometry.Curve.prototype.initialize.apply(this, arguments);
},
/** Only allows removal of a point if there are three or more points in
* the linestring. (otherwise the result would be just a single point)
*
* @param {OpenLayers.Geometry.Point} point
*/
removeComponent: function(point) {
if ( this.components && (this.components.length > 2)) {
OpenLayers.Geometry.Collection.prototype.removeComponent.apply(this,
arguments);
}
},
/** @final @type String */
CLASS_NAME: "OpenLayers.Geometry.LineString"
});