针对HexagonLayer
HexagonLayer 的数据构建器
const axios =?require('axios')
export?default?class?TripsLayerParser {
static getDataFromUrl(url: string) {
return?new?Promise((resolve => {
const queryUrl =?`${url}/query?where=1%3D1&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=%5B%5D&returnGeometry=true&returnTrueCurves=false&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&resultOffset=&resultRecordCount=&queryByDistance=&returnExtentsOnly=false&datumTransformation=¶meterValues=&rangeValues=&f=geojson`
axios.get(queryUrl).then((r: any) => {
resolve(r.data.features);
});
}));
}
static getDataFromJsonUrl(url: string) {
return?new?Promise((resolve => {
axios.get(url).then((r: any) => {
resolve(r.data.features);
});
}));
}
}
三维base
const {loadArcGISModules} =?require("@deck.gl/arcgis");
export?default?class?BaseLayer3D {
deckRender: any;
init(_view: any) {
return loadArcGISModules(['esri/views/3d/externalRenderers']).then(({DeckRenderer, modules}: any) => {
const view = _view;
const [externalRenderers] = modules;
this.deckRender =?new DeckRenderer(view, {});
externalRenderers.add(view,?this.deckRender);
});
}
removeLayer() {
this.deckRender.deck.layers = [];
}
}
DeckHexagonLayer 主类
``` javascript
import HexagonLayerParser from "./HexagonLayerParser";
import ColorManager from "./ColorManager";
import BaseLayer3D from "./BaseLayer3D";
const {HexagonLayer} = require("@deck.gl/aggregation-layers");
interface INoop?{
(args?: T): void
}
const noop: INoop?= () => {
}
更多参考arcgis 4 与deckgl 整合 (三) - 小专栏 (xiaozhuanlan.com)