ol/layer/Vector.js
父类
ol/layer/BaseVectorLayer-BaseVectorLayer
主要功能
渲染矢量图层。
任意设置的属性将被设置为基础属性,可以进行get/set。
参数:VectorLayer({})
参数 | 类型 | 说明 |
---|---|---|
visible | boolean (defaults to true) | 是否可见,默认可见 |
zIndex | number | 图层渲染的层级,若未指定则按加入layers的顺序显示,若使用setMap则为无限大 |
source* | module:ol/source/VectorVectorSource<br/>module:ol/source/VectorTileVectorTile | 数据源 |
properties | Object.<string, *> | 任意属性,可以用get() 和 set()访问。 |
方法
/**
* @module ol/layer/Vector
*/
import BaseVectorLayer from './BaseVector.js';
import CanvasVectorLayerRenderer from '../renderer/canvas/VectorLayer.js';
/**
* @classdesc
* Vector data that is rendered client-side.
* Note that any property set in the options is set as a {@link module:ol/Object~BaseObject}
* property on the layer object; for example, setting `title: 'My Title'` in the
* options means that `title` is observable, and has get/set accessors.
*
* @template {import("../source/Vector.js").default} VectorSourceType
* @extends {BaseVectorLayer<VectorSourceType>}
* @api
*/
class VectorLayer extends BaseVectorLayer {
/**
* @param {import("./BaseVector.js").Options<VectorSourceType>} [opt_options] Options.
*/
constructor(opt_options) {
super(opt_options);
}
/**
* Create a renderer for this layer.
* @return {import("../renderer/Layer.js").default} A layer renderer.
*/
createRenderer() {
return new CanvasVectorLayerRenderer(this);
}
}
export default VectorLayer;