A Geometry is a description of a geographic object. Create an instance of this class with the OpenLayers.Geometry constructor. This is a base class, typical geometry types are described by subclasses of this class.
OpenLayers. Geometry | A Geometry is a description of a geographic object. |
Properties | |
id | {String} A unique identifier for this geometry. |
parent | {OpenLayers.Geometry}This is set when a Geometry is added as component of another geometry |
bounds | {OpenLayers.Bounds} The bounds of this geometry |
Constructor | |
OpenLayers. Geometry | Creates a geometry object. |
Functions | |
destroy | Destroy this geometry. |
clone | Create a clone of this geometry. |
clearBounds | Nullify this components bounds and that of its parent as well. |
extendBounds | Extend the existing bounds to include the new bounds. |
getBounds | Get the bounds for this Geometry. |
calculateBounds | Recalculate the bounds for the geometry. |
atPoint | |
getLength | Calculate the length of this geometry. |
getArea | Calculate the area of this geometry. |
toString | Returns the Well-Known Text representation of a geometry |
OpenLayers. Geometry. segmentsIntersect | Determine whether two line segments intersect. |
{OpenLayers.Geometry}This is set when a Geometry is added as component of another geometry
{OpenLayers.Bounds} The bounds of this geometry
clone: function()
Create a clone of this geometry. Does not set any non-standard properties of the cloned geometry.
{OpenLayers.Geometry} An exact clone of this geometry.
extendBounds: function( newBounds )
Extend the existing bounds to include the new bounds. If geometry’s bounds is not yet set, then set a new Bounds.
newBounds | {OpenLayers.Bounds} |
atPoint: function( lonlat, toleranceLon, toleranceLat )
Note | This is only an approximation based on the bounds of the geometry. |
lonlat | {OpenLayers.LonLat} |
toleranceLon | {float} Optional tolerance in Geometric Coords |
toleranceLat | {float} Optional tolerance in Geographic Coords |
{Boolean} Whether or not the geometry is at the specified location
OpenLayers.Geometry.segmentsIntersect = function( seg1, seg2, point )
Determine whether two line segments intersect. Optionally calculates and returns the intersection point. This function is optimized for cases where seg1.x2 >= seg2.x1 || seg2.x2 >= seg1.x1. In those obvious cases where there is no intersection, the function should not be called.
seg1 | {Object} Object representing a segment with properties x1, y1, x2, and y2. The start point is represented by x1 and y1. The end point is represented by x2 and y2. Start and end are ordered so that x1 < x2. |
seg2 | {Object} Object representing a segment with properties x1, y1, x2, and y2. The start point is represented by x1 and y1. The end point is represented by x2 and y2. Start and end are ordered so that x1 < x2. |
point | {Boolean} Return the intersection point. If false, the actual intersection point will not be calculated. If true and the segments intersect, the intersection point will be returned. If true and the segments do not intersect, false will be returned. If true and the segments are coincident, true will be returned. |
{Boolean | OpenLayers.Geometry.Point} The two segments intersect. If the point argument is true, the return will be the intersection point or false if none exists. If point is true and the segments are coincident, return will be true (and the instersection is equal to the shorter segment).
Destroy this geometry.
destroy: function()
Create a clone of this geometry.
clone: function()
Nullify this components bounds and that of its parent as well.
clearBounds: function()
Extend the existing bounds to include the new bounds.
extendBounds: function( newBounds )
Get the bounds for this Geometry.
getBounds: function()
Recalculate the bounds for the geometry.
calculateBounds: function()
atPoint: function( lonlat, toleranceLon, toleranceLat )
Calculate the length of this geometry.
getLength: function()
Calculate the area of this geometry.
getArea: function()
Returns the Well-Known Text representation of a geometry
toString: function()
Determine whether two line segments intersect.
OpenLayers.Geometry.segmentsIntersect = function( seg1, seg2, point )