@antv/l7-layers 2.14.1 → 2.14.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/models/billboard.js +3 -6
- package/es/Geometry/models/plane.js +3 -6
- package/es/core/BaseLayer.d.ts +7 -3
- package/es/core/BaseLayer.js +62 -18
- package/es/core/BaseModel.d.ts +3 -2
- package/es/core/BaseModel.js +39 -3
- package/es/core/LayerPickService.js +6 -2
- package/es/heatmap/index.d.ts +2 -2
- package/es/heatmap/index.js +5 -2
- package/es/heatmap/models/grid.js +5 -9
- package/es/heatmap/models/grid3d.js +5 -10
- package/es/heatmap/models/heatmap.d.ts +2 -2
- package/es/heatmap/models/heatmap.js +54 -46
- package/es/heatmap/models/hexagon.js +5 -10
- package/es/image/models/image.js +13 -16
- package/es/image/shaders/image_frag.glsl +2 -0
- package/es/index.js +6 -0
- package/es/line/models/arc.js +4 -6
- package/es/line/models/arc_3d.js +4 -6
- package/es/line/models/earthArc_3d.js +4 -6
- package/es/line/models/great_circle.js +9 -13
- package/es/line/models/half.js +4 -6
- package/es/line/models/line.js +3 -5
- package/es/line/models/linearline.js +4 -6
- package/es/line/models/simpleLine.js +5 -8
- package/es/mask/models/fill.js +1 -17
- package/es/plugins/LayerMaskPlugin.d.ts +8 -0
- package/es/plugins/LayerMaskPlugin.js +42 -0
- package/es/plugins/LayerStylePlugin.js +2 -1
- package/es/point/models/extrude.js +0 -1
- package/es/point/models/fill.js +4 -6
- package/es/point/models/fillmage.js +8 -12
- package/es/point/models/image.js +9 -14
- package/es/point/models/normal.js +4 -9
- package/es/point/models/radar.js +5 -10
- package/es/point/models/simplePoint.js +5 -10
- package/es/point/models/text.js +10 -16
- package/es/point/shaders/fill_frag.glsl +4 -0
- package/es/point/shaders/image_frag.glsl +4 -0
- package/es/point/shaders/text_frag.glsl +4 -0
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +11 -13
- package/es/polygon/models/fill.js +3 -5
- package/es/polygon/models/ocean.js +6 -9
- package/es/polygon/models/water.js +7 -11
- package/es/raster/models/raster.js +9 -11
- package/es/raster/models/rasterRgb.js +8 -11
- package/es/raster/models/rasterTerrainRgb.js +9 -13
- package/es/raster/shaders/raster_2d_frag.glsl +6 -3
- package/es/raster/shaders/raster_frag.glsl +2 -0
- package/es/raster/shaders/raster_rgb_frag.glsl +2 -0
- package/es/raster/shaders/raster_terrain_rgb_frag.glsl +2 -0
- package/es/tile/service/TileLayerService.js +5 -4
- package/es/tile/style/constants.js +1 -1
- package/es/tile/tileFactory/Tile.d.ts +8 -0
- package/es/tile/tileFactory/Tile.js +102 -14
- package/es/tile/tileFactory/VectorTile.d.ts +0 -1
- package/es/tile/tileFactory/VectorTile.js +6 -46
- package/es/tile/tileLayer/BaseLayer.d.ts +1 -0
- package/es/tile/tileLayer/BaseLayer.js +5 -0
- package/es/utils/stencil.d.ts +7 -0
- package/es/utils/stencil.js +50 -0
- package/es/wind/index.d.ts +2 -1
- package/es/wind/index.js +3 -1
- package/es/wind/models/wind.d.ts +2 -2
- package/es/wind/models/wind.js +12 -10
- package/lib/Geometry/models/billboard.js +3 -7
- package/lib/Geometry/models/plane.js +2 -6
- package/lib/core/BaseLayer.js +62 -18
- package/lib/core/BaseModel.js +40 -2
- package/lib/core/LayerPickService.js +6 -2
- package/lib/heatmap/index.js +5 -2
- package/lib/heatmap/models/grid.js +5 -10
- package/lib/heatmap/models/grid3d.js +5 -11
- package/lib/heatmap/models/heatmap.js +53 -45
- package/lib/heatmap/models/hexagon.js +5 -11
- package/lib/image/models/image.js +12 -15
- package/lib/image/shaders/image_frag.glsl +2 -0
- package/lib/index.js +8 -0
- package/lib/line/models/arc.js +3 -5
- package/lib/line/models/arc_3d.js +3 -5
- package/lib/line/models/earthArc_3d.js +3 -5
- package/lib/line/models/great_circle.js +8 -12
- package/lib/line/models/half.js +3 -5
- package/lib/line/models/line.js +2 -4
- package/lib/line/models/linearline.js +3 -5
- package/lib/line/models/simpleLine.js +4 -7
- package/lib/mask/models/fill.js +1 -18
- package/lib/plugins/LayerMaskPlugin.js +54 -0
- package/lib/plugins/LayerStylePlugin.js +2 -1
- package/lib/point/models/extrude.js +0 -1
- package/lib/point/models/fill.js +3 -5
- package/lib/point/models/fillmage.js +7 -11
- package/lib/point/models/image.js +9 -15
- package/lib/point/models/normal.js +4 -10
- package/lib/point/models/radar.js +5 -11
- package/lib/point/models/simplePoint.js +5 -11
- package/lib/point/models/text.js +9 -15
- package/lib/point/shaders/fill_frag.glsl +4 -0
- package/lib/point/shaders/image_frag.glsl +4 -0
- package/lib/point/shaders/text_frag.glsl +4 -0
- package/lib/polygon/index.js +1 -1
- package/lib/polygon/models/extrude.js +10 -12
- package/lib/polygon/models/fill.js +2 -4
- package/lib/polygon/models/ocean.js +5 -8
- package/lib/polygon/models/water.js +7 -12
- package/lib/raster/models/raster.js +8 -10
- package/lib/raster/models/rasterRgb.js +8 -12
- package/lib/raster/models/rasterTerrainRgb.js +8 -12
- package/lib/raster/shaders/raster_2d_frag.glsl +6 -3
- package/lib/raster/shaders/raster_frag.glsl +2 -0
- package/lib/raster/shaders/raster_rgb_frag.glsl +2 -0
- package/lib/raster/shaders/raster_terrain_rgb_frag.glsl +2 -0
- package/lib/tile/service/TileLayerService.js +5 -4
- package/lib/tile/style/constants.js +1 -1
- package/lib/tile/tileFactory/Tile.js +102 -14
- package/lib/tile/tileFactory/VectorTile.js +6 -47
- package/lib/tile/tileLayer/BaseLayer.js +5 -0
- package/lib/utils/stencil.js +60 -0
- package/lib/wind/index.js +3 -1
- package/lib/wind/models/wind.js +11 -9
- package/package.json +7 -7
|
@@ -14,7 +14,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
14
14
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
15
|
|
|
16
16
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
17
|
-
import { getMask } from '@antv/l7-utils';
|
|
18
17
|
import BaseModel from "../../core/BaseModel";
|
|
19
18
|
|
|
20
19
|
/* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
|
|
@@ -104,13 +103,13 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
104
103
|
key: "initModels",
|
|
105
104
|
value: function () {
|
|
106
105
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
107
|
-
var _ref3,
|
|
106
|
+
var _ref3, drawCanvas, createTexture2D, model;
|
|
108
107
|
|
|
109
108
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
110
109
|
while (1) {
|
|
111
110
|
switch (_context.prev = _context.next) {
|
|
112
111
|
case 0:
|
|
113
|
-
_ref3 = this.layer.getLayerConfig(),
|
|
112
|
+
_ref3 = this.layer.getLayerConfig(), drawCanvas = _ref3.drawCanvas;
|
|
114
113
|
createTexture2D = this.rendererService.createTexture2D;
|
|
115
114
|
this.texture = createTexture2D({
|
|
116
115
|
height: 0,
|
|
@@ -130,9 +129,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
130
129
|
primitive: gl.TRIANGLES,
|
|
131
130
|
depth: {
|
|
132
131
|
enable: true
|
|
133
|
-
}
|
|
134
|
-
blend: this.getBlend(),
|
|
135
|
-
stencil: getMask(mask, maskInside)
|
|
132
|
+
}
|
|
136
133
|
});
|
|
137
134
|
|
|
138
135
|
case 6:
|
|
@@ -15,8 +15,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
15
15
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
16
16
|
|
|
17
17
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
18
|
-
import { Version } from '@antv/l7-maps';
|
|
19
|
-
import { getMask } from '@antv/l7-utils'; // import { mat4, vec3 } from 'gl-matrix';
|
|
18
|
+
import { Version } from '@antv/l7-maps'; // import { mat4, vec3 } from 'gl-matrix';
|
|
20
19
|
|
|
21
20
|
import BaseModel from "../../core/BaseModel";
|
|
22
21
|
|
|
@@ -179,13 +178,13 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
179
178
|
key: "initModels",
|
|
180
179
|
value: function () {
|
|
181
180
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
182
|
-
var _ref5,
|
|
181
|
+
var _ref5, mapTexture, createTexture2D, model;
|
|
183
182
|
|
|
184
183
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
185
184
|
while (1) {
|
|
186
185
|
switch (_context.prev = _context.next) {
|
|
187
186
|
case 0:
|
|
188
|
-
_ref5 = this.layer.getLayerConfig(),
|
|
187
|
+
_ref5 = this.layer.getLayerConfig(), mapTexture = _ref5.mapTexture;
|
|
189
188
|
this.mapTexture = mapTexture;
|
|
190
189
|
createTexture2D = this.rendererService.createTexture2D;
|
|
191
190
|
this.texture = createTexture2D({
|
|
@@ -203,8 +202,6 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
203
202
|
depth: {
|
|
204
203
|
enable: true
|
|
205
204
|
},
|
|
206
|
-
stencil: getMask(mask, maskInside),
|
|
207
|
-
blend: this.getBlend(),
|
|
208
205
|
cull: {
|
|
209
206
|
enable: true,
|
|
210
207
|
face: gl.BACK // gl.FRONT | gl.BACK;
|
package/es/core/BaseLayer.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
2
|
-
import { BlendType, IActiveOption, IAnimateOption, IAttributeAndElements, ICameraService, ICoordinateSystemService, IDataState, IDebugService, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, IInteractionService, ILayer, ILayerAttributesOption, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPickService, ILayerPlugin, ILayerService, ILegend, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IParseDataItem, IPass, IPickingService, IPostProcessingPass, IRendererService, IScale, IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, ITextureService, LayerEventType, LegendItems, StyleAttributeField, StyleAttributeOption, Triangulation } from '@antv/l7-core';
|
|
2
|
+
import { BlendType, IActiveOption, IAnimateOption, IAttributeAndElements, ICameraService, ICoordinateSystemService, IDataState, IDebugService, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, IInteractionService, ILayer, ILayerAttributesOption, ILayerConfig, ILayerModel, ILayerModelInitializationOptions, ILayerPickService, ILayerPlugin, ILayerService, ILegend, IMapService, IModel, IModelInitializationOptions, IMultiPassRenderer, IParseDataItem, IPass, IPickingService, IPostProcessingPass, IRendererService, IRenderOptions, IScale, IScaleOptions, IShaderModuleService, ISourceCFG, IStyleAttributeService, IStyleAttributeUpdateOptions, ITextureService, LayerEventType, LegendItems, StyleAttributeField, StyleAttributeOption, Triangulation } from '@antv/l7-core';
|
|
3
3
|
import Source from '@antv/l7-source';
|
|
4
4
|
import { EventEmitter } from 'eventemitter3';
|
|
5
5
|
import { Container } from 'inversify';
|
|
@@ -102,6 +102,10 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
102
102
|
private animateStatus;
|
|
103
103
|
private isDestroyed;
|
|
104
104
|
constructor(config?: Partial<ILayerConfig & ChildLayerStyleOptions>);
|
|
105
|
+
addMask(layer: ILayer): void;
|
|
106
|
+
removeMask(layer: ILayer): void;
|
|
107
|
+
disableMask(): void;
|
|
108
|
+
enableMask(): void;
|
|
105
109
|
addMaskLayer(maskLayer: ILayer): void;
|
|
106
110
|
removeMaskLayer(maskLayer: ILayer): void;
|
|
107
111
|
getAttribute(name: string): import("@antv/l7-core").IStyleAttribute | undefined;
|
|
@@ -142,7 +146,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
142
146
|
* 渲染所有的图层
|
|
143
147
|
*/
|
|
144
148
|
renderLayers(): void;
|
|
145
|
-
render(): ILayer;
|
|
149
|
+
render(options?: Partial<IRenderOptions>): ILayer;
|
|
146
150
|
/**
|
|
147
151
|
* renderMultiPass 专门用于渲染支持 multipass 的 layer
|
|
148
152
|
*/
|
|
@@ -209,7 +213,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
209
213
|
buildModels(): Promise<void>;
|
|
210
214
|
rebuildModels(): Promise<void>;
|
|
211
215
|
renderMulPass(multiPassRenderer: IMultiPassRenderer): Promise<void>;
|
|
212
|
-
renderModels(
|
|
216
|
+
renderModels(options?: Partial<IRenderOptions>): this;
|
|
213
217
|
updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): boolean;
|
|
214
218
|
getLayerAttributeConfig(): Partial<ILayerAttributesOption>;
|
|
215
219
|
getShaderPickStat(): boolean;
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -173,10 +173,41 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
_createClass(BaseLayer, [{
|
|
176
|
+
key: "addMask",
|
|
177
|
+
value: function addMask(layer) {
|
|
178
|
+
this.masks.push(layer);
|
|
179
|
+
this.enableMask();
|
|
180
|
+
}
|
|
181
|
+
}, {
|
|
182
|
+
key: "removeMask",
|
|
183
|
+
value: function removeMask(layer) {
|
|
184
|
+
var layerIndex = this.masks.indexOf(layer);
|
|
185
|
+
|
|
186
|
+
if (layerIndex > -1) {
|
|
187
|
+
this.masks.splice(layerIndex, 1);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}, {
|
|
191
|
+
key: "disableMask",
|
|
192
|
+
value: function disableMask() {
|
|
193
|
+
this.updateLayerConfig({
|
|
194
|
+
enableMask: false
|
|
195
|
+
});
|
|
196
|
+
}
|
|
197
|
+
}, {
|
|
198
|
+
key: "enableMask",
|
|
199
|
+
value: function enableMask() {
|
|
200
|
+
this.updateLayerConfig({
|
|
201
|
+
enableMask: true
|
|
202
|
+
});
|
|
203
|
+
} // 将废弃
|
|
204
|
+
|
|
205
|
+
}, {
|
|
176
206
|
key: "addMaskLayer",
|
|
177
207
|
value: function addMaskLayer(maskLayer) {
|
|
178
208
|
this.masks.push(maskLayer);
|
|
179
|
-
}
|
|
209
|
+
} // 将废弃
|
|
210
|
+
|
|
180
211
|
}, {
|
|
181
212
|
key: "removeMaskLayer",
|
|
182
213
|
value: function removeMaskLayer(maskLayer) {
|
|
@@ -352,7 +383,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
352
383
|
|
|
353
384
|
case 31:
|
|
354
385
|
this.log(IDebugLog.LayerInitEnd);
|
|
355
|
-
this.inited = true; //
|
|
386
|
+
this.inited = true; // add mask layer
|
|
387
|
+
// 触发初始化完成事件;
|
|
356
388
|
|
|
357
389
|
this.emit('inited', {
|
|
358
390
|
target: this,
|
|
@@ -649,6 +681,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
649
681
|
}, {
|
|
650
682
|
key: "render",
|
|
651
683
|
value: function render() {
|
|
684
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
685
|
+
|
|
652
686
|
if (this.tileLayer) {
|
|
653
687
|
// 瓦片图层执行单独的 render 渲染队列
|
|
654
688
|
this.tileLayer.render();
|
|
@@ -662,7 +696,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
662
696
|
} // Tip: this.getEncodedData().length !== 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
663
697
|
|
|
664
698
|
|
|
665
|
-
this.renderModels();
|
|
699
|
+
this.renderModels(options);
|
|
666
700
|
return this;
|
|
667
701
|
}
|
|
668
702
|
/**
|
|
@@ -834,8 +868,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
834
868
|
value: function setBlend(type) {
|
|
835
869
|
this.updateLayerConfig({
|
|
836
870
|
blend: type
|
|
837
|
-
});
|
|
838
|
-
|
|
871
|
+
}); // this.layerModelNeedUpdate = true;
|
|
872
|
+
|
|
839
873
|
this.reRender();
|
|
840
874
|
return this;
|
|
841
875
|
}
|
|
@@ -1020,12 +1054,18 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1020
1054
|
this.layerChildren.map(function (child) {
|
|
1021
1055
|
return child.destroy(false);
|
|
1022
1056
|
});
|
|
1023
|
-
this.layerChildren = []; // remove mask list
|
|
1057
|
+
this.layerChildren = []; // remove mask list maskfence 掩膜需要销毁
|
|
1058
|
+
|
|
1059
|
+
var _this$getLayerConfig10 = this.getLayerConfig(),
|
|
1060
|
+
maskfence = _this$getLayerConfig10.maskfence;
|
|
1061
|
+
|
|
1062
|
+
if (maskfence) {
|
|
1063
|
+
this.masks.map(function (mask) {
|
|
1064
|
+
return mask.destroy(false);
|
|
1065
|
+
});
|
|
1066
|
+
this.masks = [];
|
|
1067
|
+
}
|
|
1024
1068
|
|
|
1025
|
-
this.masks.map(function (mask) {
|
|
1026
|
-
return mask.destroy(false);
|
|
1027
|
-
});
|
|
1028
|
-
this.masks = [];
|
|
1029
1069
|
this.hooks.beforeDestroy.call(); // 清除sources事件
|
|
1030
1070
|
|
|
1031
1071
|
this.layerSource.off('update', this.sourceEvent);
|
|
@@ -1361,11 +1401,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1361
1401
|
}, {
|
|
1362
1402
|
key: "needPick",
|
|
1363
1403
|
value: function needPick(type) {
|
|
1364
|
-
var _this$
|
|
1365
|
-
_this$
|
|
1366
|
-
enableHighlight = _this$
|
|
1367
|
-
_this$
|
|
1368
|
-
enableSelect = _this$
|
|
1404
|
+
var _this$getLayerConfig11 = this.getLayerConfig(),
|
|
1405
|
+
_this$getLayerConfig12 = _this$getLayerConfig11.enableHighlight,
|
|
1406
|
+
enableHighlight = _this$getLayerConfig12 === void 0 ? true : _this$getLayerConfig12,
|
|
1407
|
+
_this$getLayerConfig13 = _this$getLayerConfig11.enableSelect,
|
|
1408
|
+
enableSelect = _this$getLayerConfig13 === void 0 ? true : _this$getLayerConfig13; // 判断layer是否监听事件;
|
|
1369
1409
|
|
|
1370
1410
|
|
|
1371
1411
|
var isPick = this.eventNames().indexOf(type) !== -1 || this.eventNames().indexOf('un' + type) !== -1;
|
|
@@ -1456,9 +1496,11 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1456
1496
|
}()
|
|
1457
1497
|
}, {
|
|
1458
1498
|
key: "renderModels",
|
|
1459
|
-
value: function renderModels(
|
|
1499
|
+
value: function renderModels() {
|
|
1460
1500
|
var _this11 = this;
|
|
1461
1501
|
|
|
1502
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1503
|
+
|
|
1462
1504
|
// TODO: this.getEncodedData().length > 0 这个判断是为了解决在 2.5.x 引入数据纹理后产生的 空数据渲染导致 texture 超出上限问题
|
|
1463
1505
|
if (this.encodeDataLength <= 0 && !this.forceRender) {
|
|
1464
1506
|
return this;
|
|
@@ -1467,8 +1509,10 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1467
1509
|
this.hooks.beforeRender.call();
|
|
1468
1510
|
this.models.forEach(function (model) {
|
|
1469
1511
|
model.draw({
|
|
1470
|
-
uniforms: _this11.layerModel.getUninforms()
|
|
1471
|
-
|
|
1512
|
+
uniforms: _this11.layerModel.getUninforms(),
|
|
1513
|
+
blend: _this11.layerModel.getBlend(),
|
|
1514
|
+
stencil: _this11.layerModel.getStencil(options)
|
|
1515
|
+
}, (options === null || options === void 0 ? void 0 : options.ispick) || false);
|
|
1472
1516
|
});
|
|
1473
1517
|
this.hooks.afterRender.call();
|
|
1474
1518
|
return this;
|
package/es/core/BaseModel.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IAnimateOption, IAttribute, IBlendOptions, ICameraService, IElements, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IShaderModuleService, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
|
|
1
|
+
import { IAnimateOption, IAttribute, IBlendOptions, ICameraService, IElements, IEncodeFeature, IFontService, IGlobalConfigService, IIconService, ILayer, ILayerModel, ILayerService, IMapService, IModel, IModelUniform, IPickingService, IRendererService, IRenderOptions, IShaderModuleService, IStencilOptions, IStyleAttributeService, ITexture2D, ITexture2DInitializationOptions, Triangulation } from '@antv/l7-core';
|
|
2
2
|
export type styleSingle = number | string | [string, (single: any) => number] | [string, [number, number]];
|
|
3
3
|
export type styleOffset = string | [number, number] | [string, (single: any) => number];
|
|
4
4
|
export type styleColor = string | [string, (single: any) => string] | [string, [string, string]];
|
|
@@ -120,6 +120,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerMod
|
|
|
120
120
|
*/
|
|
121
121
|
calDataFrame(cellLength: number, encodeData: IEncodeFeature[], cellPropertiesLayouts: ICellProperty[]): IDataTextureFrame;
|
|
122
122
|
getBlend(): IBlendOptions;
|
|
123
|
+
getStencil(option: Partial<IRenderOptions>): Partial<IStencilOptions>;
|
|
123
124
|
getDefaultStyle(): unknown;
|
|
124
125
|
getUninforms(): IModelUniform;
|
|
125
126
|
getAnimateUniforms(): IModelUniform;
|
|
@@ -133,7 +134,7 @@ export default class BaseModel<ChildLayerStyleOptions = {}> implements ILayerMod
|
|
|
133
134
|
};
|
|
134
135
|
elements: IElements;
|
|
135
136
|
};
|
|
136
|
-
render(): void;
|
|
137
|
+
render(renderOptions?: Partial<IRenderOptions>): void;
|
|
137
138
|
protected registerBuiltinAttributes(): void;
|
|
138
139
|
protected animateOption2Array(option: IAnimateOption): number[];
|
|
139
140
|
protected startModelAnimate(): void;
|
package/es/core/BaseModel.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
3
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
3
4
|
import _initializerDefineProperty from "@babel/runtime/helpers/esm/initializerDefineProperty";
|
|
4
5
|
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
|
|
@@ -17,11 +18,12 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
17
18
|
|
|
18
19
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
19
20
|
|
|
20
|
-
import { BlendType, gl, lazyInject, TYPES } from '@antv/l7-core';
|
|
21
|
+
import { BlendType, gl, lazyInject, MaskOperation, StencilType, TYPES } from '@antv/l7-core';
|
|
21
22
|
import { rgb2arr } from '@antv/l7-utils';
|
|
22
23
|
import { color } from 'd3-color';
|
|
23
24
|
import { isEqual, isNumber, isString } from 'lodash';
|
|
24
25
|
import { BlendTypes } from "../utils/blend";
|
|
26
|
+
import { getStencil as _getStencil, getStencilMask } from "../utils/stencil";
|
|
25
27
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
26
28
|
var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__PURE__*/function () {
|
|
27
29
|
// style texture data mapping
|
|
@@ -412,6 +414,39 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
412
414
|
|
|
413
415
|
return BlendTypes[BlendType[blend]];
|
|
414
416
|
}
|
|
417
|
+
}, {
|
|
418
|
+
key: "getStencil",
|
|
419
|
+
value: function getStencil(option) {
|
|
420
|
+
var _this$layer$getLayerC3 = this.layer.getLayerConfig(),
|
|
421
|
+
_this$layer$getLayerC4 = _this$layer$getLayerC3.mask,
|
|
422
|
+
mask = _this$layer$getLayerC4 === void 0 ? false : _this$layer$getLayerC4,
|
|
423
|
+
_this$layer$getLayerC5 = _this$layer$getLayerC3.maskInside,
|
|
424
|
+
maskInside = _this$layer$getLayerC5 === void 0 ? true : _this$layer$getLayerC5,
|
|
425
|
+
enableMask = _this$layer$getLayerC3.enableMask,
|
|
426
|
+
_this$layer$getLayerC6 = _this$layer$getLayerC3.maskOperation,
|
|
427
|
+
maskOperation = _this$layer$getLayerC6 === void 0 ? MaskOperation.AND : _this$layer$getLayerC6; // TODO 临时处理,后期移除MaskLayer
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
if (this.layer.type === 'MaskLayer') {
|
|
431
|
+
return getStencilMask({
|
|
432
|
+
isStencil: true,
|
|
433
|
+
stencilType: StencilType.SINGLE
|
|
434
|
+
}); // 用于遮罩的stencil 参数
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
if (option.isStencil) {
|
|
438
|
+
return getStencilMask(_objectSpread(_objectSpread({}, option), {}, {
|
|
439
|
+
maskOperation: maskOperation
|
|
440
|
+
})); // 用于遮罩的stencil 参数
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
var maskflag = mask || // mask 兼容历史写法
|
|
444
|
+
enableMask && this.layer.masks.length !== 0 || // 外部图层的mask
|
|
445
|
+
this.layer.tileMask !== undefined; // 瓦片图层
|
|
446
|
+
// !!(mask || enableMask || this.layer.tileMask);
|
|
447
|
+
|
|
448
|
+
return _getStencil(maskflag, maskInside);
|
|
449
|
+
}
|
|
415
450
|
}, {
|
|
416
451
|
key: "getDefaultStyle",
|
|
417
452
|
value: function getDefaultStyle() {
|
|
@@ -512,10 +547,11 @@ var BaseModel = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
512
547
|
key: "getAttribute",
|
|
513
548
|
value: function getAttribute() {
|
|
514
549
|
throw new Error('Method not implemented.');
|
|
515
|
-
}
|
|
550
|
+
} // eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
551
|
+
|
|
516
552
|
}, {
|
|
517
553
|
key: "render",
|
|
518
|
-
value: function render() {
|
|
554
|
+
value: function render(renderOptions) {
|
|
519
555
|
throw new Error('Method not implemented.');
|
|
520
556
|
}
|
|
521
557
|
}, {
|
|
@@ -35,7 +35,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
35
35
|
while (1) {
|
|
36
36
|
switch (_context.prev = _context.next) {
|
|
37
37
|
case 0:
|
|
38
|
-
m.render(
|
|
38
|
+
m.render({
|
|
39
|
+
isStencil: true
|
|
40
|
+
});
|
|
39
41
|
|
|
40
42
|
case 1:
|
|
41
43
|
case "end":
|
|
@@ -51,7 +53,9 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
51
53
|
}());
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
layer.renderModels(
|
|
56
|
+
layer.renderModels({
|
|
57
|
+
ispick: true
|
|
58
|
+
});
|
|
55
59
|
layer.hooks.afterPickingEncode.call();
|
|
56
60
|
}
|
|
57
61
|
}, {
|
package/es/heatmap/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { IAttributeAndElements } from '@antv/l7-core';
|
|
1
|
+
import { IAttributeAndElements, IRenderOptions } from '@antv/l7-core';
|
|
2
2
|
import BaseLayer from '../core/BaseLayer';
|
|
3
3
|
import { IHeatMapLayerStyleOptions } from '../core/interface';
|
|
4
4
|
import { HeatMapModelType } from './models';
|
|
5
5
|
export default class HeatMapLayer extends BaseLayer<IHeatMapLayerStyleOptions> {
|
|
6
6
|
type: string;
|
|
7
7
|
buildModels(): Promise<void>;
|
|
8
|
-
renderModels(): this;
|
|
8
|
+
renderModels(options?: Partial<IRenderOptions>): this;
|
|
9
9
|
updateModelData(data: IAttributeAndElements): void;
|
|
10
10
|
getModelType(): HeatMapModelType;
|
|
11
11
|
}
|
package/es/heatmap/index.js
CHANGED
|
@@ -69,11 +69,12 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
69
69
|
value: function renderModels() {
|
|
70
70
|
var _this2 = this;
|
|
71
71
|
|
|
72
|
+
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
72
73
|
var shape = this.getModelType();
|
|
73
74
|
|
|
74
75
|
if (shape === 'heatmap') {
|
|
75
76
|
if (this.layerModel) {
|
|
76
|
-
this.layerModel.render(); // 独立的渲染流程
|
|
77
|
+
this.layerModel.render(options); // 独立的渲染流程
|
|
77
78
|
}
|
|
78
79
|
|
|
79
80
|
return this;
|
|
@@ -86,7 +87,9 @@ var HeatMapLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
86
87
|
this.hooks.beforeRender.call();
|
|
87
88
|
this.models.forEach(function (model) {
|
|
88
89
|
return model.draw({
|
|
89
|
-
uniforms: _this2.layerModel.getUninforms()
|
|
90
|
+
uniforms: _this2.layerModel.getUninforms(),
|
|
91
|
+
blend: _this2.layerModel.getBlend(),
|
|
92
|
+
stencil: _this2.layerModel.getStencil(options)
|
|
90
93
|
});
|
|
91
94
|
});
|
|
92
95
|
this.hooks.afterRender.call();
|
|
@@ -11,7 +11,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getMask } from '@antv/l7-utils';
|
|
15
14
|
import BaseModel from "../../core/BaseModel";
|
|
16
15
|
import { HeatmapGridTriangulation } from "../../core/triangulation";
|
|
17
16
|
|
|
@@ -75,14 +74,12 @@ var GridModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
75
74
|
key: "buildModels",
|
|
76
75
|
value: function () {
|
|
77
76
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
78
|
-
var
|
|
79
|
-
|
|
77
|
+
var model;
|
|
80
78
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
81
79
|
while (1) {
|
|
82
80
|
switch (_context2.prev = _context2.next) {
|
|
83
81
|
case 0:
|
|
84
|
-
|
|
85
|
-
_context2.next = 3;
|
|
82
|
+
_context2.next = 2;
|
|
86
83
|
return this.layer.buildLayerModel({
|
|
87
84
|
moduleName: 'heatmapGrid',
|
|
88
85
|
vertexShader: heatmapGridVert,
|
|
@@ -91,15 +88,14 @@ var GridModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
91
88
|
primitive: gl.TRIANGLES,
|
|
92
89
|
depth: {
|
|
93
90
|
enable: false
|
|
94
|
-
}
|
|
95
|
-
stencil: getMask(mask, maskInside)
|
|
91
|
+
}
|
|
96
92
|
});
|
|
97
93
|
|
|
98
|
-
case
|
|
94
|
+
case 2:
|
|
99
95
|
model = _context2.sent;
|
|
100
96
|
return _context2.abrupt("return", [model]);
|
|
101
97
|
|
|
102
|
-
case
|
|
98
|
+
case 4:
|
|
103
99
|
case "end":
|
|
104
100
|
return _context2.stop();
|
|
105
101
|
}
|
|
@@ -11,7 +11,6 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
11
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
12
12
|
|
|
13
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
|
-
import { getMask } from '@antv/l7-utils';
|
|
15
14
|
import BaseModel from "../../core/BaseModel";
|
|
16
15
|
import { PointExtrudeTriangulation } from "../../core/triangulation";
|
|
17
16
|
|
|
@@ -75,14 +74,12 @@ var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
75
74
|
key: "buildModels",
|
|
76
75
|
value: function () {
|
|
77
76
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
78
|
-
var
|
|
79
|
-
|
|
77
|
+
var model;
|
|
80
78
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
81
79
|
while (1) {
|
|
82
80
|
switch (_context2.prev = _context2.next) {
|
|
83
81
|
case 0:
|
|
84
|
-
|
|
85
|
-
_context2.next = 3;
|
|
82
|
+
_context2.next = 2;
|
|
86
83
|
return this.layer.buildLayerModel({
|
|
87
84
|
moduleName: 'heatmapGrid3d',
|
|
88
85
|
vertexShader: heatmapGrid3dVert,
|
|
@@ -91,16 +88,14 @@ var Grid3DModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
91
88
|
primitive: gl.TRIANGLES,
|
|
92
89
|
depth: {
|
|
93
90
|
enable: true
|
|
94
|
-
}
|
|
95
|
-
blend: this.getBlend(),
|
|
96
|
-
stencil: getMask(mask, maskInside)
|
|
91
|
+
}
|
|
97
92
|
});
|
|
98
93
|
|
|
99
|
-
case
|
|
94
|
+
case 2:
|
|
100
95
|
model = _context2.sent;
|
|
101
96
|
return _context2.abrupt("return", [model]);
|
|
102
97
|
|
|
103
|
-
case
|
|
98
|
+
case 4:
|
|
104
99
|
case "end":
|
|
105
100
|
return _context2.stop();
|
|
106
101
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFramebuffer, IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
1
|
+
import { IFramebuffer, IModel, IModelUniform, IRenderOptions, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import 'reflect-metadata';
|
|
3
3
|
import BaseModel from '../../core/BaseModel';
|
|
4
4
|
export default class HeatMapModel extends BaseModel {
|
|
@@ -8,7 +8,7 @@ export default class HeatMapModel extends BaseModel {
|
|
|
8
8
|
private intensityModel;
|
|
9
9
|
private colorModel;
|
|
10
10
|
private shapeType;
|
|
11
|
-
render(): void;
|
|
11
|
+
render(options: Partial<IRenderOptions>): void;
|
|
12
12
|
getUninforms(): IModelUniform;
|
|
13
13
|
initModels(): Promise<IModel[]>;
|
|
14
14
|
buildModels(): Promise<IModel[]>;
|