Merge all changes from the naturaldocs sandbox. This brings all the work that
has been done in the NaturalDocs branch back to trunk. Thanks to everyone who helped out in making this happen. (I could list people, but the list would be long, and I'm already mentally on vacation.) git-svn-id: http://svn.openlayers.org/trunk/openlayers@3545 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf
This commit is contained in:
@@ -3,40 +3,50 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Geometry.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Collection
|
||||
* A Collection is exactly what it sounds like: A collection of different
|
||||
* Geometries. These are stored in the local parameter "components" (which
|
||||
* Geometries. These are stored in the local parameter <components> (which
|
||||
* can be passed as a parameter to the constructor).
|
||||
*
|
||||
* As new geometries are added to the collection, they are NOT cloned.
|
||||
* When removing geometries, they need to be specified by reference (ie you
|
||||
* have to pass in the *exact* geometry to be removed).
|
||||
*
|
||||
* The getArea() and getLength() functions here merely iterate through
|
||||
* The <getArea> and <getLength> functions here merely iterate through
|
||||
* the components, summing their respective areas and lengths.
|
||||
*
|
||||
* @requires OpenLayers/Geometry.js
|
||||
*
|
||||
* Create a new instance with the <OpenLayers.Geometry.Collection> constructor.
|
||||
*
|
||||
* Inerhits from:
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
OpenLayers.Geometry.Collection = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Collection.prototype =
|
||||
OpenLayers.Class.inherit( OpenLayers.Geometry, {
|
||||
|
||||
/** @type Array(OpenLayers.Geometry) */
|
||||
/**
|
||||
* APIProperty: components
|
||||
* {Array(<OpenLayers.Geometry>)} The component parts of this geometry
|
||||
*/
|
||||
components: null,
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null value means the
|
||||
* component types are not restricted.
|
||||
*/
|
||||
componentTypes: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry)} components
|
||||
* Constructor: OpenLayers.Geometry.Collection
|
||||
* Creates a Geometry Collection -- a list of geoms.
|
||||
*
|
||||
* Parameters:
|
||||
* components - {Array(<OpenLayers.Geometry>)} Optional array of geometries
|
||||
*
|
||||
*/
|
||||
initialize: function (components) {
|
||||
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
||||
@@ -47,7 +57,8 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* APIMethod: destroy
|
||||
* Destroy this geometry.
|
||||
*/
|
||||
destroy: function () {
|
||||
this.components.length = 0;
|
||||
@@ -55,8 +66,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns An exact clone of this collection
|
||||
* @type OpenLayers.Geometry.Collection
|
||||
* APIMethod: clone
|
||||
* Clone this geometry.
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Geometry.Collection>} An exact clone of this collection
|
||||
*/
|
||||
clone: function() {
|
||||
var geometry = eval("new " + this.CLASS_NAME + "()");
|
||||
@@ -71,8 +85,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns the components of the geometry
|
||||
* @type String
|
||||
* Method: getComponentsString
|
||||
* Get a string representing the components for this collection
|
||||
*
|
||||
* Return:
|
||||
* {String} A string representation of the components of this geometry
|
||||
*/
|
||||
getComponentsString: function(){
|
||||
var strings = [];
|
||||
@@ -82,9 +99,10 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
return strings.join(",");
|
||||
},
|
||||
|
||||
/** Recalculate the bounds by iterating through the components and
|
||||
* calling calling extendBounds() on each item
|
||||
*
|
||||
/**
|
||||
* APIMethod: calculateBounds
|
||||
* Recalculate the bounds by iterating through the components and
|
||||
* calling calling extendBounds() on each item.
|
||||
*/
|
||||
calculateBounds: function() {
|
||||
this.bounds = null;
|
||||
@@ -97,8 +115,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Array(OpenLayers.Geometry)} components
|
||||
*
|
||||
* APIMethod: addComponents
|
||||
* Add components to this geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* components - {Array(<OpenLayers.Geometry>)} An array of geometries to add
|
||||
*/
|
||||
addComponents: function(components){
|
||||
if(!(components instanceof Array)) {
|
||||
@@ -110,16 +131,19 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Method: addComponent
|
||||
* Add a new component (geometry) to the collection. If this.componentTypes
|
||||
* is set, then the component class name must be in the componentTypes array.
|
||||
*
|
||||
*
|
||||
* The bounds cache is reset.
|
||||
*
|
||||
* @param {OpenLayers.Geometry} component
|
||||
* @param {int} index Index into the array to insert the component
|
||||
* @type Boolean
|
||||
* @return Component was successfully added
|
||||
*/
|
||||
* Parameters:
|
||||
* component - {<OpenLayers.Geometry>} A geometry to add
|
||||
* index - {int} Optional index into the array to insert the component
|
||||
*
|
||||
* Return:
|
||||
* {Boolean} The component geometry was successfully added
|
||||
*/
|
||||
addComponent: function(component, index) {
|
||||
var added = false;
|
||||
if(component) {
|
||||
@@ -145,7 +169,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {Array(OpenLayers.Geometry)} components
|
||||
* APIMethod: removeComponents
|
||||
* Remove components from this geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* components - {Array(<OpenLayers.Geometry>)} The components to be removed
|
||||
*/
|
||||
removeComponents: function(components) {
|
||||
if(!(components instanceof Array)) {
|
||||
@@ -157,7 +185,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Geometry} component
|
||||
* Method: removeComponent
|
||||
* Remove a component from this geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* component - {<OpenLayers.Geometry>}
|
||||
*/
|
||||
removeComponent: function(component) {
|
||||
|
||||
@@ -169,8 +201,11 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns The length of the geometry
|
||||
* @type float
|
||||
* APIMethod: getLength
|
||||
* Calculate the length of this geometry
|
||||
*
|
||||
* Return:
|
||||
* {Float} The length of the geometry
|
||||
*/
|
||||
getLength: function() {
|
||||
var length = 0.0;
|
||||
@@ -180,10 +215,13 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
return length;
|
||||
},
|
||||
|
||||
/** Note how this function is overridden in Polygon
|
||||
*
|
||||
* @returns the area of the collection by summing its parts
|
||||
* @type float
|
||||
/**
|
||||
* APIMethod: getArea
|
||||
* Calculate the area of this geometry. Note how this function is overridden
|
||||
* in <OpenLayers.Geometry.Polygon>.
|
||||
*
|
||||
* Return:
|
||||
* {Float} The area of the collection by summing its parts
|
||||
*/
|
||||
getArea: function() {
|
||||
var area = 0.0;
|
||||
@@ -194,9 +232,12 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: move
|
||||
* Moves a collection in place
|
||||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
*
|
||||
* Parameters:
|
||||
* x - {Float} The x-displacement (in map units)
|
||||
* y - {Float} The y-displacement (in map units)
|
||||
*/
|
||||
move: function(x, y) {
|
||||
for(var i = 0; i < this.components.length; i++) {
|
||||
@@ -205,10 +246,14 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: equals
|
||||
* Tests for equivalent geometries
|
||||
* @param {OpenLayers.Geometry}
|
||||
* @type Boolean
|
||||
* @return The coordinates are equivalent
|
||||
*
|
||||
* Parameters:
|
||||
* geometry - {<OpenLayers.Geometry>}
|
||||
*
|
||||
* Return:
|
||||
* {Boolean} The coordinates are equivalent
|
||||
*/
|
||||
equals: function(geometry) {
|
||||
var equivalent = true;
|
||||
@@ -228,6 +273,9 @@ OpenLayers.Geometry.Collection.prototype =
|
||||
return equivalent;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.Collection"
|
||||
});
|
||||
|
||||
@@ -3,30 +3,33 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Geometry/MultiPoint.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Curve
|
||||
* 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
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Geometry.MultiPoint>
|
||||
*/
|
||||
OpenLayers.Geometry.Curve = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Curve.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.MultiPoint, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null
|
||||
* value means the component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.Point"],
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.Point)} points
|
||||
* Constructor: OpenLayers.Geometry.Curve
|
||||
*
|
||||
* Parameters:
|
||||
* point - {Array(<OpenLayers.Geometry.Point>)}
|
||||
*/
|
||||
initialize: function(points) {
|
||||
OpenLayers.Geometry.MultiPoint.prototype.initialize.apply(this,
|
||||
@@ -34,8 +37,10 @@ OpenLayers.Geometry.Curve.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns The length of the curve
|
||||
* @type float
|
||||
* APIMethod: getLength
|
||||
*
|
||||
* Return:
|
||||
* {Float} The length of the curve
|
||||
*/
|
||||
getLength: function() {
|
||||
var length = 0.0;
|
||||
|
||||
@@ -3,30 +3,39 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Geometry/Curve.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.LineString
|
||||
* 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
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry.Curve>
|
||||
*/
|
||||
OpenLayers.Geometry.LineString = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.LineString.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.Curve, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.Point)} points
|
||||
* Constructor: OpenLayers.Geometry.LineString
|
||||
* Create a new LineString geometry
|
||||
*
|
||||
* Parameters:
|
||||
* points - {Array(<OpenLayers.Geometry.Point>)} An array of points used to
|
||||
* generate the linestring
|
||||
*
|
||||
*/
|
||||
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
|
||||
/**
|
||||
* APIMethod: removeComponent
|
||||
* 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)
|
||||
*
|
||||
* Parameters:
|
||||
* point - {<OpenLayers.Geometry.Point>} The point to be removed
|
||||
*/
|
||||
removeComponent: function(point) {
|
||||
if ( this.components && (this.components.length > 2)) {
|
||||
@@ -35,6 +44,9 @@ OpenLayers.Geometry.LineString.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.LineString"
|
||||
});
|
||||
|
||||
@@ -3,7 +3,9 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Geometry/LineString.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.LinearRing
|
||||
*
|
||||
* A Linear Ring is a special LineString which is closed. It closes itself
|
||||
* automatically on every addPoint/removePoint by adding a copy of the first
|
||||
@@ -12,29 +14,31 @@
|
||||
* Also, as it is the first in the line family to close itself, a getArea()
|
||||
* function is defined to calculate the enclosed area of the linearRing
|
||||
*
|
||||
* @requires OpenLayers/Geometry/LineString.js
|
||||
* Inherits:
|
||||
* - <OpenLayers.Geometry.LineString>
|
||||
*/
|
||||
OpenLayers.Geometry.LinearRing = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.LinearRing.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.LineString, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null
|
||||
* value means the component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.Point"],
|
||||
|
||||
/**
|
||||
* Constructor: OpenLayers.Geometry.LinearRing
|
||||
* Linear rings are constructed with an array of points. This array
|
||||
* can represent a closed or open ring. If the ring is open (the last
|
||||
* point does not equal the first point), the constructor will close
|
||||
* the ring. If the ring is already closed (the last point does equal
|
||||
* the first point), it will be left closed.
|
||||
* can represent a closed or open ring. If the ring is open (the last
|
||||
* point does not equal the first point), the constructor will close
|
||||
* the ring. If the ring is already closed (the last point does equal
|
||||
* the first point), it will be left closed.
|
||||
*
|
||||
* @constructor
|
||||
* @param {Array(OpenLayers.Geometry.Point)} points
|
||||
* Parameters:
|
||||
* points - {Array(<OpenLayers.Geometry.Point>)} points
|
||||
*/
|
||||
initialize: function(points) {
|
||||
OpenLayers.Geometry.LineString.prototype.initialize.apply(this,
|
||||
@@ -42,17 +46,21 @@ OpenLayers.Geometry.LinearRing.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: addComponent
|
||||
* Adds a point to geometry components. If the point is to be added to
|
||||
* the end of the components array and it is the same as the last point
|
||||
* already in that array, the duplicate point is not added. This has the
|
||||
* effect of closing the ring if it is not already closed, and doing the
|
||||
* right thing if it is already closed. This behavior can be overridden
|
||||
* by calling the method with a non-null index as the second argument.
|
||||
* the end of the components array and it is the same as the last point
|
||||
* already in that array, the duplicate point is not added. This has
|
||||
* the effect of closing the ring if it is not already closed, and
|
||||
* doing the right thing if it is already closed. This behavior can
|
||||
* be overridden by calling the method with a non-null index as the
|
||||
* second argument.
|
||||
*
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* @param {int} index Index into the array to insert the component
|
||||
* @type Boolean
|
||||
* @return Point was successfully added
|
||||
* Parameter:
|
||||
* point - {<OpenLayers.Geometry.Point>}
|
||||
* index - {Integer} Index into the array to insert the component
|
||||
*
|
||||
* Return:
|
||||
* {Boolean} Was the Point successfully added?
|
||||
*/
|
||||
addComponent: function(point, index) {
|
||||
var added = false;
|
||||
@@ -78,9 +86,11 @@ OpenLayers.Geometry.LinearRing.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Removes a point from geometry components
|
||||
* APIMethod: removeComponent
|
||||
* Removes a point from geometry components.
|
||||
*
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* Parameters:
|
||||
* point - {<OpenLayers.Geometry.Point>}
|
||||
*/
|
||||
removeComponent: function(point) {
|
||||
if (this.components.length > 4) {
|
||||
@@ -100,11 +110,13 @@ OpenLayers.Geometry.LinearRing.prototype =
|
||||
}
|
||||
},
|
||||
|
||||
/** Note: The area is positive if the ring is oriented CW, otherwise
|
||||
/**
|
||||
* APIMethod: getArea
|
||||
* Note - The area is positive if the ring is oriented CW, otherwise
|
||||
* it will be negative.
|
||||
*
|
||||
* @returns The signed area for a ring.
|
||||
* @type float
|
||||
* Return:
|
||||
* {Float} The signed area for a ring.
|
||||
*/
|
||||
getArea: function() {
|
||||
var area = 0.0;
|
||||
|
||||
@@ -3,34 +3,44 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* A MultiLineString is a collection of LineStrings
|
||||
*
|
||||
* @requires OpenLayers/Geometry/Collection.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.MultiLineString
|
||||
* A MultiLineString is a geometry with multiple <OpenLayers.Geometry.LineString>
|
||||
* components.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry.Collection>
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
OpenLayers.Geometry.MultiLineString = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.MultiLineString.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null value means the
|
||||
* component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.LineString"],
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Geometry.MultiLineString
|
||||
* Constructor for a MultiLineString Geometry.
|
||||
*
|
||||
* Parameters:
|
||||
* components - {Array(OpenLayers.Geometry.LineString)}
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.LineString)} components
|
||||
*/
|
||||
initialize: function(components) {
|
||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||
arguments);
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.MultiLineString"
|
||||
});
|
||||
|
||||
@@ -3,28 +3,37 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* MultiPoint is a collection of Points.
|
||||
*
|
||||
* @requires OpenLayers/Geometry/Collection.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.MultiPoint
|
||||
* MultiPoint is a collection of Points. Create a new instance with the
|
||||
* <OpenLayers.Geometry.MultiPoint> constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry.Collection>
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
OpenLayers.Geometry.MultiPoint = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.MultiPoint.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null value means the
|
||||
* component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.Point"],
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Geometry.MultiPoint
|
||||
* Create a new MultiPoint Geometry
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.Point)} components
|
||||
* Parameters:
|
||||
* components - Array({<OpenLayers.Geometry.Point>})
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Geometry.MultiPoint>}
|
||||
*/
|
||||
initialize: function(components) {
|
||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||
@@ -32,23 +41,31 @@ OpenLayers.Geometry.MultiPoint.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for addComponent()
|
||||
*
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* @param {int} index
|
||||
* APIMethod: addPoint
|
||||
* Wrapper for <OpenLayers.Geometry.Collection.addComponent>
|
||||
*
|
||||
* Parameters:
|
||||
* point - {<OpenLayers.Geometry.Point>} Point to be added
|
||||
* index - {Integer} Optional index
|
||||
*/
|
||||
addPoint: function(point, index) {
|
||||
this.addComponent(point, index);
|
||||
},
|
||||
|
||||
/**
|
||||
* Wrapper for removeComponent()
|
||||
* APIMethod: removePoint
|
||||
* Wrapper for <OpenLayers.Geometry.Collection.removeComponent>
|
||||
*
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* Parameters:
|
||||
* point - {<OpenLayers.Geometry.Point>} Point to be removed
|
||||
*/
|
||||
removePoint: function(point){
|
||||
this.removeComponent(point);
|
||||
},
|
||||
/** @final @type String */
|
||||
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.MultiPoint"
|
||||
});
|
||||
|
||||
@@ -3,34 +3,45 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* MultiPolygon is a collection of Polygons.
|
||||
*
|
||||
* @requires OpenLayers/Geometry/Collection.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.MultiPolygon
|
||||
* MultiPolygon is a geometry with multiple <OpenLayers.Geometry.Polygon>
|
||||
* components. Create a new instance with the <OpenLayers.Geometry.MultiPolygon>
|
||||
* constructor.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry.Collection>
|
||||
*/
|
||||
OpenLayers.Geometry.MultiPolygon = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.MultiPolygon.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null value means the
|
||||
* component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.Polygon"],
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.Polygon)} components
|
||||
*/
|
||||
* Constructor: OpenLayers.Geometry.MultiPolygon
|
||||
* Create a new MultiPolygon geometry
|
||||
*
|
||||
* Parameters:
|
||||
* components - {Array(<OpenLayers.Geometry.Polygon>)} An array of polygons
|
||||
* used to generate the MultiPolygon
|
||||
*
|
||||
*/
|
||||
initialize: function(components) {
|
||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||
arguments);
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.MultiPolygon"
|
||||
});
|
||||
|
||||
@@ -3,25 +3,38 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Geometry.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Point
|
||||
* Point geometry class.
|
||||
*
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
OpenLayers.Geometry.Point = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Point.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry, {
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* APIProperty: x
|
||||
* {float}
|
||||
*/
|
||||
x: null,
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* APIProperty: y
|
||||
* {float}
|
||||
*/
|
||||
y: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Geometry.Point
|
||||
* Construct a point geometry.
|
||||
*
|
||||
* @param {float} x
|
||||
* @param {float} y
|
||||
* Parameters:
|
||||
* x - {float}
|
||||
* y - {float}
|
||||
*
|
||||
*/
|
||||
initialize: function(x, y) {
|
||||
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
||||
@@ -31,8 +44,10 @@ OpenLayers.Geometry.Point.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns An exact clone of this OpenLayers.Geometry.Point
|
||||
* @type OpenLayers.Geometry.Point
|
||||
* APIMethod: clone
|
||||
*
|
||||
* Return:
|
||||
* {<OpenLayers.Geometry.Point>} An exact clone of this OpenLayers.Geometry.Point
|
||||
*/
|
||||
clone: function(obj) {
|
||||
if (obj == null) {
|
||||
@@ -45,8 +60,9 @@ OpenLayers.Geometry.Point.prototype =
|
||||
return obj;
|
||||
},
|
||||
|
||||
/** Create a new Bounds based on the lon/lat
|
||||
*
|
||||
/**
|
||||
* Method: calculateBounds
|
||||
* Create a new Bounds based on the lon/lat
|
||||
*/
|
||||
calculateBounds: function () {
|
||||
this.bounds = new OpenLayers.Bounds(this.x, this.y,
|
||||
@@ -54,7 +70,10 @@ OpenLayers.Geometry.Point.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Geometry.Point} point
|
||||
* APIMethod: distanceTo
|
||||
*
|
||||
* Parameters:
|
||||
* point - {<OpenLayers.Geometry.Point>}
|
||||
*/
|
||||
distanceTo: function(point) {
|
||||
var distance = 0.0;
|
||||
@@ -69,12 +88,16 @@ OpenLayers.Geometry.Point.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @param {OpenLayers.Geometry} xy
|
||||
* @returns Boolean value indicating whether the passed-in
|
||||
* OpenLayers.Geometryobject has the same components as this
|
||||
* APIMethod: equals
|
||||
*
|
||||
* Parameters:
|
||||
* xy - {<OpenLayers.Geometry>}
|
||||
*
|
||||
* Return:
|
||||
* {Boolean} Boolean value indicating whether the passed-in
|
||||
* {<OpenLayers.Geometry>} object has the same components as this
|
||||
* note that if ll passed in is null, returns false
|
||||
*
|
||||
* @type bool
|
||||
*/
|
||||
equals:function(geom) {
|
||||
var equals = false;
|
||||
@@ -86,24 +109,31 @@ OpenLayers.Geometry.Point.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @return Shortened String representation of Point object.
|
||||
* Method: toShortString
|
||||
*
|
||||
* Return:
|
||||
* {String} Shortened String representation of Point object.
|
||||
* (ex. <i>"5, 42"</i>)
|
||||
* @type String
|
||||
*/
|
||||
toShortString: function() {
|
||||
return (this.x + ", " + this.y);
|
||||
},
|
||||
|
||||
/**
|
||||
* APIMethod: move
|
||||
* Moves a point in place
|
||||
* @param {Float} x
|
||||
* @param {Float} y
|
||||
*
|
||||
* Parameters:
|
||||
* x - {Float}
|
||||
* y - {Float}
|
||||
*/
|
||||
move: function(x, y) {
|
||||
this.x = this.x + x;
|
||||
this.y = this.y + y;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/** Constant: CLASS_NAME
|
||||
* {String} Name of this class
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.Point"
|
||||
});
|
||||
|
||||
@@ -3,42 +3,49 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
* @requires OpenLayers/Geometry/Collection.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Polygon
|
||||
* Polygon is a collection of Geometry.LinearRings.
|
||||
*
|
||||
* The first ring (this.component[0])is the outer bounds of the polygon and
|
||||
* all subsequent rings (this.component[1-n]) are internal holes.
|
||||
*
|
||||
* @requires OpenLayers/Geometry/Collection.js
|
||||
* Inherits from:
|
||||
* - <OpenLayers.Geometry.Collection>
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
OpenLayers.Geometry.Polygon = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Polygon.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry.Collection, {
|
||||
|
||||
/**
|
||||
* An array of class names representing the types of components that
|
||||
* the collection can include. A null value means the component types
|
||||
* are not restricted.
|
||||
* @type Array(String)
|
||||
* Property: componentTypes
|
||||
* {Array(String)} An array of class names representing the types of
|
||||
* components that the collection can include. A null value means the
|
||||
* component types are not restricted.
|
||||
*/
|
||||
componentTypes: ["OpenLayers.Geometry.LinearRing"],
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Geometry.Polygon
|
||||
* Constructor for a Polygon geometry.
|
||||
* The first ring (this.component[0])is the outer bounds of the polygon and
|
||||
* all subsequent rings (this.component[1-n]) are internal holes.
|
||||
*
|
||||
* @param {Array(OpenLayers.Geometry.LinearRing)}
|
||||
*
|
||||
* Parameters:
|
||||
* components - Array({<OpenLayers.Geometry.LinearRing>})
|
||||
*/
|
||||
initialize: function(components) {
|
||||
OpenLayers.Geometry.Collection.prototype.initialize.apply(this,
|
||||
arguments);
|
||||
},
|
||||
|
||||
/** Calculated by subtracting the areas of the internal holes from the
|
||||
/**
|
||||
* APIMethod: getArea
|
||||
* Calculated by subtracting the areas of the internal holes from the
|
||||
* area of the outer hole.
|
||||
*
|
||||
* @returns The area of the geometry
|
||||
* @type float
|
||||
* Return:
|
||||
* {float} The area of the geometry
|
||||
*/
|
||||
getArea: function() {
|
||||
var area = 0.0;
|
||||
@@ -51,6 +58,9 @@ OpenLayers.Geometry.Polygon.prototype =
|
||||
return area;
|
||||
},
|
||||
|
||||
/** @final @type String */
|
||||
/**
|
||||
* Constant: CLASS_NAME
|
||||
* {String} Name of class.
|
||||
*/
|
||||
CLASS_NAME: "OpenLayers.Geometry.Polygon"
|
||||
});
|
||||
|
||||
@@ -3,35 +3,50 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* A Rectangle is a simple geometry. It is specified by a a point (x and y)
|
||||
* and dimensions (width and height), all of which are directly accessible as
|
||||
* properties.
|
||||
*
|
||||
* @requires OpenLayers/Geometry.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Rectangle
|
||||
* A Rectangle is a simple geometry. It is specified by a a point (x and y)
|
||||
* and dimensions (width and height), all of which are directly accessible
|
||||
* as properties.
|
||||
*
|
||||
* Inherits:
|
||||
* - <OpenLayers.Geometry>
|
||||
*/
|
||||
|
||||
OpenLayers.Geometry.Rectangle = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Rectangle.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry, {
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* Property: x
|
||||
* {Float}
|
||||
*/
|
||||
x: null,
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* Property: y
|
||||
* {Float}
|
||||
*/
|
||||
y: null,
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* Property: width
|
||||
* {Float}
|
||||
*/
|
||||
width: null,
|
||||
|
||||
/** @type float */
|
||||
/**
|
||||
* Property: height
|
||||
* {Float}
|
||||
*/
|
||||
height: null,
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*
|
||||
* @param {array} points
|
||||
* Constructor: OpenLayers.Geometry.Rectangle
|
||||
*
|
||||
* Parameters:
|
||||
* points - {Array(<OpenLayers.Geometry.Point>}
|
||||
*/
|
||||
initialize: function(x, y, width, height) {
|
||||
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
||||
@@ -44,7 +59,8 @@ OpenLayers.Geometry.Rectangle.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
*
|
||||
* Method: calculateBounds
|
||||
* Recalculate the bounds for the geometry.
|
||||
*/
|
||||
calculateBounds: function() {
|
||||
this.bounds = new OpenLayers.Bounds(this.x, this.y,
|
||||
@@ -54,8 +70,10 @@ OpenLayers.Geometry.Rectangle.prototype =
|
||||
|
||||
|
||||
/**
|
||||
* @returns The length of the geometry
|
||||
* @type float
|
||||
* APIMethod: getLength
|
||||
*
|
||||
* Return:
|
||||
* {Float} The length of the geometry
|
||||
*/
|
||||
getLength: function() {
|
||||
var length = (2 * this.width) + (2 * this.height);
|
||||
@@ -63,8 +81,10 @@ OpenLayers.Geometry.Rectangle.prototype =
|
||||
},
|
||||
|
||||
/**
|
||||
* @returns The area of the geometry
|
||||
* @type float
|
||||
* APIMethod: getArea
|
||||
*
|
||||
* Return:
|
||||
* {Float} The area of the geometry
|
||||
*/
|
||||
getArea: function() {
|
||||
var area = this.width * this.height;
|
||||
|
||||
@@ -3,23 +3,22 @@
|
||||
* for the full text of the license. */
|
||||
|
||||
/**
|
||||
* @class
|
||||
*
|
||||
* @requires OpenLayers/Geometry.js
|
||||
*
|
||||
* Class: OpenLayers.Geometry.Surface
|
||||
*/
|
||||
OpenLayers.Geometry.Surface = OpenLayers.Class.create();
|
||||
OpenLayers.Geometry.Surface.prototype =
|
||||
OpenLayers.Class.inherit(OpenLayers.Geometry, {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* Constructor: OpenLayers.Geometry.Surface
|
||||
*
|
||||
*/
|
||||
initialize: function() {
|
||||
OpenLayers.Geometry.prototype.initialize.apply(this, arguments);
|
||||
},
|
||||
|
||||
|
||||
/** @final @type String */
|
||||
CLASS_NAME: "OpenLayers.Geometry.Surface"
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user