# Class: Map

## Map()

#### new Map()

地图类，负责地图显示环境的管理。

Source:
  - Map.js, line 31

### Methods

#### (async, static) append(layer) → {Promise.<*>}

添加图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | MapLayer | 图层

Source:
  - Map.js, line 523

##### Returns:

Type
  Promise.<*>

#### (async, static) clearDirty() → {boolean}

清除编辑

Source:
  - Map.js, line 774

##### Returns:

成功/失败

Type
  boolean

#### (async, static) createObj() → {Promise.<Map>}

构造一个新的 Map 对象。

Source:
  - Map.js, line 127

##### Returns:

Type
  Promise.<Map>

#### (async, static) dragIn(index, layer) → {Number}

拽入图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 索引（int类型的Number）
`layer` | MapLayer | 图层

Source:
  - Map.js, line 631

##### Returns:

（int类型的Number）成功返回1，失败返回0

Type
  Number

#### (async, static) dragOut(layer)

移除图层，不会销毁图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | MapLayer | 图层

Source:
  - Map.js, line 615

##### Returns:

成功返回1，失败返回0

#### (async, static) fromXML(strXMl, onlyStyle) → {int}

从字符串中输入

##### Parameters:

Name | Type | Description
--- | --- | ---
`strXMl` | String |
`onlyStyle` | boolean | 支持仅导出样式

Source:
  - Map.js, line 761

##### Returns:

Type
  int

#### (async, static) getDescription() → {Promise.<String>}

获取地图描述

Source:
  - Map.js, line 283

##### Returns:

Type
  Promise.<String>

#### (async, static) getEntireRange() → {Promise.<Rect>}

获取地图范围

Source:
  - Map.js, line 297

##### Returns:

Type
  Promise.<Rect>

#### (async, static) getFixedScale(index) → {double}

获取固定的显示比

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | int | 显示比的索引

Source:
  - Map.js, line 374

##### Returns:

Type
  double

#### (async, static) getFixedScalesCount() → {int}

获取固定的显示比个数

Source:
  - Map.js, line 359

##### Returns:

Type
  int

#### (async, static) getIsCustomEntireRange() → {boolean}

获取是否适应整个地图范围

Source:
  - Map.js, line 441

##### Returns:

Type
  boolean

#### (async, static) getIsDirty()

获取是否编辑

Source:
  - Map.js, line 508

##### Returns:

是否编辑

#### (async, static) getIsFixedScalesDisplay() → {boolean}

获取是否固定显示比的显示

Source:
  - Map.js, line 345

##### Returns:

Type
  boolean

#### (async, static) getLayer(index) → {Promise.<MapLayer>}

获取图层的名称

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图层索引（int类型的Number）

Source:
  - Map.js, line 490

##### Returns:

Type
  Promise.<MapLayer>

#### (async, static) getLayerCount()

获取地图节点图层数目

Source:
  - Map.js, line 408

##### Returns:

返回节点图层数

#### (async, static) getLayerEnum() → {Promise.<LayerEnum>}

获取地图所有图层

Source:
  - Map.js, line 422

##### Returns:

返回所有图层对象

Type
  Promise.<LayerEnum>

#### (async, static) getMaxScale() → {Promise.<double>}

获取最大显示比

Source:
  - Map.js, line 331

##### Returns:

Type
  Promise.<double>

#### (async, static) getMinScale() → {Promise.<double>}

获取最小显示比

Source:
  - Map.js, line 317

##### Returns:

Type
  Promise.<double>

#### (async, static) getName() → {Promise.<String>}

获取地图名称

Source:
  - Map.js, line 269

##### Returns:

Type
  Promise.<String>

#### (async, static) getRange() → {Rect}

获取范围

Source:
  - Map.js, line 455

##### Returns:

地图范围

Type
  Rect

#### (async, static) GetRotateAngle() → {double}

获取地图旋转角

Source:
  - Map.js, line 834

##### Returns:

Type
  double

#### (async, static) GetRotateCenter() → {Promise.<Dot>}

获取地图旋转中心

Source:
  - Map.js, line 802

##### Returns:

Type
  Promise.<Dot>

#### (async, static) getSRSInfo() → {Promise.<SRefData>}

获取空间参照系

Source:
  - Map.js, line 388

##### Returns:

空间参照系

Type
  Promise.<SRefData>

#### (async, static) getSymbolScale() → {double}

获取符号等级

Source:
  - Map.js, line 475

##### Returns:

Type
  double

#### (async, static) getViewRange() → {Promise.<Rect>}

获取显示范围

Source:
  - Map.js, line 883

##### Returns:

显示范围

Type
  Promise.<Rect>

#### (async, static) indexOfByLayer(layer)

根据图层查找索引

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | MapLayer | 图层

Source:
  - Map.js, line 659

##### Returns:

成功返回索引，失败返回-1

#### (async, static) indexOfByName(name)

根据名称查找图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | 图层名称

Source:
  - Map.js, line 645

##### Returns:

成功返回索引，失败返回-1

#### (async, static) insert(index, layer) → {Number}

插入图层（成功返回1，失败返回0）

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 索引
`layer` | MapLayer | 图层

Source:
  - Map.js, line 540

##### Returns:

Type
  Number

#### (async, static) move(fromIndex, toIndex)

将图层从fromIndex移至toIndex

##### Parameters:

Name | Type | Description
--- | --- | ---
`fromIndex` | Number | 移动前图层索引（int范围的Number）
`toIndex` | Number | 移动后图层索引 （int范围的Number）

