# Class: GraphicsOverlay

## GraphicsOverlay()

#### new GraphicsOverlay()

Source:
  - GraphicsOverlay.js, line 11

### Methods

#### (async, static) addGraphic(graphic) → {Number}

添加一个图形

##### Parameters:

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

Source:
  - GraphicsOverlay.js, line 115

##### Returns:

成功返回 1 ,失败返回0

Type
  Number

#### (async, static) addGraphics(graphicArray) → {Promise.<void>}

添加一组图形

##### Parameters:

Name | Type | Description
--- | --- | ---
`graphicArray` | Array.<Graphic> |

Source:
  - GraphicsOverlay.js, line 135

##### Returns:

Type
  Promise.<void>

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

构造一个新的 GraphicsOverlay 对象。

Source:
  - GraphicsOverlay.js, line 20

##### Returns:

Type
  Promise.<GraphicsOverlay>

#### (async, static) getAllGraphics() → {Promise.<Array.<Graphic>>}

返回所有图形

Source:
  - GraphicsOverlay.js, line 207

##### Returns:

Type
  Promise.<Array.<Graphic>>

#### (async, static) getGraphic(index) → {Promise.<Graphic>}

获取指定索引的图形

##### Parameters:

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

Source:
  - GraphicsOverlay.js, line 278

##### Returns:

Type
  Promise.<Graphic>

#### (async, static) getGraphicCount() → {Promise.<Number>}

返回所有图形的数目

Source:
  - GraphicsOverlay.js, line 232

##### Returns:

Type
  Promise.<Number>

#### (async, static) getGraphicsByAttribute(name, value) → {Promise.<Array.<Graphic>>}

获取指定属性的图形

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | 属性名
`value` | String | 属性值

Source:
  - GraphicsOverlay.js, line 386

##### Returns:

Type
  Promise.<Array.<Graphic>>

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

获取层名称

Source:
  - GraphicsOverlay.js, line 55

##### Returns:

Type
  Promise.<String>

#### (async, static) getState() → {Number}

获取图形层的可见状态

Source:
  - GraphicsOverlay.js, line 75

##### Returns:

返回层的状态 0--不可见; 1--可见

Type
  Number

#### (async, static) indexOf(graphic) → {Promise.<Number>}

获取指定图形的索引

##### Parameters:

Name | Type | Description
--- | --- | ---
`graphic` | Graphic | 图形对象

Source:
  - GraphicsOverlay.js, line 253

##### Returns:

图形索引

Type
  Promise.<Number>

#### (async, static) insertGraphic(index, graphic) → {Promise.<Number>}

插入图形

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 要插入的位置
`graphic` | Graphic | 要插入的图形

Source:
  - GraphicsOverlay.js, line 301

##### Returns:

returnID > 0 插入成功，returnID < 0 插入失败

Type
  Promise.<Number>

#### (static) isValid() → {Boolean}

判断graphicsOverlay是否有效

Source:
  - GraphicsOverlay.js, line 416

##### Returns:

true - 有效；false - 无效

Type
  Boolean

#### (async, static) moveGraphic(fromIndex, toIndex) → {Promise.<Void>}

移动图形的叠放次序

##### Parameters:

Name | Type | Description
--- | --- | ---
`fromIndex` | Number | 移动源索引 (int范围的Number)
`toIndex` | Number | 移动目的索引 (int范围的Number)

Source:
  - GraphicsOverlay.js, line 347

##### Returns:

Type
  Promise.<Void>

#### (async, static) removeAllGraphics()

删除所有图形

Source:
  - GraphicsOverlay.js, line 189

#### (async, static) removeGraphic(graphic) → {Promise.<void>}

删除一个图形

##### Parameters:

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

Source:
  - GraphicsOverlay.js, line 154

##### Returns:

Type
  Promise.<void>

#### (async, static) removeGraphicByAttribute(name, value) → {Promise.<Void>}

删除指定属性的图形

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | 属性名
`value` | String | 属性值

Source:
  - GraphicsOverlay.js, line 366

##### Returns:

Type
  Promise.<Void>

#### (async, static) removeGraphicByIndex(index) → {Promise.<Void>}

删除指定索引的图形

##### Parameters:

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

Source:
  - GraphicsOverlay.js, line 327

##### Returns:

Type
  Promise.<Void>

#### (async, static) removeGraphics(graphicArray) → {Promise.<void>}

删除一组图形

##### Parameters:

Name | Type | Description
--- | --- | ---
`graphicArray` | Array.<Graphic> |

Source:
  - GraphicsOverlay.js, line 172

##### Returns:

Type
  Promise.<void>

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

设置层名称

##### Parameters:

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

Source:
  - GraphicsOverlay.js, line 37

##### Returns:

Type
  Promise.<void>

#### (async, static) setState(state) → {Promise.<Void>}

设置图形层的可见状态

##### Parameters:

Name | Type | Description
--- | --- | ---
`state` | Number | 层的状态 0--不可见; 1--可见

Source:
  - GraphicsOverlay.js, line 96

##### Returns:

Type
  Promise.<Void>