# Class: MapLayer

## MapLayer()

#### new MapLayer()

Source:
  - MapLayer.js, line 22

### Methods

#### (async, static) attachData(cls) → {boolean}

附加外部数据

##### Parameters:

Name | Type | Description
--- | --- | ---
`cls` | Object | 地理类对象

Source:
  - MapLayer.js, line 374

##### Returns:

true/false 成功/失败

Type
  boolean

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

复制图层

Source:
  - MapLayer.js, line 353

##### Returns:

} 成功返回克隆之后的图层

Type
  Promise.<MapLayer>

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

构造一个新的 MapLayer 对象。

Source:
  - MapLayer.js, line 31

##### Returns:

Type
  Promise.<MapLayer>

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

附加解除

Source:
  - MapLayer.js, line 388

##### Returns:

true/false 成功/失败

Type
  boolean

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

从XML导入

##### Parameters:

Name | Type | Description
--- | --- | ---
`strXML` |  |
`onlyStyle` |  | true:仅导入样式信息 false:除图层样式信息外还包括图层的name、geometryType、url、layerWeight、state信息

Source:
  - MapLayer.js, line 448

##### Returns:

1-成功；0-失败

Type
  int

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

获取类类型

Source:
  - MapLayer.js, line 281

##### Returns:

类类型（int类型的数值；例如 30 -- XClsType.SFCls）

Type
  Number

#### (async, static) getData() → {Promise.<IBasCls>}

获取图层要素数据类

Source:
  - MapLayer.js, line 402

##### Returns:

成功获得数据类

Type
  Promise.<IBasCls>

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

获取要素几何类型

Source:
  - MapLayer.js, line 295

##### Returns:

要素几何类型（int类型的数值；例如 1--GeomType.GeomPnt

Type
  Number

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

查看图层是否有效

Source:
  - MapLayer.js, line 228

##### Returns:

Type
  Promise.<*>

#### (async, static) getIsVisible()

获取图层是否显示

Source:
  - MapLayer.js, line 139

#### (async, static) getLabel() → {Promise.<Label>}

获取当前的标注

Source:
  - MapLayer.js, line 309

##### Returns:

} 成功返回当前的标注

Type
  Promise.<Label>

#### (async, static) getMaxScale()

获取图层最大显示比率

Source:
  - MapLayer.js, line 176

#### (async, static) getMinScale()

获取图层最小显示比率

Source:
  - MapLayer.js, line 152

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

获取图层名称

Source:
  - MapLayer.js, line 47

##### Returns:

Type
  Promise.<*>

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

获取地图范围

Source:
  - MapLayer.js, line 242

##### Returns:

Type
  Promise.<Rect>

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

获取空间参照系

Source:
  - MapLayer.js, line 261

##### Returns:

Type
  Promise.<SRefData>

#### (async, static) getState() → {Promise.<(*|NavigationPreloadState)>}

获取图层状态

Source:
  - MapLayer.js, line 103

##### Returns:

Type
  Promise.<(*|NavigationPreloadState)>

#### (async, static) getThemes() → {Promise.<Themes>}

获获取专题图列表

Source:
  - MapLayer.js, line 333

##### Returns:

} 成功返回专题图列表

Type
  Promise.<Themes>

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

获取图层的URL

Source:
  - MapLayer.js, line 75

##### Returns:

Type
  Promise.<*>

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

获取图层的权重

Source:
  - MapLayer.js, line 202

##### Returns:

Type
  Promise.<*>

#### (async, static) setMaxScale(MaxScale)

设置图层最大显示比率

##### Parameters:

Name | Type | Description
--- | --- | ---
`MaxScale` |  | 图层最大显示比率

Source:
  - MapLayer.js, line 189

#### (async, static) setMinScale(MinScale)

设置图层最小显示比率

##### Parameters:

Name | Type | Description
--- | --- | ---
`MinScale` |  | 图层最小显示比率

Source:
  - MapLayer.js, line 165

#### (async, static) setName(Name) → {Promise.<*>}

获取图层名称

##### Parameters:

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

Source:
  - MapLayer.js, line 62

##### Returns:

Type
  Promise.<*>

#### (async, static) setState(State)

设置图层状态

##### Parameters:

Name | Type | Description
--- | --- | ---
`State` | Boolean | 图层状态

Source:
  - MapLayer.js, line 116

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

设置图层URL地址

##### Parameters:

Name | Type | Description
--- | --- | ---
`URL` | String | 图层URL地址

Source:
  - MapLayer.js, line 90

##### Returns:

Type
  Promise.<void>

#### (async, static) setVisible(visible)

设置图层是否显示

##### Parameters:

Name | Type | Description
--- | --- | ---
`visible` | Boolean | 图层是否显示

Source:
  - MapLayer.js, line 128

#### (async, static) setWeight(Weight)

设置图层的权重

##### Parameters:

Name | Type | Description
--- | --- | ---
`Weight` | String | 权重

Source:
  - MapLayer.js, line 215

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

存为XML

##### Parameters:

Name | Type | Description
--- | --- | ---
`onlyStyle` | boolean | true:仅导出样式 false:除图层样式信息外还包括图层的name、geometryType、url、layerWeight、state信息

Source:
  - MapLayer.js, line 432

##### Returns:

xml

Type
  String