# Class: Graphic

## Graphic()

#### new Graphic()

Source:
  - Graphic.js, line 12

### Methods

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

构造一个新的 Graphic 对象。

Source:
  - Graphic.js, line 21

##### Returns:

Type
  Promise.<Graphic>

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

根据索引获取图形属性名

##### Parameters:

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

Source:
  - Graphic.js, line 254

##### Returns:

Type
  Promise.<String>

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

获取图形属性的数目

Source:
  - Graphic.js, line 234

##### Returns:

Type
  Promise.<Number>

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

根据索引获取图形属性值

##### Parameters:

Name | Type | Description
--- | --- | ---
`index` | Number | 图形属性的索引，从0开始到属性数目减1

Source:
  - Graphic.js, line 274

##### Returns:

Type
  Promise.<String>

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

根据属性名称获取图形属性值

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | 属性名称

Source:
  - Graphic.js, line 294

##### Returns:

Type
  Promise.<String>

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

获取图形外包矩形

Source:
  - Graphic.js, line 135

##### Returns:

Type
  Promise.<Rect>

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

获取图形中心点坐标

Source:
  - Graphic.js, line 112

##### Returns:

Type
  Promise.<Dot>

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

获取图形的颜色

Source:
  - Graphic.js, line 93

##### Returns:

图形颜色 eg:'rgba(128, 128, 128, 255)'

Type
  Promise.<String>

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

获取图形类型

Source:
  - Graphic.js, line 156

##### Returns:

图形类型。例：1---GraphicType.PointType

Type
  Promise.<Number>

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

获取覆盖物的可见状态

Source:
  - Graphic.js, line 37

##### Returns:

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

Type
  Number

#### (async, static) isPointByPixel() → {Promise.<boolean>}

获取点是否为像素单位

Source:
  - Graphic.js, line 195

##### Returns:

Type
  Promise.<boolean>

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

判断Graphic对象是否有效

Source:
  - Graphic.js, line 400

##### Returns:

是否有效。true: 有效；false：无效

Type
  boolean

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

移除所有属性.

Source:
  - Graphic.js, line 330

##### Returns:

Type
  Promise.<void>

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

移除指定名称的属性

##### Parameters:

Name | Type | Description
--- | --- | ---
`name` | String | 属性名称

Source:
  - Graphic.js, line 313

##### Returns:

Type
  Promise.<void>

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

设置图形的属性

##### Parameters:

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

Source:
  - Graphic.js, line 216

##### Returns:

Type
  Promise.<void>

#### (async, static) setColor(color) → {Promise.<Void>}

设置图形颜色

##### Parameters:

Name | Type | Description
--- | --- | ---
`color` | String | 图形颜色 eg:'rgba(128, 128, 128, 255)'

Source:
  - Graphic.js, line 76

##### Returns:

Type
  Promise.<Void>

#### (async, static) setPointByPixel(pixel) → {Promise.<void>}

设置点是否为像素单位(默认情况下为地图单位)

##### Parameters:

Name | Type | Description
--- | --- | ---
`pixel` | boolean | 点是否为像素单位

Source:
  - Graphic.js, line 176

##### Returns:

Type
  Promise.<void>

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

设置覆盖物的可见状态

##### Parameters:

Name | Type | Description
--- | --- | ---
`state` | Number | 覆盖物的可见状态。0 不可见；1 可见

Source:
  - Graphic.js, line 58

##### Returns:

Type
  Promise.<Void>