FeatureCollection

FeatureCollection

矢量要素的抽象,用于描述一个要添加到场景中的矢量要素数据 目前,仅支持GeoJSON和TopoJSON两种格式,且不建议对应的文件体积过大, 否则将影像渲染性能

Constructor

new FeatureCollection(options)

Parameters:

Name Type Description
options FeatureCollection.ConstructorOptions

Members

(readonly) layer

Description:
  • 获取矢量数据所属图层的ID

获取矢量数据所属图层的ID

layer

Description:
  • 设置矢量数据所属图层的ID

设置矢量数据所属图层的ID

(readonly) type

Description:
  • 获取当前矢量数据的类型

获取当前矢量数据的类型

Methods

data() → {m3d.DataSource}

Description:
  • 返回矢量要素数据

Returns:

getFeatureCollection() → {m3d.DataSource}

Description:
  • 返回矢量要素数据

Returns:

hide()

Description:
  • 隐藏矢量数据

show()

Description:
  • 显示矢量数据

Type Definitions

ConstructorOptions

Properties:
Name Type Attributes Default Description
id string

矢量要素数据的ID

name string

矢量要素数据的名称

type SourceType

矢量要素数据的类型

show boolean <optional>
true

设置加载完矢量要素数据后,默认是否显示

source Object

矢量数据的数据源,包括以下属性字段:

Properties
Name Type Description
url string

矢量数据的地址

preferences Object <optional>

矢量数据渲染效果的偏好设置,包括以下属性字段:

Properties
Name Type Attributes Default Description
strokeWidth number <optional>
2.0

线条宽度

strokeColor Array.<number> | string <optional>
[0, 0, 0, 1.0]

线条颜色,一个RGBA格式的数组,或16进制颜色字符串

fillColor Array.<number> | string <optional>
[255, 255, 0, 1.0]

填充颜色,一个RGBA格式的数组,或16进制颜色字符串

markerSymbol string <optional>

点的默认符号,可参考Mapbox的符号库:http://mapbox.com/maki/

markerSize number <optional>
48

点的默认符号的大小

markerColor Array.<number> | string <optional>
'#4169E1'

点的默认符号的颜色,一个RGBA格式的数组,或16进制颜色字符串

Type:
  • Object