ALKMaps.Geometry.Point

Point geometry class.

Inherits from

Summary
ALKMaps.Geometry.PointPoint geometry class.
Properties
x{float}
y{float}
Constructor
ALKMaps.Geometry.PointConstruct a point geometry.
Functions
clone{ALKMaps.Geometry.Point} An exact clone of this ALKMaps.Geometry.Point
calculateBoundsCreate a new Bounds based on the lon/lat
distanceToCalculate the closest distance between two geometries (on the x-y plane).
equalsDetermine whether another geometry is equivalent to this one.
toShortString{String} Shortened String representation of Point object.
moveMoves a geometry by the given displacement along positive x and y axes.
rotateRotate a point around another.
getCentroid{ALKMaps.Geometry.Point} The centroid of the collection
resizeResize a point relative to some origin.
intersectsDetermine if the input geometry intersects this one.
transformTranslate the x,y properties of the point from source to dest.
getVerticesReturn a list of all points in this geometry.
transformArrayPerform transform function on an array of ALKMaps.Geometry.Point objects

Properties

x

{float}

y

{float}

Constructor

ALKMaps.Geometry.Point

Construct a point geometry.

Parameters

x{float}
y{float}

Functions

clone

clone: function(obj)

Returns

{ALKMaps.Geometry.Point} An exact clone of this ALKMaps.Geometry.Point

calculateBounds

calculateBounds: function ()

Create a new Bounds based on the lon/lat

distanceTo

distanceTo: function(geometry,
options)

Calculate the closest distance between two geometries (on the x-y plane).

Parameters

geometry{ALKMaps.Geometry} The target geometry.
options{Object} Optional properties for configuring the distance calculation.

Valid options

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.

Returns

{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

equals: function(geom)

Determine whether another geometry is equivalent to this one.  Geometries are considered equivalent if all components have the same coordinates.

Parameters

geom{ALKMaps.Geometry.Point} The geometry to test.

Returns

{Boolean} The supplied geometry is equivalent to this geometry.

toShortString

toShortString: function()

Returns

{String} Shortened String representation of Point object.  (ex.  <i>”5, 42”</i>)

move

move: function(x,
y)

Moves a geometry by the given displacement along positive x and y axes.  This modifies the position of the geometry and clears the cached bounds.

Parameters

x{Float} Distance to move geometry in positive x direction.
y{Float} Distance to move geometry in positive y direction.

rotate

rotate: function(angle,
origin)

Rotate a point around another.

Parameters

angle{Float} Rotation angle in degrees (measured counterclockwise from the positive x-axis)
origin{ALKMaps.Geometry.Point} Center point for the rotation

getCentroid

getCentroid: function()

Returns

{ALKMaps.Geometry.Point} The centroid of the collection

resize

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.

Parameters

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.

Returns

{<ALKMaps.Geometry>}The current geometry.

intersects

intersects: function(geometry)

Determine if the input geometry intersects this one.

Parameters

geometry{ALKMaps.Geometry} Any type of geometry.

Returns

{Boolean} The input geometry intersects this one.

transform

transform: function(source,
dest)

Translate the x,y properties of the point from source to dest.

Parameters

source{ALKMaps.Projection}
dest{ALKMaps.Projection}

Returns

{ALKMaps.Geometry}

getVertices

getVertices: function(nodes)

Return a list of all points in this geometry.

Parameters

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.

Returns

{Array} A list of all vertices in the geometry.

transformArray

ALKMaps.Geometry.Point.transformArray = function (array,
source,
dest)

Perform transform function on an array of ALKMaps.Geometry.Point objects

Parameters

array{Array<ALKMaps.Geometry.Point>}
source{ALKMaps.Projection}
dest{ALKMaps.Projection}

Returns

{Array} Array of ALKMaps.Geometry.Point objects in the projection specified by the dest parameter.

clone: function(obj)
{ALKMaps.Geometry.Point} An exact clone of this ALKMaps.Geometry.Point
Construct a point geometry.
calculateBounds: function ()
Create a new Bounds based on the lon/lat
distanceTo: function(geometry,
options)
Calculate the closest distance between two geometries (on the x-y plane).
equals: function(geom)
Determine whether another geometry is equivalent to this one.
toShortString: function()
{String} Shortened String representation of Point object.
move: function(x,
y)
Moves a geometry by the given displacement along positive x and y axes.
rotate: function(angle,
origin)
Rotate a point around another.
getCentroid: function()
{ALKMaps.Geometry.Point} The centroid of the collection
resize: function(scale,
origin,
ratio)
Resize a point relative to some origin.
intersects: function(geometry)
Determine if the input geometry intersects this one.
transform: function(source,
dest)
Translate the x,y properties of the point from source to dest.
getVertices: function(nodes)
Return a list of all points in this geometry.
ALKMaps.Geometry.Point.transformArray = function (array,
source,
dest)
Perform transform function on an array of ALKMaps.Geometry.Point objects
A Geometry is a description of a geographic object.
Methods for coordinate transforms between coordinate systems.
Close