@antv/l7-layers 2.12.1 → 2.13.0

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.
Files changed (96) hide show
  1. package/es/core/BaseLayer.d.ts +1 -1
  2. package/es/core/BaseLayer.js +18 -7
  3. package/es/core/TextureService.d.ts +4 -3
  4. package/es/core/TextureService.js +32 -10
  5. package/es/core/interface.d.ts +5 -6
  6. package/es/core/interface.js +7 -0
  7. package/es/line/index.d.ts +1 -1
  8. package/es/line/models/index.d.ts +1 -1
  9. package/es/line/models/index.js +0 -2
  10. package/es/plugins/DataMappingPlugin.js +10 -7
  11. package/es/point/index.d.ts +1 -1
  12. package/es/point/models/fill.d.ts +0 -14
  13. package/es/point/models/fill.js +9 -100
  14. package/es/point/models/fillmage.d.ts +0 -5
  15. package/es/point/models/fillmage.js +15 -65
  16. package/es/point/models/index.d.ts +1 -1
  17. package/es/point/models/index.js +0 -4
  18. package/es/point/models/radar.d.ts +0 -7
  19. package/es/point/models/radar.js +13 -79
  20. package/es/point/models/text.js +1 -1
  21. package/es/point/shaders/fill_vert.glsl +9 -26
  22. package/es/point/shaders/image/fillImage_vert.glsl +8 -14
  23. package/es/point/shaders/radar/radar_vert.glsl +12 -19
  24. package/es/point/shaders/text_vert.glsl +1 -1
  25. package/es/polygon/index.js +0 -2
  26. package/es/polygon/models/index.d.ts +1 -1
  27. package/es/polygon/models/index.js +2 -4
  28. package/es/raster/models/raster.d.ts +0 -2
  29. package/es/raster/models/raster.js +6 -22
  30. package/es/raster/models/rasterTerrainRgb.js +6 -6
  31. package/es/raster/shaders/raster_2d_frag.glsl +1 -0
  32. package/es/tile/tileFactory/RasterRGBTile.js +0 -1
  33. package/es/tile/tileFactory/RasterTile.js +13 -8
  34. package/lib/core/BaseLayer.js +17 -6
  35. package/lib/core/TextureService.js +31 -9
  36. package/lib/core/interface.js +9 -1
  37. package/lib/line/models/index.js +0 -3
  38. package/lib/plugins/DataMappingPlugin.js +10 -7
  39. package/lib/point/models/fill.js +8 -98
  40. package/lib/point/models/fillmage.js +16 -67
  41. package/lib/point/models/index.js +0 -6
  42. package/lib/point/models/radar.js +13 -80
  43. package/lib/point/models/text.js +1 -1
  44. package/lib/point/shaders/fill_vert.glsl +9 -26
  45. package/lib/point/shaders/image/fillImage_vert.glsl +8 -14
  46. package/lib/point/shaders/radar/radar_vert.glsl +12 -19
  47. package/lib/point/shaders/text_vert.glsl +1 -1
  48. package/lib/polygon/index.js +0 -2
  49. package/lib/polygon/models/index.js +2 -5
  50. package/lib/raster/models/raster.js +5 -21
  51. package/lib/raster/models/rasterTerrainRgb.js +5 -5
  52. package/lib/raster/shaders/raster_2d_frag.glsl +1 -0
  53. package/lib/tile/tileFactory/RasterTile.js +14 -8
  54. package/package.json +6 -6
  55. package/es/line/models/tile.d.ts +0 -8
  56. package/es/line/models/tile.js +0 -201
  57. package/es/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  58. package/es/line/shaders/tile/line_tile_vert.glsl +0 -52
  59. package/es/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  60. package/es/line/shaders/tile/simpleline_vert.glsl +0 -21
  61. package/es/point/models/tile.d.ts +0 -15
  62. package/es/point/models/tile.js +0 -217
  63. package/es/point/models/tileText.d.ts +0 -52
  64. package/es/point/models/tileText.js +0 -544
  65. package/es/point/shaders/tile/fill_tile_frag.glsl +0 -76
  66. package/es/point/shaders/tile/fill_tile_vert.glsl +0 -78
  67. package/es/point/shaders/tile/text_frag.glsl +0 -33
  68. package/es/point/shaders/tile/text_map_frag.glsl +0 -31
  69. package/es/point/shaders/tile/text_map_vert.glsl +0 -38
  70. package/es/point/shaders/tile/text_vert.glsl +0 -48
  71. package/es/polygon/models/tile.d.ts +0 -12
  72. package/es/polygon/models/tile.js +0 -141
  73. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  74. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  75. package/es/raster/models/rasterTile.d.ts +0 -18
  76. package/es/raster/models/rasterTile.js +0 -180
  77. package/es/tile/tileFactory/layers/RasterDataLayer.d.ts +0 -11
  78. package/es/tile/tileFactory/layers/RasterDataLayer.js +0 -89
  79. package/lib/line/models/tile.js +0 -217
  80. package/lib/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  81. package/lib/line/shaders/tile/line_tile_vert.glsl +0 -52
  82. package/lib/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  83. package/lib/line/shaders/tile/simpleline_vert.glsl +0 -21
  84. package/lib/point/models/tile.js +0 -233
  85. package/lib/point/models/tileText.js +0 -560
  86. package/lib/point/shaders/tile/fill_tile_frag.glsl +0 -76
  87. package/lib/point/shaders/tile/fill_tile_vert.glsl +0 -78
  88. package/lib/point/shaders/tile/text_frag.glsl +0 -33
  89. package/lib/point/shaders/tile/text_map_frag.glsl +0 -31
  90. package/lib/point/shaders/tile/text_map_vert.glsl +0 -38
  91. package/lib/point/shaders/tile/text_vert.glsl +0 -48
  92. package/lib/polygon/models/tile.js +0 -156
  93. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  94. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  95. package/lib/raster/models/rasterTile.js +0 -196
  96. package/lib/tile/tileFactory/layers/RasterDataLayer.js +0 -105
