/*``
* @Author: tjc
* @Date: 2017-04-20 17:03:05
* @Last Modified by: hydata
* @Last Modified time: 2018-05-10 17:14:21
* @Email: 304861063@qq.com
* @File Path: F:\work\hyMap\src\components\layer\buildingLayer.js
* @File Name: clustersLayer.js
* @Descript:多边形拉伸图层
*/
import baseLayer from './baseLayer';
/**
* 带高度建筑层
* @extends baseLayer
*/
class FillExtrusionLayer extends baseLayer {
/**
* 带高度建筑层
* 初始化
* @param {*} options
*/
constructor(options) {
super(options);
this.geojson = this.init(options.serie);
this.data = options;
}
/**
* 初始化json
* @param {*} data
*/
initGeojson(data){
// console.log(data);
return {
'id': 'room-extrusion1',
'type': 'fill-extrusion',
'source': {
'type': 'geojson',
'data': data
},
'paint': {
'fill-extrusion-color': {
// Get the fill-extrusion-color from the source 'color' property.
'property': 'color',
'type': 'identity'
},
'fill-extrusion-height': {
// Get fill-extrusion-height from the source 'height' property.
'property': 'height',
'type': 'identity'
},
'fill-extrusion-base': {
// Get fill-extrusion-base from the source 'base_height' property.
'property': 'base_height',
'type': 'identity'
},
// Make extrusions slightly opaque for see through indoor walls.
'fill-extrusion-opacity': 0.5
}
};
}
/**
* 初始化
* @param {*} serie
*/
init(serie) {
this.geojson=this.initGeojson(serie.data);
this.map.addLayer(this.geojson);
}
/**
* 获取json
*/
getJson() {
return this.geojson;
}
}
export default FillExtrusionLayer;