@antv/l7-layers 2.13.4 → 2.13.6
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/core/BaseLayer.d.ts +3 -1
- package/es/core/BaseLayer.js +31 -6
- package/es/line/models/line.d.ts +1 -0
- package/es/line/models/line.js +11 -5
- package/es/plugins/DataMappingPlugin.js +6 -3
- package/es/plugins/DataSourcePlugin.js +14 -9
- package/es/plugins/FeatureScalePlugin.js +8 -4
- package/es/plugins/LayerModelPlugin.d.ts +1 -0
- package/es/plugins/LayerModelPlugin.js +64 -38
- package/es/point/models/fill.js +3 -8
- package/es/point/models/fillmage.js +5 -9
- package/es/point/models/image.js +6 -9
- package/es/point/models/text.d.ts +1 -0
- package/es/point/models/text.js +88 -71
- package/es/tile/service/TilePickService.d.ts +2 -2
- package/es/tile/tileFactory/Tile.d.ts +1 -0
- package/es/tile/tileFactory/VectorTile.js +5 -4
- package/lib/core/BaseLayer.js +30 -5
- package/lib/line/models/line.js +10 -5
- package/lib/plugins/DataMappingPlugin.js +5 -2
- package/lib/plugins/DataSourcePlugin.js +13 -8
- package/lib/plugins/FeatureScalePlugin.js +7 -3
- package/lib/plugins/LayerModelPlugin.js +65 -38
- package/lib/point/models/fill.js +2 -6
- package/lib/point/models/fillmage.js +6 -10
- package/lib/point/models/image.js +6 -9
- package/lib/point/models/text.js +87 -70
- package/lib/tile/tileFactory/VectorTile.js +6 -5
- package/package.json +6 -6
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, 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, 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';
|
|
@@ -71,6 +71,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
71
71
|
protected pickingService: IPickingService;
|
|
72
72
|
protected rendererService: IRendererService;
|
|
73
73
|
protected layerService: ILayerService;
|
|
74
|
+
protected debugService: IDebugService;
|
|
74
75
|
protected interactionService: IInteractionService;
|
|
75
76
|
protected mapService: IMapService;
|
|
76
77
|
styleAttributeService: IStyleAttributeService;
|
|
@@ -116,6 +117,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
|
|
|
116
117
|
getContainer(): Container;
|
|
117
118
|
addPlugin(plugin: ILayerPlugin): ILayer;
|
|
118
119
|
init(): Promise<void>;
|
|
120
|
+
log(logType: string, time?: number): void;
|
|
119
121
|
updateModelData(data: IAttributeAndElements): void;
|
|
120
122
|
createModelData(data: any, option?: ISourceCFG): any;
|
|
121
123
|
setLayerPickService(layerPickService: ILayerPickService): void;
|
package/es/core/BaseLayer.js
CHANGED
|
@@ -30,7 +30,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
30
30
|
|
|
31
31
|
// @ts-ignore
|
|
32
32
|
import { AsyncSeriesBailHook, AsyncWaterfallHook, SyncBailHook, SyncHook } from '@antv/async-hook';
|
|
33
|
-
import { BlendType, lazyInject, TYPES } from '@antv/l7-core';
|
|
33
|
+
import { BlendType, IDebugLog, lazyInject, TYPES } from '@antv/l7-core';
|
|
34
34
|
import Source from '@antv/l7-source';
|
|
35
35
|
import { encodePickingColor, WorkerSourceMap } from '@antv/l7-utils';
|
|
36
36
|
import { EventEmitter } from 'eventemitter3';
|
|
@@ -274,6 +274,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
274
274
|
this.fontService = this.container.get(TYPES.IFontService);
|
|
275
275
|
this.rendererService = this.container.get(TYPES.IRendererService);
|
|
276
276
|
this.layerService = this.container.get(TYPES.ILayerService);
|
|
277
|
+
this.debugService = this.container.get(TYPES.IDebugService);
|
|
277
278
|
this.interactionService = this.container.get(TYPES.IInteractionService);
|
|
278
279
|
this.pickingService = this.container.get(TYPES.IPickingService);
|
|
279
280
|
this.mapService = this.container.get(TYPES.IMapService);
|
|
@@ -343,12 +344,14 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
343
344
|
|
|
344
345
|
this.layerPickService = new LayerPickService(this); // 颜色纹理服务
|
|
345
346
|
|
|
346
|
-
this.textureService = new TextureService(this);
|
|
347
|
+
this.textureService = new TextureService(this);
|
|
348
|
+
this.log(IDebugLog.LayerInitStart); // 触发 init 生命周期插件
|
|
347
349
|
|
|
348
|
-
_context.next =
|
|
350
|
+
_context.next = 31;
|
|
349
351
|
return this.hooks.init.promise();
|
|
350
352
|
|
|
351
|
-
case
|
|
353
|
+
case 31:
|
|
354
|
+
this.log(IDebugLog.LayerInitEnd);
|
|
352
355
|
this.inited = true; // 触发初始化完成事件;
|
|
353
356
|
|
|
354
357
|
this.emit('inited', {
|
|
@@ -361,7 +364,7 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
361
364
|
});
|
|
362
365
|
this.hooks.afterInit.call();
|
|
363
366
|
|
|
364
|
-
case
|
|
367
|
+
case 36:
|
|
365
368
|
case "end":
|
|
366
369
|
return _context.stop();
|
|
367
370
|
}
|
|
@@ -375,6 +378,26 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
375
378
|
|
|
376
379
|
return init;
|
|
377
380
|
}()
|
|
381
|
+
}, {
|
|
382
|
+
key: "log",
|
|
383
|
+
value: function log(logType, time) {
|
|
384
|
+
// @ts-ignore 瓦片、瓦片图层目前不参与日志
|
|
385
|
+
if (this.tileLayer || this.isTileLayer) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
var key = "".concat(this.id, ".").concat(logType);
|
|
390
|
+
var values = {
|
|
391
|
+
id: this.id,
|
|
392
|
+
type: this.type
|
|
393
|
+
};
|
|
394
|
+
|
|
395
|
+
if (time) {
|
|
396
|
+
values.time = time;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
this.debugService.log(key, values);
|
|
400
|
+
}
|
|
378
401
|
}, {
|
|
379
402
|
key: "updateModelData",
|
|
380
403
|
value: function updateModelData(data) {
|
|
@@ -1008,7 +1031,9 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
|
|
|
1008
1031
|
|
|
1009
1032
|
(_this$layerModel2 = this.layerModel) === null || _this$layerModel2 === void 0 ? void 0 : _this$layerModel2.clearModels(refresh);
|
|
1010
1033
|
(_this$tileLayer = this.tileLayer) === null || _this$tileLayer === void 0 ? void 0 : _this$tileLayer.destroy();
|
|
1011
|
-
this.models = [];
|
|
1034
|
+
this.models = []; // 清除图层日志(如果有的话:非瓦片相关)
|
|
1035
|
+
|
|
1036
|
+
this.debugService.removeLog(this.id);
|
|
1012
1037
|
this.emit('remove', {
|
|
1013
1038
|
target: this,
|
|
1014
1039
|
type: 'remove'
|
package/es/line/models/line.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IModel, IModelUniform, ITexture2D } from '@antv/l7-core';
|
|
2
2
|
import BaseModel from '../../core/BaseModel';
|
|
3
3
|
export default class LineModel extends BaseModel {
|
|
4
|
+
private textureEventFlag;
|
|
4
5
|
protected texture: ITexture2D;
|
|
5
6
|
getUninforms(): IModelUniform;
|
|
6
7
|
getAnimateUniforms(): IModelUniform;
|
package/es/line/models/line.js
CHANGED
|
@@ -54,6 +54,8 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
54
54
|
|
|
55
55
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
56
56
|
|
|
57
|
+
_defineProperty(_assertThisInitialized(_this), "textureEventFlag", false);
|
|
58
|
+
|
|
57
59
|
_defineProperty(_assertThisInitialized(_this), "texture", _this.createTexture2D({
|
|
58
60
|
data: [0, 0, 0, 0],
|
|
59
61
|
mag: gl.NEAREST,
|
|
@@ -236,13 +238,17 @@ var LineModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
236
238
|
while (1) {
|
|
237
239
|
switch (_context.prev = _context.next) {
|
|
238
240
|
case 0:
|
|
239
|
-
|
|
240
|
-
|
|
241
|
+
// this.updateTexture();
|
|
242
|
+
// this.iconService.on('imageUpdate', this.updateTexture);
|
|
243
|
+
if (!this.textureEventFlag) {
|
|
244
|
+
this.textureEventFlag = true;
|
|
245
|
+
this.updateTexture();
|
|
246
|
+
this.iconService.on('imageUpdate', this.updateTexture);
|
|
247
|
+
}
|
|
241
248
|
|
|
242
|
-
|
|
243
|
-
return _context.abrupt("return", _context.sent);
|
|
249
|
+
return _context.abrupt("return", this.buildModels());
|
|
244
250
|
|
|
245
|
-
case
|
|
251
|
+
case 2:
|
|
246
252
|
case "end":
|
|
247
253
|
return _context.stop();
|
|
248
254
|
}
|
|
@@ -10,7 +10,7 @@ import _initializerWarningHelper from "@babel/runtime/helpers/esm/initializerWar
|
|
|
10
10
|
var _dec, _dec2, _dec3, _class, _class2, _descriptor, _descriptor2;
|
|
11
11
|
|
|
12
12
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
13
|
-
import { TYPES } from '@antv/l7-core';
|
|
13
|
+
import { IDebugLog, TYPES } from '@antv/l7-core';
|
|
14
14
|
import { Version } from '@antv/l7-maps';
|
|
15
15
|
import { normalize, rgb2arr } from '@antv/l7-utils';
|
|
16
16
|
import { inject, injectable } from 'inversify';
|
|
@@ -36,12 +36,15 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
|
|
|
36
36
|
while (1) {
|
|
37
37
|
switch (_context.prev = _context.next) {
|
|
38
38
|
case 0:
|
|
39
|
-
// 初始化重新生成 map
|
|
39
|
+
layer.log(IDebugLog.MappingStart); // 初始化重新生成 map
|
|
40
|
+
|
|
40
41
|
_this.generateMaping(layer, {
|
|
41
42
|
styleAttributeService: styleAttributeService
|
|
42
43
|
});
|
|
43
44
|
|
|
44
|
-
|
|
45
|
+
layer.log(IDebugLog.MappingEnd);
|
|
46
|
+
|
|
47
|
+
case 3:
|
|
45
48
|
case "end":
|
|
46
49
|
return _context.stop();
|
|
47
50
|
}
|
|
@@ -5,7 +5,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
var _dec, _class;
|
|
6
6
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
-
import { TYPES } from '@antv/l7-core';
|
|
8
|
+
import { IDebugLog, TYPES } from '@antv/l7-core';
|
|
9
9
|
import Source from '@antv/l7-source';
|
|
10
10
|
import { injectable } from 'inversify';
|
|
11
11
|
import 'reflect-metadata';
|
|
@@ -27,6 +27,7 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
27
27
|
while (1) {
|
|
28
28
|
switch (_context.prev = _context.next) {
|
|
29
29
|
case 0:
|
|
30
|
+
layer.log(IDebugLog.SourceInitStart);
|
|
30
31
|
source = layer.getSource();
|
|
31
32
|
|
|
32
33
|
if (!source) {
|
|
@@ -37,28 +38,31 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
if (!source.inited) {
|
|
40
|
-
_context.next =
|
|
41
|
+
_context.next = 8;
|
|
41
42
|
break;
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
_this.updateClusterData(layer);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
+
layer.log(IDebugLog.SourceInitEnd);
|
|
48
|
+
_context.next = 10;
|
|
47
49
|
break;
|
|
48
50
|
|
|
49
|
-
case
|
|
50
|
-
_context.next =
|
|
51
|
+
case 8:
|
|
52
|
+
_context.next = 10;
|
|
51
53
|
return new Promise(function (resolve) {
|
|
52
54
|
source.on('update', function (e) {
|
|
53
55
|
if (e.type === 'inited') {
|
|
54
56
|
_this.updateClusterData(layer);
|
|
57
|
+
|
|
58
|
+
layer.log(IDebugLog.SourceInitEnd);
|
|
55
59
|
}
|
|
56
60
|
|
|
57
61
|
resolve(null);
|
|
58
62
|
});
|
|
59
63
|
});
|
|
60
64
|
|
|
61
|
-
case
|
|
65
|
+
case 10:
|
|
62
66
|
case "end":
|
|
63
67
|
return _context.stop();
|
|
64
68
|
}
|
|
@@ -67,7 +71,7 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
67
71
|
}))); // 检测数据是否需要更新
|
|
68
72
|
|
|
69
73
|
layer.hooks.beforeRenderData.tapPromise('DataSourcePlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
70
|
-
var neeUpdateCluster, dataSourceNeedUpdate;
|
|
74
|
+
var neeUpdateCluster, dataSourceNeedUpdate, needScale;
|
|
71
75
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
72
76
|
while (1) {
|
|
73
77
|
switch (_context2.prev = _context2.next) {
|
|
@@ -75,9 +79,10 @@ var DataSourcePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
75
79
|
neeUpdateCluster = _this.updateClusterData(layer);
|
|
76
80
|
dataSourceNeedUpdate = layer.dataState.dataSourceNeedUpdate;
|
|
77
81
|
layer.dataState.dataSourceNeedUpdate = false;
|
|
78
|
-
|
|
82
|
+
needScale = neeUpdateCluster || dataSourceNeedUpdate;
|
|
83
|
+
return _context2.abrupt("return", needScale);
|
|
79
84
|
|
|
80
|
-
case
|
|
85
|
+
case 5:
|
|
81
86
|
case "end":
|
|
82
87
|
return _context2.stop();
|
|
83
88
|
}
|
|
@@ -7,7 +7,7 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
7
7
|
var _scaleMap, _dec, _class;
|
|
8
8
|
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
import { ScaleTypes, StyleScaleType } from '@antv/l7-core';
|
|
10
|
+
import { IDebugLog, ScaleTypes, StyleScaleType } from '@antv/l7-core';
|
|
11
11
|
import { extent } from 'd3-array';
|
|
12
12
|
import * as d3interpolate from 'd3-interpolate';
|
|
13
13
|
import * as d3 from 'd3-scale';
|
|
@@ -42,21 +42,25 @@ var FeatureScalePlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/functi
|
|
|
42
42
|
while (1) {
|
|
43
43
|
switch (_context.prev = _context.next) {
|
|
44
44
|
case 0:
|
|
45
|
+
layer.log(IDebugLog.ScaleInitStart);
|
|
45
46
|
_this.scaleOptions = layer.getScaleOptions();
|
|
46
47
|
attributes = styleAttributeService.getLayerStyleAttributes();
|
|
47
48
|
dataArray = (_layer$getSource = layer.getSource()) === null || _layer$getSource === void 0 ? void 0 : _layer$getSource.data.dataArray;
|
|
48
49
|
|
|
49
50
|
if (!(Array.isArray(dataArray) && dataArray.length === 0)) {
|
|
50
|
-
_context.next =
|
|
51
|
+
_context.next = 8;
|
|
51
52
|
break;
|
|
52
53
|
}
|
|
53
54
|
|
|
54
55
|
return _context.abrupt("return");
|
|
55
56
|
|
|
56
|
-
case
|
|
57
|
+
case 8:
|
|
57
58
|
_this.caculateScalesForAttributes(attributes || [], dataArray);
|
|
58
59
|
|
|
59
|
-
case
|
|
60
|
+
case 9:
|
|
61
|
+
layer.log(IDebugLog.ScaleInitEnd);
|
|
62
|
+
|
|
63
|
+
case 10:
|
|
60
64
|
case "end":
|
|
61
65
|
return _context.stop();
|
|
62
66
|
}
|
|
@@ -4,6 +4,7 @@ import 'reflect-metadata';
|
|
|
4
4
|
* Layer Model 初始化,更新,销毁
|
|
5
5
|
*/
|
|
6
6
|
export default class LayerModelPlugin implements ILayerPlugin {
|
|
7
|
+
private build;
|
|
7
8
|
initLayerModel(layer: ILayer): Promise<void>;
|
|
8
9
|
prepareLayerModel(layer: ILayer): Promise<void>;
|
|
9
10
|
apply(layer: ILayer): void;
|
|
@@ -5,6 +5,7 @@ import _createClass from "@babel/runtime/helpers/esm/createClass";
|
|
|
5
5
|
var _dec, _class;
|
|
6
6
|
|
|
7
7
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
8
|
+
import { IDebugLog } from '@antv/l7-core';
|
|
8
9
|
import { injectable } from 'inversify';
|
|
9
10
|
import 'reflect-metadata';
|
|
10
11
|
import TileLayer from "../tile/tileLayer/BaseLayer";
|
|
@@ -18,9 +19,9 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
_createClass(LayerModelPlugin, [{
|
|
21
|
-
key: "
|
|
22
|
+
key: "build",
|
|
22
23
|
value: function () {
|
|
23
|
-
var
|
|
24
|
+
var _build = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(layer) {
|
|
24
25
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
25
26
|
while (1) {
|
|
26
27
|
switch (_context.prev = _context.next) {
|
|
@@ -32,9 +33,6 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
32
33
|
return layer.buildModels();
|
|
33
34
|
|
|
34
35
|
case 3:
|
|
35
|
-
layer.styleNeedUpdate = false;
|
|
36
|
-
|
|
37
|
-
case 4:
|
|
38
36
|
case "end":
|
|
39
37
|
return _context.stop();
|
|
40
38
|
}
|
|
@@ -42,36 +40,60 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
42
40
|
}, _callee);
|
|
43
41
|
}));
|
|
44
42
|
|
|
45
|
-
function
|
|
46
|
-
return
|
|
43
|
+
function build(_x) {
|
|
44
|
+
return _build.apply(this, arguments);
|
|
47
45
|
}
|
|
48
46
|
|
|
49
|
-
return
|
|
47
|
+
return build;
|
|
50
48
|
}()
|
|
51
49
|
}, {
|
|
52
|
-
key: "
|
|
50
|
+
key: "initLayerModel",
|
|
53
51
|
value: function () {
|
|
54
|
-
var
|
|
52
|
+
var _initLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2(layer) {
|
|
55
53
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
56
54
|
while (1) {
|
|
57
55
|
switch (_context2.prev = _context2.next) {
|
|
58
56
|
case 0:
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
// 初始化 Model
|
|
57
|
+
_context2.next = 2;
|
|
58
|
+
return this.build(layer);
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
case 2:
|
|
61
|
+
layer.styleNeedUpdate = false;
|
|
65
62
|
|
|
66
63
|
case 3:
|
|
67
64
|
case "end":
|
|
68
65
|
return _context2.stop();
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
|
-
}, _callee2);
|
|
68
|
+
}, _callee2, this);
|
|
69
|
+
}));
|
|
70
|
+
|
|
71
|
+
function initLayerModel(_x2) {
|
|
72
|
+
return _initLayerModel.apply(this, arguments);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return initLayerModel;
|
|
76
|
+
}()
|
|
77
|
+
}, {
|
|
78
|
+
key: "prepareLayerModel",
|
|
79
|
+
value: function () {
|
|
80
|
+
var _prepareLayerModel = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3(layer) {
|
|
81
|
+
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
82
|
+
while (1) {
|
|
83
|
+
switch (_context3.prev = _context3.next) {
|
|
84
|
+
case 0:
|
|
85
|
+
_context3.next = 2;
|
|
86
|
+
return this.build(layer);
|
|
87
|
+
|
|
88
|
+
case 2:
|
|
89
|
+
case "end":
|
|
90
|
+
return _context3.stop();
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}, _callee3, this);
|
|
72
94
|
}));
|
|
73
95
|
|
|
74
|
-
function prepareLayerModel(
|
|
96
|
+
function prepareLayerModel(_x3) {
|
|
75
97
|
return _prepareLayerModel.apply(this, arguments);
|
|
76
98
|
}
|
|
77
99
|
|
|
@@ -82,69 +104,73 @@ var LayerModelPlugin = (_dec = injectable(), _dec(_class = /*#__PURE__*/function
|
|
|
82
104
|
value: function apply(layer) {
|
|
83
105
|
var _this = this;
|
|
84
106
|
|
|
85
|
-
layer.hooks.init.tapPromise('LayerModelPlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
86
|
-
return _regeneratorRuntime.wrap(function
|
|
107
|
+
layer.hooks.init.tapPromise('LayerModelPlugin', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee4() {
|
|
108
|
+
return _regeneratorRuntime.wrap(function _callee4$(_context4) {
|
|
87
109
|
while (1) {
|
|
88
|
-
switch (
|
|
110
|
+
switch (_context4.prev = _context4.next) {
|
|
89
111
|
case 0:
|
|
90
112
|
if (!layer.getSource().isTile) {
|
|
91
|
-
|
|
113
|
+
_context4.next = 4;
|
|
92
114
|
break;
|
|
93
115
|
}
|
|
94
116
|
|
|
95
117
|
layer.prepareBuildModel();
|
|
96
118
|
layer.tileLayer = new TileLayer(layer);
|
|
97
|
-
return
|
|
119
|
+
return _context4.abrupt("return");
|
|
98
120
|
|
|
99
121
|
case 4:
|
|
100
|
-
|
|
122
|
+
layer.log(IDebugLog.BuildModelStart);
|
|
123
|
+
_context4.next = 7;
|
|
101
124
|
return _this.initLayerModel(layer);
|
|
102
125
|
|
|
103
|
-
case
|
|
126
|
+
case 7:
|
|
127
|
+
layer.log(IDebugLog.BuildModelEnd);
|
|
128
|
+
|
|
129
|
+
case 8:
|
|
104
130
|
case "end":
|
|
105
|
-
return
|
|
131
|
+
return _context4.stop();
|
|
106
132
|
}
|
|
107
133
|
}
|
|
108
|
-
},
|
|
134
|
+
}, _callee4);
|
|
109
135
|
})));
|
|
110
136
|
layer.hooks.beforeRenderData.tapPromise('LayerModelPlugin', /*#__PURE__*/function () {
|
|
111
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function
|
|
112
|
-
return _regeneratorRuntime.wrap(function
|
|
137
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee5(flag) {
|
|
138
|
+
return _regeneratorRuntime.wrap(function _callee5$(_context5) {
|
|
113
139
|
while (1) {
|
|
114
|
-
switch (
|
|
140
|
+
switch (_context5.prev = _context5.next) {
|
|
115
141
|
case 0:
|
|
116
142
|
if (flag) {
|
|
117
|
-
|
|
143
|
+
_context5.next = 2;
|
|
118
144
|
break;
|
|
119
145
|
}
|
|
120
146
|
|
|
121
|
-
return
|
|
147
|
+
return _context5.abrupt("return", false);
|
|
122
148
|
|
|
123
149
|
case 2:
|
|
124
150
|
if (!layer.getSource().isTile) {
|
|
125
|
-
|
|
151
|
+
_context5.next = 5;
|
|
126
152
|
break;
|
|
127
153
|
}
|
|
128
154
|
|
|
129
155
|
layer.tileLayer = new TileLayer(layer);
|
|
130
|
-
return
|
|
156
|
+
return _context5.abrupt("return", false);
|
|
131
157
|
|
|
132
158
|
case 5:
|
|
133
|
-
|
|
159
|
+
_context5.next = 7;
|
|
134
160
|
return _this.prepareLayerModel(layer);
|
|
135
161
|
|
|
136
162
|
case 7:
|
|
137
|
-
return
|
|
163
|
+
return _context5.abrupt("return", true);
|
|
138
164
|
|
|
139
165
|
case 8:
|
|
140
166
|
case "end":
|
|
141
|
-
return
|
|
167
|
+
return _context5.stop();
|
|
142
168
|
}
|
|
143
169
|
}
|
|
144
|
-
},
|
|
170
|
+
}, _callee5);
|
|
145
171
|
}));
|
|
146
172
|
|
|
147
|
-
return function (
|
|
173
|
+
return function (_x4) {
|
|
148
174
|
return _ref2.apply(this, arguments);
|
|
149
175
|
};
|
|
150
176
|
}());
|
package/es/point/models/fill.js
CHANGED
|
@@ -14,9 +14,9 @@ import { AttributeType, gl } from '@antv/l7-core';
|
|
|
14
14
|
import { getMask, PointFillTriangulation } from '@antv/l7-utils';
|
|
15
15
|
import { isNumber } from 'lodash';
|
|
16
16
|
import BaseModel from "../../core/BaseModel";
|
|
17
|
+
import { SizeUnitType } from "../../core/interface"; // animate pointLayer shader - support animate
|
|
17
18
|
|
|
18
19
|
/* babel-plugin-inline-import '../shaders/animate/wave_frag.glsl' */
|
|
19
|
-
// animate pointLayer shader - support animate
|
|
20
20
|
var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\nuniform float u_time;\nuniform vec4 u_animate: [ 1., 2., 1.0, 0.2 ];\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n\n vec4 textrueStroke = vec4(\n styleMappingMat[1][0],\n styleMappingMat[1][1],\n styleMappingMat[1][2],\n styleMappingMat[1][3]\n );\n\n float opacity = styleMappingMat[0][0];\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n \n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n float PI = 3.14159;\n float N_RINGS = 3.0;\n float FREQ = 1.0;\n\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n\n float d = length(v_data.xy);\n if(d > 0.5) {\n discard;\n }\n float intensity = clamp(cos(d * PI), 0.0, 1.0) * clamp(cos(2.0 * PI * (d * 2.0 * u_animate.z - u_animate.y * u_time)), 0.0, 1.0);\n \n // \u6839\u636E\u53E0\u52A0\u6A21\u5F0F\u9009\u62E9\u6548\u679C\n if(u_additive > 0.0) {\n gl_FragColor *= intensity;\n // \u4F18\u5316\u6C34\u6CE2\u70B9 blend additive \u6A21\u5F0F\u4E0B\u6709\u7684\u62FE\u53D6\u6548\u679C \n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor = vec4(gl_FragColor.xyz, gl_FragColor.a * intensity);\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n"; // static pointLayer shader - not support animate
|
|
21
21
|
|
|
22
22
|
/* babel-plugin-inline-import '../shaders/fill_frag.glsl' */
|
|
@@ -24,7 +24,6 @@ var pointFillFrag = "uniform float u_additive;\n\nvarying mat4 styleMappingMat;
|
|
|
24
24
|
|
|
25
25
|
/* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
|
|
26
26
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform int u_Size_Unit;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n#pragma include \"styleMappingCalStrokeOpacity\"\n#pragma include \"styleMappingCalStrokeWidth\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n * u_meter2coord \u5728\u7B49\u9762\u79EF\u5927\u5C0F\u7684\u65F6\u5019\u8BBE\u7F6E\u5355\u4F4D\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - empty\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 strokeOpacityAndOffset = calStrokeOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][1] = strokeOpacityAndOffset.r;\n textureOffset = strokeOpacityAndOffset.g;\n\n vec2 strokeWidthAndOffset = calStrokeWidthAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][2] = strokeWidthAndOffset.r;\n textureOffset = strokeWidthAndOffset.g;\n\n vec4 textrueStroke = vec4(-1.0, -1.0, -1.0, -1.0);\n if(hasStroke()) {\n vec2 valueRPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][0] = pos2value(valueRPos, columnWidth, rowHeight); // R\n textureOffset += 1.0;\n\n vec2 valueGPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][1] = pos2value(valueGPos, columnWidth, rowHeight); // G\n textureOffset += 1.0;\n\n vec2 valueBPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][2] = pos2value(valueBPos, columnWidth, rowHeight); // B\n textureOffset += 1.0;\n\n vec2 valueAPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n styleMappingMat[1][3] = pos2value(valueAPos, columnWidth, rowHeight); // A\n textureOffset += 1.0;\n } else {\n if(u_stroke_color == vec4(0.0)) {\n styleMappingMat[1][0] = v_color.r;\n styleMappingMat[1][1] = v_color.g;\n styleMappingMat[1][2] = v_color.b;\n styleMappingMat[1][3] = v_color.a;\n } else {\n styleMappingMat[1][0] = u_stroke_color.r;\n styleMappingMat[1][1] = u_stroke_color.g;\n styleMappingMat[1][2] = u_stroke_color.b;\n styleMappingMat[1][3] = u_stroke_color.a;\n }\n }\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n // unpack color(vec2)\n v_color = a_Color;\nif(u_Size_Unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width) + textrueOffsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n \n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n // vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, project_pixel(setPickingOrder(0.0)), 1.0));\n\n float raisingHeight = u_raisingHeight;\n\n if(u_heightfixed < 1.0) { // false\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n \n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
27
|
-
import { SizeUnitType } from "../../core/interface";
|
|
28
27
|
|
|
29
28
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
30
29
|
_inherits(FillModel, _BaseModel);
|
|
@@ -145,13 +144,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
145
144
|
while (1) {
|
|
146
145
|
switch (_context.prev = _context.next) {
|
|
147
146
|
case 0:
|
|
148
|
-
_context.
|
|
149
|
-
return this.buildModels();
|
|
147
|
+
return _context.abrupt("return", this.buildModels());
|
|
150
148
|
|
|
151
|
-
case
|
|
152
|
-
return _context.abrupt("return", _context.sent);
|
|
153
|
-
|
|
154
|
-
case 3:
|
|
149
|
+
case 1:
|
|
155
150
|
case "end":
|
|
156
151
|
return _context.stop();
|
|
157
152
|
}
|
|
@@ -16,6 +16,7 @@ import { AttributeType, gl } from '@antv/l7-core';
|
|
|
16
16
|
import { getCullFace, getMask } from '@antv/l7-utils';
|
|
17
17
|
import { isNumber } from 'lodash';
|
|
18
18
|
import BaseModel from "../../core/BaseModel";
|
|
19
|
+
import { SizeUnitType } from "../../core/interface";
|
|
19
20
|
import { PointFillTriangulation } from "../../core/triangulation"; // static pointLayer shader - not support animate
|
|
20
21
|
|
|
21
22
|
/* babel-plugin-inline-import '../shaders/image/fillImage_frag.glsl' */
|
|
@@ -23,7 +24,6 @@ var pointFillFrag = "uniform sampler2D u_texture;\nuniform vec2 u_textSize;\n\nv
|
|
|
23
24
|
|
|
24
25
|
/* babel-plugin-inline-import '../shaders/image/fillImage_vert.glsl' */
|
|
25
26
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute vec2 a_Uv;\nattribute float a_Rotate;\n\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform mat2 u_RotateMatrix;\nuniform int u_Size_Unit;\n\nvarying vec2 v_uv; // \u672C\u8EAB\u7684 uv \u5750\u6807\nvarying vec2 v_Iconuv; // icon \u8D34\u56FE\u7684 uv \u5750\u6807\n\nuniform float u_raisingHeight: 0.0;\nuniform float u_heightfixed: 0.0;\nuniform float u_opacity : 1;\nuniform vec2 u_offsets;\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n\n v_uv = (a_Extrude.xy + 1.0)/2.0;\n v_uv.y = 1.0 - v_uv.y;\n v_Iconuv = a_Uv;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // empty - empty - empty - empty\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0\n );\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n\n vec2 textrueOffsets = vec2(0.0, 0.0);\n if(hasOffsets()) {\n vec2 valueXPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.r = pos2value(valueXPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n\n vec2 valueYPos = nextPos(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset);\n textrueOffsets.g = pos2value(valueYPos, columnWidth, rowHeight); // x\n textureOffset += 1.0;\n } else {\n textrueOffsets = u_offsets;\n }\n\n // cal style mapping\n\n highp float angle_sin = sin(a_Rotate);\n highp float angle_cos = cos(a_Rotate);\n mat2 rotation_matrix = mat2(angle_cos, -1.0 * angle_sin, angle_sin, angle_cos);\n float newSize = a_Size;\n if(u_Size_Unit == 1) {\n newSize = newSize * u_PixelsPerMeter.z;\n }\n\n // vec2 offset = (u_RotateMatrix * extrude.xy * (a_Size) + textrueOffsets);\n vec2 offset = (rotation_matrix * u_RotateMatrix * extrude.xy * (newSize) + textrueOffsets);\n vec3 aPosition = a_Position;\n\n offset = project_pixel(offset);\n\n vec4 project_pos = project_position(vec4(aPosition.xy, 0.0, 1.0));\n float raisingHeight = u_raisingHeight;\n if(u_heightfixed < 1.0) { // height fixed\n raisingHeight = project_pixel(u_raisingHeight);\n } else {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n raisingHeight = u_raisingHeight * mapboxZoomScale;\n }\n }\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp *vec4(project_pos.xy + offset, raisingHeight, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, raisingHeight, 1.0));\n }\n \n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
26
|
-
import { SizeUnitType } from "../../core/interface";
|
|
27
27
|
|
|
28
28
|
var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
29
|
_inherits(FillImageModel, _BaseModel);
|
|
@@ -180,13 +180,9 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
180
180
|
case 0:
|
|
181
181
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
182
182
|
this.updateTexture();
|
|
183
|
-
_context.
|
|
184
|
-
return this.buildModels();
|
|
185
|
-
|
|
186
|
-
case 4:
|
|
187
|
-
return _context.abrupt("return", _context.sent);
|
|
183
|
+
return _context.abrupt("return", this.buildModels());
|
|
188
184
|
|
|
189
|
-
case
|
|
185
|
+
case 3:
|
|
190
186
|
case "end":
|
|
191
187
|
return _context.stop();
|
|
192
188
|
}
|
|
@@ -297,8 +293,8 @@ var FillImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
297
293
|
var shape = feature.shape;
|
|
298
294
|
|
|
299
295
|
var _ref3 = iconMap[shape] || {
|
|
300
|
-
x:
|
|
301
|
-
y:
|
|
296
|
+
x: -64,
|
|
297
|
+
y: -64
|
|
302
298
|
},
|
|
303
299
|
x = _ref3.x,
|
|
304
300
|
y = _ref3.y;
|
package/es/point/models/image.js
CHANGED
|
@@ -147,13 +147,9 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
147
147
|
case 0:
|
|
148
148
|
this.iconService.on('imageUpdate', this.updateTexture);
|
|
149
149
|
this.updateTexture();
|
|
150
|
-
_context.
|
|
151
|
-
return this.buildModels();
|
|
150
|
+
return _context.abrupt("return", this.buildModels());
|
|
152
151
|
|
|
153
|
-
case
|
|
154
|
-
return _context.abrupt("return", _context.sent);
|
|
155
|
-
|
|
156
|
-
case 5:
|
|
152
|
+
case 3:
|
|
157
153
|
case "end":
|
|
158
154
|
return _context.stop();
|
|
159
155
|
}
|
|
@@ -263,11 +259,12 @@ var ImageModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
263
259
|
var shape = feature.shape;
|
|
264
260
|
|
|
265
261
|
var _ref3 = iconMap[shape] || {
|
|
266
|
-
x:
|
|
267
|
-
y:
|
|
262
|
+
x: -64,
|
|
263
|
+
y: -64
|
|
268
264
|
},
|
|
269
265
|
x = _ref3.x,
|
|
270
|
-
y = _ref3.y;
|
|
266
|
+
y = _ref3.y; // 非画布区域,默认的图标改为透明
|
|
267
|
+
|
|
271
268
|
|
|
272
269
|
return [x, y];
|
|
273
270
|
}
|