arcgis 官网有与deckgl整合的二维
三维整合也是可以,不过还是有点bug
我们先构建基础类
基础图层
- const {loadArcGISModules} = require("@deck.gl/arcgis");
- export default class BaseLayer {
- layer: any;
- init(view: any) {
- return new Promise((resolve, reject) => {
- loadArcGISModules().then(({DeckLayer}: any) => {
- this.layer = new DeckLayer();
- const map = view.map;
- map.add(this.layer);
- resolve()
- });
- })
- }
- removeLayer(view: any) {
- const map = view.map;
- map.remove(this.layer);
- }
- }
针对deckgl 颜色控制 做一个工具类
```javascript
export default class ColorManager {
static colorToRGB(color: any) {
let rgb;
if (color.includes('#')) {
rgb = this.HtoRGB(color);
} else if (color.includes('rgb')) {
rgb = this.rgbaToRGB(color)
} else {
rgb = color;
}