This class instances represent rectangles limiting a map.
bounds = new EMAPI.Bounds(); bounds.extend(new EMAPI.LonLat(4,5)); bounds.extend(new EMAPI.LonLat(5,6)); bounds.toBBOX(); // returns 4,5,5,6
EMAPI. | This class instances represent rectangles limiting a map. |
Properties | |
left | {Float} Smaller horizontal coordinate. |
bottom | {Float} Smaller vertical coordinate. |
right | {Float} Bigger horizontal coordinate. |
top | {Float} Bigger vertical coordinate. |
Functions | |
EMAPI. | Constructs a new object of EMAPI.Bounds class. |
clone | Creates a copy of a rectangle. |
equals | Compares two rectangles, the current one with the one passed in a parameter. |
toString | Returns the rectangle coordinates in a text form. |
toArray | Returns the rectangle’s coordinates as an array. |
toBBOX | Returns the rectangle coordinates in the simplified text form. |
getWidth | Returns the width of the rectangle. |
getHeight | Returns the height of the rectangle. |
getSize | Returns the size of the rectangle. |
getCenterPixel | Returns the screen center of the rectangle. |
getCenterLonLat | Returns the geographical point of the rectangle. |
add | Creates a copy of the rectangle with the shifted coordinates. |
extend | Extends the rectangle if it’s necessary to contain chosen point or another rectangle. |
containsLonLat | Checks whether a geographic point is contained in a rectangle. |
containsPixel | Checks whether a screen point is contained in the rectangle. |
contains | Checks whether a point with the given coordinates is contained in the rectangle. |
intersectsBounds | Checks whether any other rectangle has any part common with current rectangle. |
containsBounds | Checks whether another rectangle is contained in the rectangle. |
determineQuadrant | Determines in which part of a rectangle a geographical point is located. |
fromString | An alternative method constructing EMAPI.Bounds class objects basing on coordinates in a text form. |
fromArray | An alternative method constructing EMAPI.Bounds class objects basing on coordinates array. |
fromSize | An alternative method constructing EMAPI.Bounds> class objects basing on EMAPI.Size object. |
clone:function()
Creates a copy of a rectangle.
{EMAPI.Bounds} New EMAPI.Bounds object with the same coordinates.
equals:function( bounds )
Compares two rectangles, the current one with the one passed in a parameter.
bounds | {EMAPI.Bounds} A rectangle to compare with the current. |
{Boolean} The information if the rectangles are the same.
getSize:function()
Returns the size of the rectangle.
{EMAPI.Size} Size of a rectangle in a form of EMAPI.Size class object.
getCenterPixel:function()
Returns the screen center of the rectangle.
{EMAPI.Pixel} Screen center point of the rectangle.
getCenterLonLat:function()
Returns the geographical point of the rectangle.
{EMAPI.LonLat} The geographic midpoint of the rectangle.
add:function( x, y )
Creates a copy of the rectangle with the shifted coordinates.
x | {Float} Horizontal shift. Parameters: |
y | {Float} Vertical shift. |
{EMAPI.Bounds} New shifted EMAPI.Bounds object.
extend:function( object )
Extends the rectangle if it’s necessary to contain chosen point or another rectangle.
object | {EMAPI.LonLat or EMAPI.Bounds} Object must be contained in the new rectangle. |
containsLonLat:function( ll, inclusive )
Checks whether a geographic point is contained in a rectangle.
ll | {EMAPI.LonLat} The geographical point. |
inclusive | {Boolean} Information if take into consideration the edge of the rectangle (by default true). |
{Boolean} Information about including the point into the rectangle.
containsPixel:function( px, inclusive )
Checks whether a screen point is contained in the rectangle.
px | {EMAPI.Pixel} The screen point. |
inclusive | {Boolean} Information if take into consideration the edge of the rectangle (by default true). |
{Boolean} Information about including the point into the rectangle.
contains:function( x, y, inclusive )
Checks whether a point with the given coordinates is contained in the rectangle.
x | {Float} Coordinate x. |
y | {Float} Coordinate y. |
inclusive | {Boolean} Information if take into consideration the edge of the rectangle (by default true). |
{Boolean} Information about including the point into the rectangle.
intersectsBounds:function( bounds, inclusive )
Checks whether any other rectangle has any part common with current rectangle.
bounds | {EMAPI.Bounds} The rectangle’s data checked. |
inclusive | {Boolean} Information if take into consideration the edge of the rectangle (by default true). |
{Boolean} Information about overlapping of rectangles.
containsBounds:function( bounds, partial, inclusive )
Checks whether another rectangle is contained in the rectangle.
bounds | {EMAPI.Bounds} The rectangle’s data checked. |
partial | {Boolean} Information if a whole rectangle must be contained in a chosen rectangle or only a part of it (by default false). |
inclusive | {Boolean} Information if take into consideration the edge of the rectangle (by default true). |
{Boolean} Information about including of rectangles.
determineQuadrant: function( lonlat )
Determines in which part of a rectangle a geographical point is located.
lonlat | {EMAPI.LonLat} The geographical point. |
{String} The part of the rectangle (“br”, “tr”, “tl”, “bl”), where the point contains.
E.Bounds.fromString = function( str )
An alternative method constructing EMAPI.Bounds class objects basing on coordinates in a text form.
str | {String} The rectangle’s coordinate values separated by a comma (i.a. “5,42,10,45”). |
{EMAPI.Bounds} The new EMAPI.Bounds object based on the string that is passed in the parameter.
E.Bounds.fromArray = function( bbox )
An alternative method constructing EMAPI.Bounds class objects basing on coordinates array.
bbox | {Array(Float)} The rectangle’s array coordinates (i.a. [5,42,10,45]). |
{EMAPI.Bounds} Constructed a new EMAPI.Bounds object based on an array in parameter.
E.Bounds.fromSize = function( size )
An alternative method constructing EMAPI.Bounds> class objects basing on EMAPI.Size object.
size | {EMAPI.Size} EMAPI.Size object to create a rectangle. |
{EMAPI.Bounds} Constructed a new EMAPI.Bounds object based on EMAPI.Size parameter.
Creates a copy of a rectangle.
clone:function()
Compares two rectangles, the current one with the one passed in a parameter.
equals:function( bounds )
Returns the rectangle coordinates in a text form.
toString:function()
Returns the rectangle’s coordinates as an array.
toArray: function()
Returns the rectangle coordinates in the simplified text form.
toBBOX:function( decimal )
Returns the width of the rectangle.
getWidth:function()
Returns the height of the rectangle.
getHeight:function()
Returns the size of the rectangle.
getSize:function()
Returns the screen center of the rectangle.
getCenterPixel:function()
Returns the geographical point of the rectangle.
getCenterLonLat:function()
Creates a copy of the rectangle with the shifted coordinates.
add:function( x, y )
Extends the rectangle if it’s necessary to contain chosen point or another rectangle.
extend:function( object )
Checks whether a geographic point is contained in a rectangle.
containsLonLat:function( ll, inclusive )
Checks whether a screen point is contained in the rectangle.
containsPixel:function( px, inclusive )
Checks whether a point with the given coordinates is contained in the rectangle.
contains:function( x, y, inclusive )
Checks whether any other rectangle has any part common with current rectangle.
intersectsBounds:function( bounds, inclusive )
Checks whether another rectangle is contained in the rectangle.
containsBounds:function( bounds, partial, inclusive )
Determines in which part of a rectangle a geographical point is located.
determineQuadrant: function( lonlat )
An alternative method constructing EMAPI.Bounds class objects basing on coordinates in a text form.
E.Bounds.fromString = function( str )
An alternative method constructing EMAPI.Bounds class objects basing on coordinates array.
E.Bounds.fromArray = function( bbox )
An alternative method constructing EMAPI.Bounds> class objects basing on EMAPI.Size object.
E.Bounds.fromSize = function( size )