| Package | com.afcomponents.umap.types |
| Class | public class LatLng |
Notice that although usual map projections associate longitude with the x-coordinate of the map, and latitude with the y-coordinate, the latitude cooridnate is always written first, followed by the longitude, as it is custom in cartography.
The following code creates a LatLng object at (0,0):import com.afcomponents.umap.types.LatLng; var latlng:LatLng = new LatLng(); trace(latlng); // traces (lat=0, lng=0);
import com.afcomponents.umap.types.LatLng;
var latlng:LatLng = new LatLng(93,215);
trace("original " + latlng); // traces original (lat=93.000000, lng=215.000000)
latlng.unbounded = false;
trace("bounded " + latlng); // traces bounded (lat=90.000000, lng=-145.000000)
latlng.unbounded = true;
trace("unbounded " + latlng); // traces unbounded (lat=93.000000, lng=215.000000)| Property | Defined by | ||
|---|---|---|---|
| lat : Number
Gets or sets the point's latitude.
| LatLng | ||
| latRadians : Number [read-only]
Returns the latitude coordinate in radians, as a number between -PI/2 and +PI/2.
| LatLng | ||
| lng : Number
Gets or sets the point's longitude.
| LatLng | ||
| lngRadians : Number [read-only]
Returns the longitude coordinate in radians, as a number between -PI and +PI.
| LatLng | ||
| unbounded : Boolean
Gets or sets the unbounded flag.
| LatLng | ||
| Method | Defined by | ||
|---|---|---|---|
|
LatLng(lat:Number = 0, lng:Number = 0, unbounded:Boolean = true)
Point's constructor.
| LatLng | ||
|
Creates a copy of this LatLng object.
| LatLng | ||
|
Compares this point with the other.
| LatLng | ||
|
fromSexagecimal(string:String):LatLng
[static]
Returns a LatLng point from sexagecimal string.
| LatLng | ||
|
[static]
Creates new LatLng from XML object in KML 2.1 format.
| LatLng | ||
|
getTypeFromXML(xml:XML):LatLng
[static]
Returns new object, which will be constructed from the source XML data.
| LatLng | ||
|
getXMLFromType(latlng:LatLng, name:String):XML
[static]
Returns XML data that describes the Object.
| LatLng | ||
|
isValid():Boolean
Validates the point.
| LatLng | ||
|
toSexagecimal():String
Returns a string in sexagecimal format.
| LatLng | ||
|
toString():String
Returns a
String that represents point's coordiantes. | LatLng | ||
|
toXML(name:String = "coordinates"):XML
Builds an XML object in KML 2.1 format that describes this Object.
| LatLng | ||
| Constant | Defined by | ||
|---|---|---|---|
| DEFAULT_NODE_NAME : String = "latlng" [static]
Defines default root node name for XML conversion.
| LatLng | ||
| lat | property |
lat:Number [read-write]
Gets or sets the point's latitude.
Returns either normal or clamped latitude of the point, based on the unbounded flag.
The default value is 0.
public function get lat():Number
public function set lat(value:Number):void
See also
| latRadians | property |
latRadians:Number [read-only]Returns the latitude coordinate in radians, as a number between -PI/2 and +PI/2. If the unbounded flag is set, this coordinate can be outside this interval.
Implementation public function get latRadians():Number
See also
| lng | property |
lng:Number [read-write]
Gets or sets the point's longitude.
Returns either a normal or wrapped longitude of the point, based on the unbounded flag.
The default value is 0.
public function get lng():Number
public function set lng(value:Number):void
See also
| lngRadians | property |
lngRadians:Number [read-only]Returns the longitude coordinate in radians, as a number between -PI and +PI. If the unbounded flag is set, this coordinate can be outside this interval.
Implementation public function get lngRadians():Number
See also
| unbounded | property |
unbounded:Boolean [read-write]
Gets or sets the unbounded flag.
If the unbounded flag is true, then the numbers will be returned as passed,
otherwise latitude will be clamped to lie between -90 degrees and +90 degrees,
and longitude will be wrapped to lie between -180 degrees and +180 degrees.
The default value is false.
public function get unbounded():Boolean
public function set unbounded(value:Boolean):void
See also
| LatLng | () | constructor |
public function LatLng(lat:Number = 0, lng:Number = 0, unbounded:Boolean = true)Point's constructor.
Creates a new point with given latitude and longitude coordinates.
The numbers are always saved as passed to the constructor.
If the unbounded flag is true, then the numbers will be returned as passed,
otherwise latitude will be clamped to lie between -90 degrees and +90 degrees,
and longitude will be wrapped to lie between -180 degrees and +180 degrees.
lat:Number (default = 0) — Point's latitude.
|
|
lng:Number (default = 0) — Point's longitude.
|
|
unbounded:Boolean (default = true) — - A flag that determines whether point's coordinates should be unbounded.
|
| clone | () | method |
public function clone():LatLngCreates a copy of this LatLng object.
ReturnsLatLng —
A copy of this object.
|
| equals | () | method |
public function equals(other:LatLng):BooleanCompares this point with the other.
Returns true if both points are equal with a certain round-off.
Both point's coordinates will be rounded to 6 decimal places.
other:LatLng — The object to be compared.
|
Boolean — A value of true if both points are equal; false if they are not.
|
| fromSexagecimal | () | method |
public static function fromSexagecimal(string:String):LatLngReturns a LatLng point from sexagecimal string.
Parametersstring:String |
LatLng |
var string:String = "N 10° 14' 4'' E 20° 6' 44''"; trace ( LatLng.fromSexagecimal(string)); // traces (lat=10.234444, lng=20.112222)
| fromXML | () | method |
public static function fromXML(xml:XML):LatLngCreates new LatLng from XML object in KML 2.1 format.
Parametersxml:XML |
LatLng —
New LatLng object.
|
| getTypeFromXML | () | method |
public static function getTypeFromXML(xml:XML):LatLngReturns new object, which will be constructed from the source XML data.
Parametersxml:XML — Source XML data.
|
LatLng —
Object that was constructed from the source XML data.
|
| getXMLFromType | () | method |
public static function getXMLFromType(latlng:LatLng, name:String):XMLReturns XML data that describes the Object. You can also specify root node name in the second parameter.
Parameterslatlng:LatLng — Object that should be converted to XML.
|
|
name:String — Root node name.
|
XML — XML data that describes the properties of the source object.
|
| isValid | () | method |
public function isValid():BooleanValidates the point.
Returns true if both lat and lng components contains a defined Number.
Returns false if lat or lng have a value of NaN.
Boolean — A value of true if both lat and lng are defined; false if they are not.
|
| toSexagecimal | () | method |
public function toSexagecimal():StringReturns a string in sexagecimal format.
ReturnsString |
var latLng:LatLng = new LatLng(10.2344,20.1121); trace (latLng.toSexagecimal); // traces S 10° 14' 4'' E 20° 6' 44''
| toString | () | method |
public function toString():String
Returns a String that represents point's coordiantes.
The output will look like "(lat=lat, lng=lng)"
ReturnsString — A textual representation of the point
|
| toXML | () | method |
public function toXML(name:String = "coordinates"):XMLBuilds an XML object in KML 2.1 format that describes this Object.
Parametersname:String (default = "coordinates") |
XML — XML object in KML 2.1 format.
|
| DEFAULT_NODE_NAME | constant |
public static const DEFAULT_NODE_NAME:String = "latlng"Defines default root node name for XML conversion.