Source:
  - Map.js, line 730

##### Returns:

成功返回true，失败返回false

#### (async, static) moveToBottom(index) → {boolean}

移动图层到最下面（最后绘制）

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图层索引（int类型的Number）

Source:
  - Map.js, line 673

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) moveToDown(index) → {boolean}

下移图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图层索引（int类型的Number）

Source:
  - Map.js, line 701

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) moveToTop(index) → {boolean}

移动图层到最上面（最先绘制）

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图层索引 （int类型的Number）

Source:
  - Map.js, line 687

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) moveToUp(index) → {boolean}

上移图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | int | 图层索引（int类型的Number）

Source:
  - Map.js, line 715

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) outputToBitmap(dispRange, bitmap) → {int}

根据指定的地图范围生成一张指定大小的图片

##### Parameters:

Name | Type | Description
--- | --- | ---
`dispRange` | Rect | 地图范围
`bitmap` | Image | 生成的图片，用户负责构造指定大小的图片，要求像素格式为ARGB_8888

Source:
  - Map.js, line 850

##### Returns:

Type
  int

#### (async, static) remove(fromIndex, count) → {boolean}

从FromIndex开始移除Count个图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`fromIndex` | Number | 开始索引（int范围的Number）
`count` | Number | 移除个数（int范围的Number）

Source:
  - Map.js, line 571

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) removeAll() → {boolean}

移除所有图层，同时销毁图层

Source:
  - Map.js, line 600

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) removeByIndex(index) → {boolean}

移除索引为index的图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图层索引（int范围的Number）

Source:
  - Map.js, line 586

##### Returns:

成功返回true，失败返回false

Type
  boolean

#### (async, static) removeByLayer(layer) → {boolean}

移除图层

##### Parameters:

Name | Type | Description
--- | --- | ---
`layer` | MapLayer | 图层

Source:
  - Map.js, line 555

##### Returns:

Type
  boolean

#### (async, static) setDescription(Description) → {Promise.<void>}

设置地图描述信息

##### Parameters:

Name | Type | Description
--- | --- | ---
`Description` | String |

Source:
  - Map.js, line 158

##### Returns:

Type
  Promise.<void>

#### (async, static) setEntireRange(EntireRange) → {Promise.<void>}

设置地图范围

##### Parameters:

Name | Type | Description
--- | --- | ---
`EntireRange` | Rect |

Source:
  - Map.js, line 172

##### Returns:

Type
  Promise.<void>

#### (async, static) setFixedScale(scale) → {Promise.<void>}

设置修订后的显示比

##### Parameters:

Name | Type | Description
--- | --- | ---
`scale` | Number |

Source:
  - Map.js, line 242

##### Returns:

Type
  Promise.<void>

#### (async, static) setFixedScalesCount(FixedScalesCount) → {Promise.<void>}

设置修订显示比数目

##### Parameters:

Name | Type | Description
--- | --- | ---
`FixedScalesCount` | Number |

Source:
  - Map.js, line 228

##### Returns:

Type
  Promise.<void>

#### (async, static) setIsCustomEntireRange(IsCustomEntireRange) → {Promise.<void>}

设置地图范围

##### Parameters:

Name | Type | Description
--- | --- | ---
`IsCustomEntireRange` | boolean |

Source:
  - Map.js, line 256

##### Returns:

Type
  Promise.<void>

#### (async, static) setIsFixedScalesDisplay(IsFixedScalesDisplay)

设置固定显示比的显示

##### Parameters:

Name | Type | Description
--- | --- | ---
`IsFixedScalesDisplay` | boolean | 是否显示显示比

Source:
  - Map.js, line 214

#### (async, static) setMaxScale(MaxScale) → {Promise.<void>}

设置地图最小大显示比

##### Parameters:

Name | Type | Description
--- | --- | ---
`MaxScale` | Number |

Source:
  - Map.js, line 200

##### Returns:

Type
  Promise.<void>

#### (async, static) setMinScale(MinScale) → {Promise.<void>}

设置地图最小显示比

##### Parameters:

Name | Type | Description
--- | --- | ---
`MinScale` | number |

Source:
  - Map.js, line 186

##### Returns:

Type
  Promise.<void>

#### (async, static) setName(name) → {Promise.<void>}

设置地图名称

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String |

Source:
  - Map.js, line 144

##### Returns:

Type
  Promise.<void>

#### (async, static) SetRotateAngle(angle) → {Promise.<void>}

设置地图旋转角

##### Parameters:

Name | Type | Description
--- | --- | ---
`angle` | Number | 旋转角度 （doublef范围的Number）

Source:
  - Map.js, line 821

##### Returns:

Type
  Promise.<void>

#### (async, static) SetRotateCenter(center) → {Promise.<void>}

设置地图旋转中心

##### Parameters:

Name | Type | Description
--- | --- | ---
`center` | Dot | 旋转中心

Source:
  - Map.js, line 789

##### Returns:

Type
  Promise.<void>

#### (async, static) setViewRange(rect) → {Promise.<Void>}

设置显示范围

##### Parameters:

Name | Type | Description
--- | --- | ---
`rect` | Rect | 显示范围

Source:
  - Map.js, line 871

##### Returns:

Type
  Promise.<Void>

#### (async, static) toXML(onlyStyle) → {String}

输出到字符串中

##### Parameters:

Name | Type | Description
--- | --- | ---
`onlyStyle` | boolean | 支持仅导出样式

Source:
  - Map.js, line 745

##### Returns:

成功返回Cstring值

Type
  String