@@ -208,7 +208,7 @@ export default class BaseLayer<ChildLayerStyleOptions = {}> extends EventEmitter
208
208
  rebuildModels(): Promise<void>;
209
209
  renderMulPass(multiPassRenderer: IMultiPassRenderer): Promise<void>;
210
210
  renderModels(isPicking?: boolean): this;
211
- updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): void;
211
+ updateStyleAttribute(type: string, field: StyleAttributeField, values?: StyleAttributeOption, updateOptions?: Partial<IStyleAttributeUpdateOptions>): boolean;
212
212
  getLayerAttributeConfig(): Partial<ILayerAttributesOption>;
213
213
  getShaderPickStat(): boolean;
214
214
  /**
@@ -34,7 +34,7 @@ import { BlendType, 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';
37
- import { isFunction, isObject, isUndefined } from 'lodash';
37
+ import { isEqual, isFunction, isObject, isUndefined } from 'lodash';
38
38
  import { BlendTypes } from "../utils/blend";
39
39
  import { styleDataMapping } from "../utils/dataMappingStyle";
40
40
  import { calculateData } from "../utils/layerData";
@@ -469,8 +469,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
469
469
  }, {
470
470
  key: "filter",
471
471
  value: function filter(field, values, updateOptions) {
472
- this.updateStyleAttribute('filter', field, values, updateOptions);
473
- this.dataState.dataSourceNeedUpdate = true;
472
+ var flag = this.updateStyleAttribute('filter', field, values, updateOptions);
473
+ this.dataState.dataSourceNeedUpdate = flag;
474
474
  return this;
475
475
  }
476
476
  }, {
@@ -480,9 +480,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
480
480
  field: field,
481
481
  values: values
482
482
  };
483
- this.updateStyleAttribute('shape', field, values, updateOptions);
484
- this.dataState.dataSourceNeedUpdate = true; // 通过数据更新驱动shape 更新
485
-
483
+ var flag = this.updateStyleAttribute('shape', field, values, updateOptions);
484
+ this.dataState.dataSourceNeedUpdate = flag;
486
485
  return this;
487
486
  }
488
487
  }, {
@@ -1438,7 +1437,17 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1438
1437
  }, {
1439
1438
  key: "updateStyleAttribute",
1440
1439
  value: function updateStyleAttribute(type, field, values, updateOptions) {
1441
- // 存储 Attribute
1440
+ // encode diff
1441
+ var preAttribute = this.configService.getAttributeConfig(this.id) || {}; // @ts-ignore
1442
+
1443
+ if (isEqual(preAttribute[type], {
1444
+ field: field,
1445
+ values: values
1446
+ })) {
1447
+ return false;
1448
+ } // 存储 Attribute
1449
+
1450
+
1442
1451
  if (['color', 'size', 'texture', 'rotate', 'filter', 'label', 'shape'].indexOf(type) !== -1) {
1443
1452
  this.configService.setAttributeConfig(this.id, _defineProperty({}, type, {
1444
1453
  field: field,
@@ -1465,6 +1474,8 @@ var BaseLayer = (_dec = lazyInject(TYPES.IGlobalConfigService), (_class = /*#__P
1465
1474
  }, // @ts-ignore
1466
1475
  updateOptions);
1467
1476
  }
1477
+
1478
+ return true;
1468
1479
  }
1469
1480
  }, {
1470
1481
  key: "getLayerAttributeConfig",
@@ -6,9 +6,10 @@ export default class TextureService implements ITextureService {
6
6
  private colorTexture;
7
7
  private key;
8
8
  constructor(layer: ILayer);
9
- getColorTexture(colorRamp: IColorRamp): ITexture2D;
10
- createColorTexture(colorRamp: IColorRamp): ITexture2D;
11
- setColorTexture(texture: ITexture2D, colorRamp: IColorRamp): void;
9
+ getColorTexture(colorRamp: IColorRamp, domain?: [number, number]): ITexture2D;
10
+ createColorTexture(colorRamp: IColorRamp, domain?: [number, number]): ITexture2D;
11
+ setColorTexture(texture: ITexture2D, colorRamp: IColorRamp, domain: [number, number]): void;
12
12
  destroy(): void;
13
+ private getColorRampBar;
13
14
  private getTextureKey;
14
15
  }
@@ -1,7 +1,7 @@
1
1
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
2
2
  import _createClass from "@babel/runtime/helpers/esm/createClass";
3
3
  import { TYPES } from '@antv/l7-core';
4
- import { generateColorRamp } from '@antv/l7-utils';
4
+ import { generateCatRamp, generateColorRamp, generateCustomRamp, generateLinearRamp, generateQuantizeRamp } from '@antv/l7-utils';
5
5
 
6
6
  var TextureService = /*#__PURE__*/function () {
7
7
  function TextureService(layer) {
@@ -14,14 +14,14 @@ var TextureService = /*#__PURE__*/function () {
14
14
 
15
15
  _createClass(TextureService, [{
16
16
  key: "getColorTexture",
17
- value: function getColorTexture(colorRamp) {
17
+ value: function getColorTexture(colorRamp, domain) {
18
18
  // TODO 支持传入图片
19
- var currentkey = this.getTextureKey(colorRamp);
19
+ var currentkey = this.getTextureKey(colorRamp, domain);
20
20
 
21
21
  if (this.key === currentkey) {
22
22
  return this.colorTexture;
23
23
  } else {
24
- this.createColorTexture(colorRamp);
24
+ this.createColorTexture(colorRamp, domain);
25
25
  }
26
26
 
27
27
  this.key = currentkey;
@@ -29,9 +29,9 @@ var TextureService = /*#__PURE__*/function () {
29
29
  }
30
30
  }, {
31
31
  key: "createColorTexture",
32
- value: function createColorTexture(colorRamp) {
32
+ value: function createColorTexture(colorRamp, domain) {
33
33
  var createTexture2D = this.rendererService.createTexture2D;
34
- var imageData = generateColorRamp(colorRamp);
34
+ var imageData = this.getColorRampBar(colorRamp, domain);
35
35
  var texture = createTexture2D({
36
36
  data: imageData.data,
37
37
  width: imageData.width,
@@ -43,8 +43,8 @@ var TextureService = /*#__PURE__*/function () {
43
43
  }
44
44
  }, {
45
45
  key: "setColorTexture",
46
- value: function setColorTexture(texture, colorRamp) {
47
- this.key = this.getTextureKey(colorRamp);
46
+ value: function setColorTexture(texture, colorRamp, domain) {
47
+ this.key = this.getTextureKey(colorRamp, domain);
48
48
  this.colorTexture = texture;
49
49
  }
50
50
  }, {
@@ -54,10 +54,32 @@ var TextureService = /*#__PURE__*/function () {
54
54
 
55
55
  (_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
56
56
  }
57
+ }, {
58
+ key: "getColorRampBar",
59
+ value: function getColorRampBar(colorRamp, domain) {
60
+ switch (colorRamp.type) {
61
+ case 'cat':
62
+ return generateCatRamp(colorRamp);
63
+
64
+ case 'quantize':
65
+ return generateQuantizeRamp(colorRamp);
66
+
67
+ case 'custom':
68
+ return generateCustomRamp(colorRamp, domain);
69
+
70
+ case 'linear':
71
+ return generateLinearRamp(colorRamp, domain);
72
+
73
+ default:
74
+ return generateColorRamp(colorRamp);
75
+ }
76
+ }
57
77
  }, {
58
78
  key: "getTextureKey",
59
- value: function getTextureKey(colorRamp) {
60
- return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp.positions.join('_'));
79
+ value: function getTextureKey(colorRamp, domain) {
80
+ var _colorRamp$positions;
81
+
82
+ return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 ? void 0 : (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
61
83
  }
62
84
  }]);
63
85
 
@@ -63,6 +63,10 @@ export interface ILineLayerStyleOptions extends IBaseLayerStyleOptions {
63
63
  enablePicking?: boolean;
64
64
  workerEnabled?: boolean;
65
65
  }
66
+ export declare enum SizeUnitType {
67
+ pixel = 0,
68
+ meter = 1
69
+ }
66
70
  export interface IPointLayerStyleOptions extends IBaseLayerStyleOptions {
67
71
  tileOrigin?: number[];
68
72
  coord?: string;
@@ -88,7 +92,7 @@ export interface IPointLayerStyleOptions extends IBaseLayerStyleOptions {
88
92
  };
89
93
  lightEnable: boolean;
90
94
  offsets?: styleOffset;
91
- unit?: string;
95
+ unit?: SizeUnitType;
92
96
  rotation?: number;
93
97
  speed?: number;
94
98
  featureId?: string;
@@ -145,11 +149,6 @@ export interface IImageLayerStyleOptions extends IBaseLayerStyleOptions {
145
149
  rampColors?: IColorRamp;
146
150
  rampColorsData?: ImageData | IImagedata;
147
151
  colorTexture?: ITexture2D;
148
- pixelConstant?: number;
149
- pixelConstantR?: number;
150
- pixelConstantG?: number;
151
- pixelConstantB?: number;
152
- pixelConstantRGB?: number;
153
152
  }
154
153
  export interface ICityBuildLayerStyleOptions {
155
154
  opacity: number;
@@ -22,6 +22,13 @@ export var TextureBlend;
22
22
  TextureBlend["REPLACE"] = "replace";
23
23
  })(TextureBlend || (TextureBlend = {}));
24
24
 
25
+ export var SizeUnitType;
26
+
27
+ (function (SizeUnitType) {
28
+ SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
29
+ SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
30
+ })(SizeUnitType || (SizeUnitType = {}));
31
+
25
32
  export var CanvasUpdateType;
26
33
 
27
34
  (function (CanvasUpdateType) {
@@ -29,7 +29,7 @@ export default class LineLayer extends BaseLayer<ILineLayerStyleOptions> {
29
29
  blend: string;
30
30
  } | {
31
31
  blend: string;
32
- } | {} | {} | {};
32
+ } | {} | {};
33
33
  getModelType(): LineModelType;
34
34
  processData(filterData: IParseDataItem[]): IParseDataItem[];
35
35
  }
@@ -1,4 +1,4 @@
1
- export type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'tileLine' | 'earthArc3d';
1
+ export type LineModelType = 'arc' | 'arc3d' | 'greatcircle' | 'wall' | 'simple' | 'line' | 'halfLine' | 'linearline' | 'earthArc3d';
2
2
  declare const LineModels: {
3
3
  [key in LineModelType]: any;
4
4
  };
@@ -6,7 +6,6 @@ import LineHalfModel from "./half";
6
6
  import LineModel from "./line";
7
7
  import LinearLine from "./linearline";
8
8
  import SimpleLineModel from "./simpleLine";
9
- import TileLineModel from "./tile";
10
9
  import LineWallModel from "./wall";
11
10
  var LineModels = {
12
11
  arc: ArcModel,
@@ -17,7 +16,6 @@ var LineModels = {
17
16
  halfLine: LineHalfModel,
18
17
  simple: SimpleLineModel,
19
18
  linearline: LinearLine,
20
- tileLine: TileLineModel,
21
19
  earthArc3d: EarthArc3DModel
22
20
  };
23
21
  export default LineModels;
@@ -63,14 +63,11 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
63
63
 
64
64
  case 2:
65
65
  layer.dataState.dataMappingNeedUpdate = false;
66
-
67
- _this.generateMaping(layer, {
66
+ return _context2.abrupt("return", _this.generateMaping(layer, {
68
67
  styleAttributeService: styleAttributeService
69
- });
70
-
71
- return _context2.abrupt("return", true);
68
+ }));
72
69
 
73
- case 5:
70
+ case 4:
74
71
  case "end":
75
72
  return _context2.stop();
76
73
  }
@@ -142,9 +139,15 @@ var DataMappingPlugin = (_dec = injectable(), _dec2 = inject(TYPES.IMapService),
142
139
 
143
140
  filterData = layer.processData(filterData);
144
141
  var encodeData = this.mapping(layer, attributes, filterData, undefined);
145
- layer.setEncodedData(encodeData); // 对外暴露事件
142
+ layer.setEncodedData(encodeData);
143
+
144
+ if (dataArray.length === 0 && layer.encodeDataLength === 0) {
145
+ return false;
146
+ } // 对外暴露事件
147
+
146
148
 
147
149
  layer.emit('dataUpdate', null);
150
+ return true;
148
151
  }
149
152
  }, {
150
153
  key: "mapping",
@@ -26,6 +26,6 @@ export default class PointLayer extends BaseLayer<IPointLayerStyleOptions> {
26
26
  blend: string;
27
27
  } | {} | {} | {
28
28
  blend: string;
29
- } | {} | {} | {} | {};
29
+ } | {} | {};
30
30
  getModelType(): PointType;
31
31
  }
@@ -1,10 +1,6 @@
1
1
  import { IAnimateOption, IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
2
2
  import BaseModel from '../../core/BaseModel';
3
3
  export default class FillModel extends BaseModel {
4
- private meter2coord;
5
- private meterYScale;
6
- private isMeter;
7
- private unit;
8
4
  getUninforms(): IModelUniform;
9
5
  getAnimateUniforms(): IModelUniform;
10
6
  getAttribute(): {
@@ -14,11 +10,6 @@ export default class FillModel extends BaseModel {
14
10
  elements: IElements;
15
11
  };
16
12
  initModels(): Promise<IModel[]>;
17
- /**
18
- * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
19
- * @returns
20
- */
21
- calMeter2Coord(): void;
22
13
  buildModels(): Promise<IModel[]>;
23
14
  /**
24
15
  * 根据 animateOption 的值返回对应的 shader 代码
@@ -32,9 +23,4 @@ export default class FillModel extends BaseModel {
32
23
  clearModels(): void;
33
24
  protected animateOption2Array(option: Partial<IAnimateOption>): number[];
34
25
  protected registerBuiltinAttributes(): void;
35
- /**
36
- * 判断是否更新点图层的计量单位
37
- * @param unit
38
- */
39
- private updateUnit;
40
26
  }
@@ -1,12 +1,9 @@
1
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
1
  import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
2
  import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
4
3
  import _createClass from "@babel/runtime/helpers/esm/createClass";
5
- import _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
6
4
  import _inherits from "@babel/runtime/helpers/esm/inherits";
7
5
  import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
8
6
  import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
9
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
10
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
11
8
 
12
9
  function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
@@ -14,7 +11,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
14
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; } }
15
12
 
16
13
  import { AttributeType, gl } from '@antv/l7-core';
17
- import { $window, getMask, PointFillTriangulation } from '@antv/l7-utils';
14
+ import { getMask, PointFillTriangulation } from '@antv/l7-utils';
18
15
  import { isNumber } from 'lodash';
19
16
  import BaseModel from "../../core/BaseModel";
20
17
 
@@ -26,8 +23,8 @@ var waveFillFrag = "\nuniform float u_additive;\n\nvarying mat4 styleMappingMat;
26
23
  var pointFillFrag = "uniform 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;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\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 float stroke_opacity = styleMappingMat[0][1];\n float strokeWidth = styleMappingMat[0][2];\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * opacity), strokeColor * stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
27
24
 
28
25
  /* babel-plugin-inline-import '../shaders/fill_vert.glsl' */
29
- 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 float u_meter2coord;\nuniform float u_meteryScale;\nuniform float u_isMeter;\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) * u_meter2coord;\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;\n\n // radius(16-bit)\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 if(u_isMeter < 1.0) {\n // \u4E0D\u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n offset = project_pixel(offset);\n } else {\n // \u4EE5\u7C73\u4E3A\u5B9E\u9645\u5355\u4F4D\n if(newSize * pow(2.0, u_Zoom) < 48.0) {\n antialiasblur = max(antialiasblur, -0.05);\n } else if(newSize * pow(2.0, u_Zoom) < 128.0) {\n antialiasblur = max(antialiasblur, -0.6/pow(u_Zoom, 2.0));\n } else {\n antialiasblur = max(antialiasblur, -0.8/pow(u_Zoom, 2.0));\n }\n \n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n aPosition.x += offset.x / u_meteryScale;\n aPosition.y += offset.y;\n offset = vec2(0.0);\n }\n }\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";
30
- import { Version } from '@antv/l7-maps';
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";
31
28
 
32
29
  var FillModel = /*#__PURE__*/function (_BaseModel) {
33
30
  _inherits(FillModel, _BaseModel);
@@ -35,25 +32,9 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
35
32
  var _super = _createSuper(FillModel);
36
33
 
37
34
  function FillModel() {
38
- var _this;
39
-
40
35
  _classCallCheck(this, FillModel);
41
36
 
42
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
43
- args[_key] = arguments[_key];
44
- }
45
-
46
- _this = _super.call.apply(_super, [this].concat(args));
47
-
48
- _defineProperty(_assertThisInitialized(_this), "meter2coord", 1);
49
-
50
- _defineProperty(_assertThisInitialized(_this), "meterYScale", 1);
51
-
52
- _defineProperty(_assertThisInitialized(_this), "isMeter", false);
53
-
54
- _defineProperty(_assertThisInitialized(_this), "unit", 'l7size');
55
-
56
- return _this;
37
+ return _super.apply(this, arguments);
57
38
  }
58
39
 
59
40
  _createClass(FillModel, [{
@@ -78,9 +59,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
78
59
  _ref$heightfixed = _ref.heightfixed,
79
60
  heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
80
61
  _ref$unit = _ref.unit,
81
- unit = _ref$unit === void 0 ? 'l7size' : _ref$unit;
82
-
83
- this.updateUnit(unit);
62
+ unit = _ref$unit === void 0 ? 'pixel' : _ref$unit;
84
63
 
85
64
  if (this.dataTextureTest && this.dataTextureNeedUpdate({
86
65
  opacity: opacity,
@@ -126,9 +105,6 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
126
105
  return {
127
106
  u_raisingHeight: Number(raisingHeight),
128
107
  u_heightfixed: Number(heightfixed),
129
- u_meter2coord: this.meter2coord,
130
- u_meteryScale: this.meterYScale,
131
- u_isMeter: Number(this.isMeter),
132
108
  u_blur: blur,
133
109
  u_additive: blend === 'additive' ? 1.0 : 0.0,
134
110
  u_dataTexture: this.dataTexture,
@@ -138,6 +114,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
138
114
  u_stroke_opacity: isNumber(strokeOpacity) ? strokeOpacity : 1.0,
139
115
  u_stroke_width: isNumber(strokeWidth) ? strokeWidth : 1.0,
140
116
  u_stroke_color: this.getStrokeColor(stroke),
117
+ u_Size_Unit: SizeUnitType[unit],
141
118
  u_offsets: this.isOffsetStatic(offsets) ? offsets : [0, 0]
142
119
  };
143
120
  }
@@ -168,14 +145,13 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
168
145
  while (1) {
169
146
  switch (_context.prev = _context.next) {
170
147
  case 0:
171
- this.updateUnit('l7size');
172
- _context.next = 3;
148
+ _context.next = 2;
173
149
  return this.buildModels();
174
150
 
175
- case 3:
151
+ case 2:
176
152
  return _context.abrupt("return", _context.sent);
177
153
 
178
- case 4:
154
+ case 3:
179
155
  case "end":
180
156
  return _context.stop();
181
157
  }
@@ -189,50 +165,6 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
189
165
 
190
166
  return initModels;
191
167
  }()
192
- /**
193
- * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
194
- * @returns
195
- */
196
-
197
- }, {
198
- key: "calMeter2Coord",
199
- value: function calMeter2Coord() {
200
- var _this$layer$getSource = _slicedToArray(this.layer.getSource().extent, 4),
201
- minLng = _this$layer$getSource[0],
202
- minLat = _this$layer$getSource[1],
203
- maxLng = _this$layer$getSource[2],
204
- maxLat = _this$layer$getSource[3];
205
-
206
- var center = [(minLng + maxLng) / 2, (minLat + maxLat) / 2];
207
- var version = this.mapService.version;
208
- var mapboxContext = $window === null || $window === void 0 ? void 0 : $window.mapboxgl;
209
-
210
- if (version === Version.MAPBOX && mapboxContext !== null && mapboxContext !== void 0 && mapboxContext.MercatorCoordinate) {
211
- // 参考:
212
- // https://docs.mapbox.com/mapbox-gl-js/api/geography/#mercatorcoordinate#meterinmercatorcoordinateunits
213
- var coord = mapboxContext.MercatorCoordinate.fromLngLat({
214
- lng: center[0],
215
- lat: center[1]
216
- }, 0);
217
- var offsetInMercatorCoordinateUnits = coord.meterInMercatorCoordinateUnits();
218
- var westCoord = new mapboxContext.MercatorCoordinate(coord.x - offsetInMercatorCoordinateUnits, coord.y, coord.z);
219
- var westLnglat = westCoord.toLngLat();
220
- var southCoord = new mapboxContext.MercatorCoordinate(coord.x, coord.y - offsetInMercatorCoordinateUnits, coord.z);
221
- var southLnglat = southCoord.toLngLat();
222
- this.meter2coord = center[0] - westLnglat.lng;
223
- this.meterYScale = (southLnglat.lat - center[1]) / this.meter2coord;
224
- return;
225
- }
226
-
227
- var m1 = this.mapService.meterToCoord(center, [minLng, minLat]);
228
- var m2 = this.mapService.meterToCoord(center, [maxLng === minLng ? maxLng + 0.1 : maxLng, maxLat === minLat ? minLat + 0.1 : maxLat]);
229
- this.meter2coord = (m1 + m2) / 2;
230
-
231
- if (!this.meter2coord) {
232
- // Tip: 兼容单个数据导致的 m1、m2 为 NaN
233
- this.meter2coord = 7.70681090738883;
234
- }
235
- }
236
168
  }, {
237
169
  key: "buildModels",
238
170
  value: function () {
@@ -395,29 +327,6 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
395
327
  }
396
328
  });
397
329
  }
398
- /**
399
- * 判断是否更新点图层的计量单位
400
- * @param unit
401
- */
402
-
403
- }, {
404
- key: "updateUnit",
405
- value: function updateUnit(unit) {
406
- var version = this.mapService.version;
407
-
408
- if (this.unit !== unit) {
409
- // l7size => meter
410
- if (this.unit !== 'meter' && unit === 'meter' && version !== Version.DEFUALT && version !== Version.GLOBEL) {
411
- this.isMeter = true;
412
- this.calMeter2Coord(); // meter => l7size
413
- } else if (this.unit === 'meter' && unit !== 'meter') {
414
- this.isMeter = false;
415
- this.meter2coord = 1;
416
- }
417
-
418
- this.unit = unit;
419
- }
420
- }
421
330
  }]);
422
331
 
423
332
  return FillModel;
@@ -13,11 +13,6 @@ export default class FillImageModel extends BaseModel {
13
13
  elements: IElements;
14
14
  };
15
15
  initModels(): Promise<IModel[]>;
16
- /**
17
- * 计算等面积点图层(unit meter)笛卡尔坐标标度与世界坐标标度的比例
18
- * @returns
19
- */
20
- calMeter2Coord(): void;
21
16
  buildModels(): Promise<IModel[]>;
22
17
  clearModels(): void;
23
18
  protected registerBuiltinAttributes(): void;