new SuperMap.LonLat(lon, lat, location)
            common/commontypes/LonLat.js, line 6
        
        
    | Name | Type | Default | Description | 
|---|---|---|---|
| lon | number | 0.0 | 可选 地图单位上的 X 轴坐标,如果地图是地理投影,则此值是经度,否则,此值是地图地理位置的 x 坐标。 | 
| lat | number | 0.0 | 可选 地图单位上的 Y 轴坐标,如果地图是地理投影,则此值是纬度,否则,此值是地图地理位置的 y 坐标。 | 
| location | Array.<float> | 可选 如果要同时设置,则使用传入横纵坐标组成的数组。 | 
Example
var lonLat = new SuperMap.LonLat(30,45);Members
- 
    latfloat
- 
    
    地图的单位的 Y 轴(纵轴)坐标。 - Default Value: 0.0
 
lonfloat
地图的单位的 X 轴(横轴)坐标。
- Default Value: 0.0
Methods
- 
    SuperMap.LonLat.fromArray(arr){SuperMap.LonLat}common/commontypes/LonLat.js, line 173
- 
    
    
    通过数组生成一个 <SuperMap.LonLat> 对象。 Name Type Description arrArray.<float> 数组的格式,长度只能为2,:[Lon,Lat]。如:[5,-42]。 Returns:Type Description SuperMap.LonLat 返回一个 <SuperMap.LonLat> 对象。 
- 
    SuperMap.LonLat.fromString(str){SuperMap.LonLat}common/commontypes/LonLat.js, line 159
- 
    
    
    通过字符串生成一个 SuperMap.LonLat 对象。 Name Type Description strstring 字符串的格式:Lon+","+Lat。如:"100,50"。 Returns:Type Description SuperMap.LonLat 返回一个 SuperMap.LonLat 对象。 Examplevar str = "100,50"; var lonLat = SuperMap.LonLat.fromString(str);
- 
    add(lon, lat){SuperMap.LonLat}common/commontypes/LonLat.js, line 74
- 
    
    
    在已有坐标对象的经纬度基础上加上新的坐标经纬度,并返回新的坐标对象。 Name Type Description lonfloat 传入的经度参数。 latfloat 传入的纬度参数。 Returns:Type Description SuperMap.LonLat 返回一个新的 LonLat 对象,此对象的经纬度是由传入的经纬度与当前的经纬度相加所得。 Examplevar lonLat1 = new SuperMap.LonLat(100,50); //lonLat2 是新的对象 var lonLat2 = lonLat1.add(100,50);
- 
    clone(){SuperMap.LonLat}common/commontypes/LonLat.js, line 62
- 
    
    
    复制坐标对象,并返回复制后的新对象。 Returns:Type Description SuperMap.LonLat 返回相同坐标值的新的坐标对象。 Examplevar lonLat1 = new SuperMap.LonLat(100,50); var lonLat2 = lonLat1.clone();
- 
    destroy()common/commontypes/LonLat.js, line 145
- 
    
    
    销毁此对象。 销毁后此对象的所有属性为 null,而不是初始值。 Examplevar lonLat = new SuperMap.LonLat(100,50); lonLat.destroy();
- 
    equals(ll){boolean}common/commontypes/LonLat.js, line 93
- 
    
    
    判断两个坐标对象是否相等。 Name Type Description llSuperMap.LonLat 需要进行比较的坐标对象。 Returns:Type Description boolean 如果LonLat对象的经纬度和传入的经纬度一致则返回true,不一 致或传入的ll参数为NULL则返回false。 Examplevar lonLat1 = new SuperMap.LonLat(100,50); var lonLat2 = new SuperMap.LonLat(100,50); var isEquals = lonLat1.equals(lonLat2);
- 
    toShortString(){string}common/commontypes/LonLat.js, line 50
- 
    
    
    将经度纬度转换成简单字符串。 Returns:Type Description string 返回处理后的经纬度字符串。例如:"100,50" Examplevar lonLat = new SuperMap.LonLat(100,50); var str = lonLat.toShortString();
- 
    toString(){string}common/commontypes/LonLat.js, line 38
- 
    
    
    返回此对象的字符串形式 Returns:Type Description string 例如: "lon=100,lat=50" Examplevar lonLat = new SuperMap.LonLat(100,50); var str = lonLat.toString();
- 
    wrapDateLine(maxExtent){SuperMap.LonLat}common/commontypes/LonLat.js, line 113
- 
    
    
    通过传入的范围对象对坐标对象转换到该范围内。 如果经度小于给定范围最小精度,则在原经度基础上加上范围宽度,直到精度在范围内为止,如果经度大于给定范围则在原经度基础上减去范围宽度。 即指将不在经度范围内的坐标转换到范围以内(只会转换 lon,不会转换 lat,主要用于转移到日界线以内)。 Name Type Description maxExtentSuperMap.Bounds 最大边界的范围。 Returns:Type Description SuperMap.LonLat 将坐标转换到范围对象以内,并返回新的坐标。 Examplevar lonLat1 = new SuperMap.LonLat(420,50); var lonLat2 = lonLat1.wrapDateLine( new SuperMap.Bounds(-180,-90,180,90) );