# Global

##

### Methods

#### (async) addAnnotation(ann)

添加一个标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`ann` |  | 标记

Source:
  - AnnotationsOverlay.js, line 34

#### (async) addAnnotations(anns)

添加一组标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`anns` |  |

Source:
  - AnnotationsOverlay.js, line 50

#### (async) animatePosition(postion, duration) → {Promise.<void>}

动画到指定位置(中心点为视图的绝对中心)

##### Parameters:

Name | Type | Description
--- | --- | ---
`postion` |  | 要动画到的位置
`duration` |  | 持续时间(单位毫秒)

Source:
  - MapView.js, line 699

##### Returns:

Type
  Promise.<void>

#### (async) distanceOfGeometry(geom1, geom2, type) → {Promise.<double>}

计算两个几何对象间的距离 ********************************************************************************** * * 点 * 线 * 区(单圈) * 多线 * 多区 * ********************************************************************************** * 点 * min|max * min * min|max * 不支持 * 不支持 * * 线 * min * min|max * 不支持 * 不支持 * 不支持 * * 区(单圈) * min|max * 不支持 * min * 不支持 * 不支持 * * 多线 * min * min|max * 不支持 * 不支持 * 不支持 * * 多区 * min|max * 不支持 * min * 不支持 * 不支持 * **********************************************************************************

##### Parameters:

Name | Type | Description
--- | --- | ---
`geom1` | Geometry | 几何对象1
`geom2` | Geometry | 几何对象2
`type` | int | 计算距离方法

Source:
  - SpaCalculator.js, line 130

##### Returns:

距离长度

Type
  Promise.<double>

#### (async) getAllAnnotations()

获取所有标记

Source:
  - AnnotationsOverlay.js, line 166

##### Returns:

标记列表

#### (async) getAnnotation(index)

获取指定索引的标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` |  | 标记索引 从0开始

Source:
  - AnnotationsOverlay.js, line 147

##### Returns:

索引对应的标记

#### (async) getAnnotationCount()

获取标记数目

Source:
  - AnnotationsOverlay.js, line 116

##### Returns:

标记数目

#### (async) getGeometryByType(geometryId, geometryType, geometryAnnType) → {Geometry}

根据返回的geometryId,geometryType，geometryAnnType构造geometry对象

##### Parameters:

Name | Type | Description
--- | --- | ---
`geometryId` | String | 几何对象对应的Id
`geometryType` | int | 几何对象类型
`geometryAnnType` | int | 几何对象为GeoAnno类型时候的AnnType

Source:
  - SketchEditor.js, line 485

##### Returns:

geometry或子类对象

Type
  Geometry

#### (async) indexOf(annotation)

获取标记的索引

##### Parameters:

Name | Type | Description
--- | --- | ---
`annotation` |  |

Source:
  - AnnotationsOverlay.js, line 130

##### Returns:

标记索引 -1表示没有找到该标记

#### (async) initialize(strRootPath, context)

环境初始化，必须在使用SDK各组件之前调用，会自动建立根目录结构

##### Parameters:

Name | Type | Description
--- | --- | ---
`strRootPath` | String | 根路径： /MapGIS/
`context` |  | 上下文

Source:
  - Environment.js, line 32

#### (async) moveAnnotation(fromIndex, toIndex)

移动标记,改变标记的层次序列

##### Parameters:

Name | Type | Description
--- | --- | ---
`fromIndex` |  | 被移动的标记的索引
`toIndex` |  | 移动标记到toIndex处,如果toIndex为-1 表示移动到最上面

Source:
  - AnnotationsOverlay.js, line 189

#### (async) removeAllAnnotations()

删除所有标记

Source:
  - AnnotationsOverlay.js, line 103

#### (async) removeAnnotation(ann)

删除一个标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`ann` |  |

Source:
  - AnnotationsOverlay.js, line 76

#### (async) removeAnnotationByIndex(index)

删除指定索引的标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` |  | 索引

Source:
  - AnnotationsOverlay.js, line 63

#### (async) removeAnnotations(anns)

删除一组标记

##### Parameters:

Name | Type | Description
--- | --- | ---
`anns` |  |

Source:
  - AnnotationsOverlay.js, line 92

#### (async) requestAuthorization() → {Promise.<void>}

请求授权

Source:
  - Environment.js, line 44

##### Returns:

Type
  Promise.<void>

#### (async) setResolution(resolution) → {Promise.<void>}

设置地图分辨率

##### Parameters:

Name | Type | Description
--- | --- | ---
`resolution` |  |

Source:
  - MapPosition.js, line 113

##### Returns:

Type
  Promise.<void>

#### (async) setScale(scale) → {Promise.<Object>}

设置缩放比例

##### Parameters:

Name | Type | Description
--- | --- | ---
`scale` |  | scale > 1 放大 < 1 缩小

Source:
  - MagnifierOption.js, line 67

##### Returns:

Type
  Promise.<Object>

#### (async) setSize(size) → {Promise.<object>}

设置放大镜大小

##### Parameters:

Name | Type | Description
--- | --- | ---
`size` |  | 放大镜大小

Source:
  - MagnifierOption.js, line 101

##### Returns:

Type
  Promise.<object>

#### (async) setSystemLibraryPath(strPath) → {Promise.<void>}

设置系统库路径

##### Parameters:

Name | Type | Description
--- | --- | ---
`strPath` |  |

Source:
  - Environment.js, line 57

##### Returns:

Type
  Promise.<void>

#### (async) toGeometry(graphic) → {Promise.<Geometry>}

将图形对象转换为几何对象

##### Parameters:

Name | Type | Description
--- | --- | ---
`graphic` | Graphic |

Source:
  - Graphic.js, line 366

##### Returns:

Type
  Promise.<Geometry>

#### (async) toGeometrys(graphicArray) → {Promise.<Geometry>}

将一组同类型的图形对象转换为多几何对象(GeoPolygons、GeoPoints、GeoLines)

##### Parameters:

Name | Type | Description
--- | --- | ---
`graphicArray` | Graphics |

Source:
  - Graphic.js, line 383

##### Returns:

Type
  Promise.<Geometry>

#### (async) toGraphicsFromGeometry(geometry) → {Promise.<Graphics>}

将几何对象转换为图形对象. 常用于将查询出的要素转换为图形，在地图上做高亮显示.一个几何对象可能会转换出一个或多个图形对象

##### Parameters:

Name | Type | Description
--- | --- | ---
`geometry` | Geoemtry | 待转换的几何对象

Source:
  - Graphic.js, line 349

##### Returns:

转换出的图形列表

Type
  Promise.<Graphics>

#### (async) updatePositionbyViewPoint(postion, viewCenterPoint, animated) → {Promise.<void>}

更新位置(中心点为视图的指定中心)

##### Parameters:

Name | Type | Description
--- | --- | ---
`postion` |  | 要更新到的位置
`viewCenterPoint` |  | 自定义视图中心
`animated` |  | 是否开启动画

Source:
  - MapView.js, line 679

##### Returns:

Type
  Promise.<void>