Class geo.Path
Defined in: extensions.js.
Constructor Attributes | Constructor Name and Description |
---|---|
geo.Path(path)
Creates a new path from the given parameters.
|
Method Attributes | Method Name and Description |
---|---|
append(coord)
Appends the given coordinate to the path.
|
|
area()
Returns the approximate area of the polygon formed by the path when the path
is closed.
|
|
bounds()
Returns the latitude/longitude bounds wholly containing this path.
|
|
containsPoint(point)
Returns whether or not the path, when closed, contains the given point.
|
|
coord(index)
Returns the coordinate at the given index in the path.
|
|
distance()
Calculates the total length of the path using great circle distance
calculations.
|
|
equals(otherPath)
Determines whether or not the given path is the same as this one.
|
|
insert(index, coord)
Inserts the given coordinate at the i'th index in the path.
|
|
Returns whether or not the coordinates of the polygon formed by the path when
the path is closed are in counter clockwise order.
|
|
Returns the number of coords in the path.
|
|
prepend(coord)
Prepends the given coordinate to the path.
|
|
remove(index)
Removes the coordinate at the i'th index from the path.
|
|
reverse()
Reverses the order of the path's coordinates.
|
|
subPath(startIndex, endIndex)
Returns a sub path, containing coordinates starting from the
startIndex position, and up to but not including the endIndex
position.
|
|
toString()
Returns the string representation of the path.
|
Method Detail
append(coord)
Appends the given coordinate to the path.
- Parameters:
- {geo.Point|PointSrc} coord
- The coordinate to append.
{Number}
area()
Returns the approximate area of the polygon formed by the path when the path
is closed.
- Returns:
- {Number} The approximate area, in square meters.
- See:
- http://econym.org.uk/gmap/epoly.htm
{geo.Bounds}
bounds()
Returns the latitude/longitude bounds wholly containing this path.
containsPoint(point)
Returns whether or not the path, when closed, contains the given point.
Thanks to Mike Williams of http://econym.googlepages.com/epoly.htm and
http://alienryderflex.com/polygon/ for this code.
- Parameters:
- {geo.Point} point
- The point to test.
{geo.Point}
coord(index)
Returns the coordinate at the given index in the path.
- Parameters:
- {Number} index
- The index of the coordinate.
{Number}
distance()
Calculates the total length of the path using great circle distance
calculations.
- Returns:
- {Number} The total length of the path, in meters.
{Boolean}
equals(otherPath)
Determines whether or not the given path is the same as this one.
- Parameters:
- {geo.Path} otherPath
- The other path.
insert(index, coord)
Inserts the given coordinate at the i'th index in the path.
- Parameters:
- {Number} index
- The index to insert into.
- {geo.Point|PointSrc} coord
- The coordinate to insert.
{Boolean}
isCounterClockwise_()
Returns whether or not the coordinates of the polygon formed by the path when
the path is closed are in counter clockwise order.
numCoords()
Returns the number of coords in the path.
prepend(coord)
Prepends the given coordinate to the path.
- Parameters:
- {geo.Point|PointSrc} coord
- The coordinate to prepend.
remove(index)
Removes the coordinate at the i'th index from the path.
- Parameters:
- {Number} index
- The index of the coordinate to remove.
reverse()
Reverses the order of the path's coordinates.
{geo.Path}
subPath(startIndex, endIndex)
Returns a sub path, containing coordinates starting from the
startIndex position, and up to but not including the endIndex
position.
- Parameters:
- startIndex
- endIndex
{String}
toString()
Returns the string representation of the path.