Point geometry class.
ALKMaps. | Point geometry class. |
Properties | |
x | {float} |
y | {float} |
Constructor | |
ALKMaps. | Construct a point geometry. |
Functions | |
clone | {ALKMaps.Geometry.Point} An exact clone of this ALKMaps.Geometry.Point |
calculateBounds | Create a new Bounds based on the lon/lat |
distanceTo | Calculate the closest distance between two geometries (on the x-y plane). |
equals | Determine whether another geometry is equivalent to this one. |
toShortString | {String} Shortened String representation of Point object. |
move | Moves a geometry by the given displacement along positive x and y axes. |
rotate | Rotate a point around another. |
getCentroid | {ALKMaps.Geometry.Point} The centroid of the collection |
resize | Resize a point relative to some origin. |
intersects | Determine if the input geometry intersects this one. |
transform | Translate the x,y properties of the point from source to dest. |
getVertices | Return a list of all points in this geometry. |
transformArray | Perform transform function on an array of ALKMaps.Geometry.Point objects |
distanceTo: function( geometry, options )
Calculate the closest distance between two geometries (on the x-y plane).
geometry | {ALKMaps.Geometry} The target geometry. |
options | {Object} Optional properties for configuring the distance calculation. |
details | {Boolean} Return details from the distance calculation. Default is false. |
edge | {Boolean} Calculate the distance from this geometry to the nearest edge of the target geometry. Default is true. If true, calling distanceTo from a geometry that is wholly contained within the target will result in a non-zero distance. If false, whenever geometries intersect, calling distanceTo will return 0. If false, details cannot be returned. |
{Number | Object} The distance between this geometry and the target. If details is true, the return will be an object with distance, x0, y0, x1, and x2 properties. The x0 and y0 properties represent the coordinates of the closest point on this geometry. The x1 and y1 properties represent the coordinates of the closest point on the target geometry.
equals: function( geom )
Determine whether another geometry is equivalent to this one. Geometries are considered equivalent if all components have the same coordinates.
geom | {ALKMaps.Geometry.Point} The geometry to test. |
{Boolean} The supplied geometry is equivalent to this geometry.
rotate: function( angle, origin )
Rotate a point around another.
angle | {Float} Rotation angle in degrees (measured counterclockwise from the positive x-axis) |
origin | {ALKMaps.Geometry.Point} Center point for the rotation |
resize: function( scale, origin, ratio )
Resize a point relative to some origin. For points, this has the effect of scaling a vector (from the origin to the point). This method is more useful on geometry collection subclasses.
scale | {Float} Ratio of the new distance from the origin to the old distance from the origin. A scale of 2 doubles the distance between the point and origin. |
origin | {ALKMaps.Geometry.Point} Point of origin for resizing |
ratio | {Float} Optional x:y ratio for resizing. Default ratio is 1. |
{<ALKMaps.Geometry>} | The current geometry. |
intersects: function( geometry )
Determine if the input geometry intersects this one.
geometry | {ALKMaps.Geometry} Any type of geometry. |
{Boolean} The input geometry intersects this one.
transform: function( source, dest )
Translate the x,y properties of the point from source to dest.
source | {ALKMaps.Projection} |
dest | {ALKMaps.Projection} |
getVertices: function( nodes )
Return a list of all points in this geometry.
nodes | {Boolean} For lines, only return vertices that are endpoints. If false, for lines, only vertices that are not endpoints will be returned. If not provided, all vertices will be returned. |
{Array} A list of all vertices in the geometry.
ALKMaps.Geometry.Point.transformArray = function ( array, source, dest )
Perform transform function on an array of ALKMaps.Geometry.Point objects
array | {Array<ALKMaps.Geometry.Point>} |
source | {ALKMaps.Projection} |
dest | {ALKMaps.Projection} |
{Array} Array of ALKMaps.Geometry.Point objects in the projection specified by the dest parameter.
{ALKMaps.Geometry.Point} An exact clone of this ALKMaps.Geometry.Point
clone: function( obj )
Create a new Bounds based on the lon/lat
calculateBounds: function ()
Calculate the closest distance between two geometries (on the x-y plane).
distanceTo: function( geometry, options )
Determine whether another geometry is equivalent to this one.
equals: function( geom )
{String} Shortened String representation of Point object.
toShortString: function()
Moves a geometry by the given displacement along positive x and y axes.
move: function( x, y )
Rotate a point around another.
rotate: function( angle, origin )
{ALKMaps.Geometry.Point} The centroid of the collection
getCentroid: function()
Resize a point relative to some origin.
resize: function( scale, origin, ratio )
Determine if the input geometry intersects this one.
intersects: function( geometry )
Translate the x,y properties of the point from source to dest.
transform: function( source, dest )
Return a list of all points in this geometry.
getVertices: function( nodes )
Perform transform function on an array of ALKMaps.Geometry.Point objects
ALKMaps.Geometry.Point.transformArray = function ( array, source, dest )