| Package | com.afcomponents.umap.types |
| Class | public class LatLngBounds |
This class can also be used to create a rectangle that crosses the 180 degrees meridian. Rectangle is created using south-west (top-left) and north-east (bottom-right) corners. These coreners should be specified as LatLng objects.
Here is a quick usage example:
import com.afcomponents.umap.types.LatLngBounds;
import com.afcomponents.umap.types.LatLng;
var sw:LatLng = new LatLng(-30, -50);
var ne:LatLng = new LatLng(14, 12);
var bounds:LatLngBounds = new LatLngBounds(sw, ne);
trace("bounds " + bounds);
// traces bounds (south-west=(lat=-30.000000, lng=-50.000000), north-east=(lat=14.000000, lng=12.000000))
var point:LatLng = new LatLng(0, 10);
trace("bounds contain " + point + " " + bounds.containsLatLng(point));
// traces bounds contain (lat=0.000000, lng=10.000000) true
point = new LatLng(-31, 0);
trace("bounds contain " + point + " " + bounds.containsLatLng(point));
// traces bounds contain (lat=-31.000000, lng=0.000000) false| Property | Defined by | ||
|---|---|---|---|
| height : Number [read-only]
The height of the rectangle.
| LatLngBounds | ||
| northEast : LatLng
Gets or sets coordinates of the north-east (bottom-right) corner.
| LatLngBounds | ||
| southWest : LatLng
Gets or sets coordinates of the south-west (top-left) corner.
| LatLngBounds | ||
| width : Number [read-only]
The width of the rectangle.
| LatLngBounds | ||
| Method | Defined by | ||
|---|---|---|---|
|
LatLngBounds constructor.
| LatLngBounds | ||
|
addBounds(bounds:LatLngBounds):Boolean
Extends current bounding rectangle with the specified bounds.
| LatLngBounds | ||
|
Extends current bounding rectangle with the specified point.
| LatLngBounds | ||
|
Creates a copy of this LatLngBounds object.
| LatLngBounds | ||
|
containsBounds(bounds:LatLngBounds):Boolean
Checks whether given rectangle lies within this rectangle.
| LatLngBounds | ||
|
containsLatLng(latlng:LatLng):Boolean
Checks whether given point lies within this rectangle.
| LatLngBounds | ||
|
equals(other:LatLngBounds):Boolean
Determines whether two rectangles are equal.
| LatLngBounds | ||
|
fromXML(xml:XML):LatLngBounds
[static]
Creates new LatLngBounds from XML object in KML 2.1 format.
| LatLngBounds | ||
|
getTypeFromXML(xml:XML):LatLngBounds
[static]
Returns new object, which will be constructed from the source XML data.
| LatLngBounds | ||
|
getXMLFromType(bounds:LatLngBounds, name:String):XML
[static]
Returns XML data that describes the Object.
| LatLngBounds | ||
|
intersects(bounds:LatLngBounds):Boolean
Checks whether given rectangle intersects with this rectangle.
| LatLngBounds | ||
|
isValid():Boolean
Validates the rectangle.
| LatLngBounds | ||
|
Limits a point by the boundaries of this rectangle.
| LatLngBounds | ||
|
toLatLngArray(closed:Boolean = false):Array
Returns an
Array with corner points of the rectangle in geographical coordinates. | LatLngBounds | ||
|
toString():String
Returns a
String that represents the coordinates of the rectangle's corners. | LatLngBounds | ||
|
toXML(name:String = "LatLonBox"):XML
Builds an XML object in KML 2.1 format that describes this Object.
| LatLngBounds | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_NODE_NAME : String = "latlngBounds" [static]
Defines default root node name for XML conversion.
| LatLngBounds | ||
| height | property |
height:Number [read-only]The height of the rectangle. If target rectangle is invalid, height equals Number.NaN
Implementation public function get height():Number
See also
| northEast | property |
northEast:LatLng [read-write]Gets or sets coordinates of the north-east (bottom-right) corner.
Implementation public function get northEast():LatLng
public function set northEast(value:LatLng):void
| southWest | property |
southWest:LatLng [read-write]Gets or sets coordinates of the south-west (top-left) corner.
Implementation public function get southWest():LatLng
public function set southWest(value:LatLng):void
| width | property |
width:Number [read-only]The width of the rectangle. If target rectangle is invalid, width equals Number.NaN
Implementation public function get width():Number
See also
| LatLngBounds | () | constructor |
public function LatLngBounds(sw:LatLng, ne:LatLng)LatLngBounds constructor.
Constructs a rectangle from the points at its south-west (top-left) and north-east (bottom-right) corners.
Parameterssw:LatLng — Coordinates of the south-west (top-left) corner.
|
|
ne:LatLng — Coordinates of the north-east (bottom-right) corner.
|
| addBounds | () | method |
public function addBounds(bounds:LatLngBounds):BooleanExtends current bounding rectangle with the specified bounds.
Parametersbounds:LatLngBounds — Bounding rectangle that should be added to the current bounds.
|
Boolean — A value of true if current bounding reactangle has been changed; false if it has not.
|
| addLatLng | () | method |
public function addLatLng(latlng:LatLng):BooleanExtends current bounding rectangle with the specified point.
Parameterslatlng:LatLng — A point that should be added to the current bounds.
|
Boolean — A value of true if current bounding reactangle has been changed; false if it has not.
|
| clone | () | method |
public function clone():LatLngBoundsCreates a copy of this LatLngBounds object.
ReturnsLatLngBounds —
A copy of this object.
|
| containsBounds | () | method |
public function containsBounds(bounds:LatLngBounds):BooleanChecks whether given rectangle lies within this rectangle.
Returns true if given rectangle lies within this rectangle.
Returns false if any point of the given rectangle lies outside of this rectangle,
or if specified rectangle or target rectangle are invalid.
bounds:LatLngBounds — Target bounds object for checking.
|
Boolean — A value of true if given rectangle lies within this rectangle.
|
See also
| containsLatLng | () | method |
public function containsLatLng(latlng:LatLng):BooleanChecks whether given point lies within this rectangle.
Returns true if given point lies within this rectangle.
Returns false if given point lies outside of this rectangle,
or if specified point or target rectangle are invalid.
latlng:LatLng — Target latlng object for checking.
|
Boolean — A value of true if given point lies within this rectangle; false if it is not.
|
See also
| equals | () | method |
public function equals(other:LatLngBounds):BooleanDetermines whether two rectangles are equal.
Two rectangles are equal if all parameters in this rectangle are equal to the parameters of the other.
Parametersother:LatLngBounds — The object to be compared.
|
Boolean — A value of true if object is equal to this Bounds object; false if it is not.
|
| fromXML | () | method |
public static function fromXML(xml:XML):LatLngBoundsCreates new LatLngBounds from XML object in KML 2.1 format.
Parametersxml:XML |
LatLngBounds —
New LatLngBounds object.
|
<LatLonBox xmlns="http://earth.google.com/kml/2.1">
<north>...</north> <! kml:angle90 -->
<south>...</south> <! kml:angle90 -->
<east>...</east> <! kml:angle180 -->
<west>...</west> <! kml:angle180 -->
</LatLonBox>| getTypeFromXML | () | method |
public static function getTypeFromXML(xml:XML):LatLngBoundsReturns new object, which will be constructed from the source XML data.
Parametersxml:XML — Source XML data.
|
LatLngBounds —
Object that was constructed from the source XML data.
|
| getXMLFromType | () | method |
public static function getXMLFromType(bounds:LatLngBounds, name:String):XMLReturns XML data that describes the Object. You can also specify root node name in the second parameter.
Parametersbounds:LatLngBounds — Object that should be converted to XML.
|
|
name:String — Root node name.
|
XML — XML data that describes the properties of the source object.
|
| intersects | () | method |
public function intersects(bounds:LatLngBounds):BooleanChecks whether given rectangle intersects with this rectangle.
Returns true if given rectangle intersects within this rectangle.
Returns false if all points of the given rectangle lie outside of this rectangle,
or if specified rectangle or target rectangle are invalid.
bounds:LatLngBounds — Target bounds object for checking.
|
Boolean — A value of true if given rectangle intersects within this rectangle; false if it is not.
|
See also
| isValid | () | method |
public function isValid():BooleanValidates the rectangle.
Returns true if both south-west and north-east corners are defined.
Returns false if south-west or north-east corners are invalid or have a value of null.
Boolean — A value of true if both south-west and north-east corners are defined; false if they are not.
|
See also
| limitLatLng | () | method |
public function limitLatLng(latlng:LatLng):LatLngLimits a point by the boundaries of this rectangle. Doesn't creates a copy of the given point.
Parameterslatlng:LatLng — Target point to check.
|
LatLng —
If the point has been moved, returns the modified point.
|
See also
| toLatLngArray | () | method |
public function toLatLngArray(closed:Boolean = false):Array
Returns an Array with corner points of the rectangle in geographical coordinates.
closed:Boolean (default = false) — A flag which indicates whether to return a closed shape (true),
with first point repeated twice at the beginning and at the end of the resulting array.
|
Array — An Array with reactangle corner points, or null it the rectangle is invalid.
|
| toString | () | method |
public function toString():String
Returns a String that represents the coordinates of the rectangle's corners.
The output will look like "(south-west=south-west corner, norh-east=north-east corner)"
ReturnsString — A textual representation of the rectangle.
|
| toXML | () | method |
public function toXML(name:String = "LatLonBox"):XMLBuilds an XML object in KML 2.1 format that describes this Object.
Parametersname:String (default = "LatLonBox") |
XML — XML object in KML 2.1 format.
|
<LatLonBox xmlns="http://earth.google.com/kml/2.1">
<north>...</north> <! kml:angle90 -->
<south>...</south> <! kml:angle90 -->
<east>...</east> <! kml:angle180 -->
<west>...</west> <! kml:angle180 -->
</LatLonBox>| DEFAULT_NODE_NAME | constant |
public static const DEFAULT_NODE_NAME:String = "latlngBounds"Defines default root node name for XML conversion.