Class Index | File Index

Classes


Class eniro.maps.Bounds


Defined in: Bounds.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Represents a rectangle in geographical coordinates (or pixels).
Method Summary
Method Attributes Method Name and Description
 
contains(other)
Tests if the given eniro.maps.Point or eniro.maps.Bounds is within the rectangle of this bounds.
 
equals(other, exact)
Returns true if this bounds equals the given bounds.
 
exactEquals(other)
Compare this instance with another instance.
 
extend(coord)
Returns an extended bounds that contains the given point.
 
Calculates the center of the current bounds.
 
Returns the north east corner of this bounds.
 
Returns the spatial reference system used in the coordinates of this bounds.
 
Returns the south west corner of this bounds.
 
intersects(other)
Returns true if this bounds shares any points with the given bounds.
 
Returns true is this bounds are empty, that is the south west point is the same as the north east.
 
Returns a eniro.maps.Size with the difference of north east och south west.
 
toUrlValue(precision, coordReverse)
Turns this bounds into a URL bounds value on the form sw.x,sw.y,ne.x,ne.y.
 
transform(srs)
Transforms this bounds to the given spatial reference system.
 
Extends this bounds to include the given bounds.
Class Detail
eniro.maps.Bounds(sw, ne)
Represents a rectangle in geographical coordinates (or pixels). The rectangle is made up out of a south west and a north east corner.

Class is considered a value type. This class does not currently handle bounds that span the 180 degree longitudal meridian line.

Parameters:
{eniro.maps.Point} sw
The south west corner.
{eniro.maps.Point} ne
The north east corner.
Throws:
Error if the eniro.maps.Srs of the two corners don't match.
Method Detail
{boolean} contains(other)
Tests if the given eniro.maps.Point or eniro.maps.Bounds is within the rectangle of this bounds.
Parameters:
{eniro.maps.Point|eniro.maps.Bounds} other
The point or bounds to test against these bounds.
Returns:
{boolean} true if the point/bound is within the bounds.

equals(other, exact)
Returns true if this bounds equals the given bounds. There's an optional switch to make the comparison exact.

This method defaults to inexact comparison to match Google's API.

Parameters:
{eniro.maps.Bounds} other
The bounds to compare this one to.
{boolean} exact Optional, Default: false
Set to true if the comparison is the be made done exactly.
Returns:
true if the bounds are exactly equals or approximately equal using the #exactEquals or eniro.maps.Coordinate#approxEquals method with the default tolerance.

{boolean} exactEquals(other)
Compare this instance with another instance.
Parameters:
{eniro.maps.Bounds} other
The instance to compare this instance to.
Returns:
{boolean} true If this instance is equal to the given one.

{eniro.maps.Bounds} extend(coord)
Returns an extended bounds that contains the given point.
Parameters:
{eniro.maps.Point} coord
The point to extend the bounds by.
Returns:
{eniro.maps.Bounds} A new instance that is extended to contain the point given.

{eniro.maps.Coordinate} getCenter()
Calculates the center of the current bounds.
Returns:
{eniro.maps.Coordinate} The calculated center of the rectangle represented by the bounds.

{eniro.maps.Coordinate} getNe()
Returns the north east corner of this bounds.
Returns:
{eniro.maps.Coordinate} The north east corner.

{eniro.maps.Srs} getSrs()
Returns the spatial reference system used in the coordinates of this bounds.
Returns:
{eniro.maps.Srs} The spatial reference system in use.

{eniro.maps.Coordinate} getSw()
Returns the south west corner of this bounds.
Returns:
{eniro.maps.Coordinate} The south west corner.

{boolean} intersects(other)
Returns true if this bounds shares any points with the given bounds.
Parameters:
{eniro.maps.Bounds} other
The bounds to compare this bounds to.
Returns:
{boolean} true if this bounds intersects the given bounds.

isEmpty()
Returns true is this bounds are empty, that is the south west point is the same as the north east.
Returns:
True if this bounds are empty.

{eniro.maps.Size} toSpan()
Returns a eniro.maps.Size with the difference of north east och south west.
Returns:
{eniro.maps.Size} with the span of the bounds.

{string} toUrlValue(precision, coordReverse)
Turns this bounds into a URL bounds value on the form sw.x,sw.y,ne.x,ne.y.
Parameters:
{number} precision Optional, Default: 6
The number of decimals to use in each value, default is 6.
{boolean} coordReverse Optional, Default: false
If we are to reverse the x,y to be y,x default is false.
Returns:
{string} the bounds, ready to be used in a URL.

{eniro.maps.Bounds} transform(srs)
Transforms this bounds to the given spatial reference system.
Parameters:
{eniro.maps.Srs} srs
Target spatial reference system.
Returns:
{eniro.maps.Bounds} If the given spatial reference system differs from this bounds one, a new transformed instance is returned, otherwise returns this.

union()
Extends this bounds to include the given bounds.
Parameters:
{eniro.maps.Bounds}

Documentation generated by JsDoc Toolkit 2.3.2 on Mon Mar 30 2020 12:10:03 GMT+0200 (CEST)