@deck.gl/geo-layers
Version:
deck.gl layers supporting geospatial use cases and GIS formats
81 lines (70 loc) • 1.81 kB
JavaScript
import {CompositeLayer} from '@deck.gl/core';
import {PolygonLayer} from '@deck.gl/layers';
const defaultProps = {
...PolygonLayer.defaultProps
};
export default class GeoCellLayer extends CompositeLayer {
// Implement to generate props to create geometry
indexToBounds() {
return null;
}
renderLayers() {
// Rendering props underlying layer
const {
elevationScale,
extruded,
wireframe,
filled,
stroked,
lineWidthUnits,
lineWidthScale,
lineWidthMinPixels,
lineWidthMaxPixels,
lineJointRounded,
lineMiterLimit,
lineDashJustified,
getElevation,
getFillColor,
getLineColor,
getLineWidth
} = this.props;
// Accessor props for underlying layers
const {updateTriggers, material, transitions} = this.props;
// Filled Polygon Layer
const CellLayer = this.getSubLayerClass('cell', PolygonLayer);
return new CellLayer(
{
filled,
wireframe,
extruded,
elevationScale,
stroked,
lineWidthUnits,
lineWidthScale,
lineWidthMinPixels,
lineWidthMaxPixels,
lineJointRounded,
lineMiterLimit,
lineDashJustified,
material,
transitions,
getElevation,
getFillColor,
getLineColor,
getLineWidth
},
this.getSubLayerProps({
id: 'cell',
updateTriggers: {
getElevation: updateTriggers.getElevation,
getFillColor: updateTriggers.getFillColor,
getLineColor: updateTriggers.getLineColor,
getLineWidth: updateTriggers.getLineWidth
}
}),
this.indexToBounds()
);
}
}
GeoCellLayer.layerName = 'GeoCellLayer';
GeoCellLayer.defaultProps = defaultProps;