@antv/l7-layers 2.12.2 → 2.13.1

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 (99) 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/line/models/line.d.ts +0 -1
  11. package/es/line/models/line.js +0 -9
  12. package/es/plugins/DataMappingPlugin.js +10 -7
  13. package/es/point/index.d.ts +1 -1
  14. package/es/point/models/fill.d.ts +0 -14
  15. package/es/point/models/fill.js +9 -100
  16. package/es/point/models/fillmage.d.ts +0 -5
  17. package/es/point/models/fillmage.js +15 -65
  18. package/es/point/models/index.d.ts +1 -1
  19. package/es/point/models/index.js +0 -4
  20. package/es/point/models/radar.d.ts +0 -7
  21. package/es/point/models/radar.js +13 -79
  22. package/es/point/models/text.js +1 -1
  23. package/es/point/shaders/fill_vert.glsl +9 -26
  24. package/es/point/shaders/image/fillImage_vert.glsl +8 -14
  25. package/es/point/shaders/radar/radar_vert.glsl +12 -19
  26. package/es/point/shaders/text_vert.glsl +1 -1
  27. package/es/polygon/index.js +0 -2
  28. package/es/polygon/models/index.d.ts +1 -1
  29. package/es/polygon/models/index.js +2 -4
  30. package/es/raster/models/raster.d.ts +0 -2
  31. package/es/raster/models/raster.js +6 -22
  32. package/es/raster/models/rasterTerrainRgb.js +6 -6
  33. package/es/raster/shaders/raster_2d_frag.glsl +1 -0
  34. package/es/tile/tileFactory/RasterRGBTile.js +0 -1
  35. package/es/tile/tileFactory/RasterTile.js +13 -8
  36. package/lib/core/BaseLayer.js +17 -6
  37. package/lib/core/TextureService.js +31 -9
  38. package/lib/core/interface.js +9 -1
  39. package/lib/line/models/index.js +0 -3
  40. package/lib/line/models/line.js +0 -8
  41. package/lib/plugins/DataMappingPlugin.js +10 -7
  42. package/lib/point/models/fill.js +8 -98
  43. package/lib/point/models/fillmage.js +16 -67
  44. package/lib/point/models/index.js +0 -6
  45. package/lib/point/models/radar.js +13 -80
  46. package/lib/point/models/text.js +1 -1
  47. package/lib/point/shaders/fill_vert.glsl +9 -26
  48. package/lib/point/shaders/image/fillImage_vert.glsl +8 -14
  49. package/lib/point/shaders/radar/radar_vert.glsl +12 -19
  50. package/lib/point/shaders/text_vert.glsl +1 -1
  51. package/lib/polygon/index.js +0 -2
  52. package/lib/polygon/models/index.js +2 -5
  53. package/lib/raster/models/raster.js +5 -21
  54. package/lib/raster/models/rasterTerrainRgb.js +5 -5
  55. package/lib/raster/shaders/raster_2d_frag.glsl +1 -0
  56. package/lib/tile/tileFactory/RasterTile.js +14 -8
  57. package/package.json +6 -6
  58. package/es/line/models/tile.d.ts +0 -8
  59. package/es/line/models/tile.js +0 -201
  60. package/es/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  61. package/es/line/shaders/tile/line_tile_vert.glsl +0 -52
  62. package/es/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  63. package/es/line/shaders/tile/simpleline_vert.glsl +0 -21
  64. package/es/point/models/tile.d.ts +0 -15
  65. package/es/point/models/tile.js +0 -217
  66. package/es/point/models/tileText.d.ts +0 -52
  67. package/es/point/models/tileText.js +0 -544
  68. package/es/point/shaders/tile/fill_tile_frag.glsl +0 -76
  69. package/es/point/shaders/tile/fill_tile_vert.glsl +0 -78
  70. package/es/point/shaders/tile/text_frag.glsl +0 -33
  71. package/es/point/shaders/tile/text_map_frag.glsl +0 -31
  72. package/es/point/shaders/tile/text_map_vert.glsl +0 -38
  73. package/es/point/shaders/tile/text_vert.glsl +0 -48
  74. package/es/polygon/models/tile.d.ts +0 -12
  75. package/es/polygon/models/tile.js +0 -141
  76. package/es/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  77. package/es/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  78. package/es/raster/models/rasterTile.d.ts +0 -18
  79. package/es/raster/models/rasterTile.js +0 -180
  80. package/es/tile/tileFactory/layers/RasterDataLayer.d.ts +0 -11
  81. package/es/tile/tileFactory/layers/RasterDataLayer.js +0 -89
  82. package/lib/line/models/tile.js +0 -217
  83. package/lib/line/shaders/tile/line_tile_map_vert.glsl +0 -25
  84. package/lib/line/shaders/tile/line_tile_vert.glsl +0 -52
  85. package/lib/line/shaders/tile/simpleline_map_vert.glsl +0 -15
  86. package/lib/line/shaders/tile/simpleline_vert.glsl +0 -21
  87. package/lib/point/models/tile.js +0 -233
  88. package/lib/point/models/tileText.js +0 -560
  89. package/lib/point/shaders/tile/fill_tile_frag.glsl +0 -76
  90. package/lib/point/shaders/tile/fill_tile_vert.glsl +0 -78
  91. package/lib/point/shaders/tile/text_frag.glsl +0 -33
  92. package/lib/point/shaders/tile/text_map_frag.glsl +0 -31
  93. package/lib/point/shaders/tile/text_map_vert.glsl +0 -38
  94. package/lib/point/shaders/tile/text_vert.glsl +0 -48
  95. package/lib/polygon/models/tile.js +0 -156
  96. package/lib/polygon/shaders/tile/polygon_tile_map_vert.glsl +0 -16
  97. package/lib/polygon/shaders/tile/polygon_tile_vert.glsl +0 -42
  98. package/lib/raster/models/rasterTile.js +0 -196
  99. package/lib/tile/tileFactory/layers/RasterDataLayer.js +0 -105
@@ -1,25 +0,0 @@
1
- attribute float a_Miter;
2
- attribute vec4 a_Color;
3
- attribute vec3 a_Normal;
4
- attribute vec3 a_Position;
5
-
6
- uniform mat4 u_ModelMatrix;
7
- uniform mat4 u_Mvp;
8
- uniform float u_size;
9
-
10
- #pragma include "projection"
11
-
12
- void main() {
13
-
14
- vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);
15
-
16
- vec2 offset = project_pixel(size.xy);
17
-
18
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
19
-
20
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
21
- gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
22
- } else {
23
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
24
- }
25
- }
@@ -1,52 +0,0 @@
1
- attribute float a_Miter;
2
- attribute vec4 a_Color;
3
- attribute vec2 a_Size;
4
- attribute vec3 a_Normal;
5
- attribute vec3 a_Position;
6
-
7
- // uniform vec2 u_tileOrigin;
8
- // uniform float u_coord;
9
-
10
- uniform mat4 u_ModelMatrix;
11
- uniform mat4 u_Mvp;
12
-
13
-
14
- #pragma include "projection"
15
- #pragma include "picking"
16
-
17
- varying vec4 v_color;
18
-
19
- void main() {
20
- v_color = a_Color;
21
-
22
- vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);
23
-
24
- vec2 offset = project_pixel(size.xy);
25
-
26
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
27
-
28
- // if(u_coord > 0.0) { // 使用经纬度坐标
29
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
30
- gl_Position = u_Mvp * (vec4(project_pos.xy + offset, 0.0, 1.0));
31
- } else {
32
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));
33
- }
34
- // } else { // 使用偏移坐标
35
- // vec2 pointPos = a_Position.xy;
36
- // vec4 tileWorld = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // 瓦片起始点的世界坐标
37
-
38
- // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // 瓦片内的点的偏移坐标
39
-
40
- // tileWorld.xy += pointOffset;
41
-
42
- // tileWorld.xy += offset;
43
-
44
- // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {
45
- // // Needs to be divided with project_uCommonUnitsPerMeter
46
- // tileWorld.w *= u_PixelsPerMeter.z;
47
- // }
48
- // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;
49
- // }
50
-
51
- setPickingColor(a_PickingColor);
52
- }
@@ -1,15 +0,0 @@
1
- attribute vec3 a_Position;
2
- uniform mat4 u_ModelMatrix;
3
- uniform mat4 u_Mvp;
4
-
5
- #pragma include "projection"
6
-
7
- void main() {
8
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
9
-
10
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
11
- gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
12
- } else {
13
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
14
- }
15
- }
@@ -1,21 +0,0 @@
1
- attribute vec4 a_Color;
2
- attribute vec3 a_Position;
3
-
4
- uniform mat4 u_ModelMatrix;
5
- uniform mat4 u_Mvp;
6
-
7
- #pragma include "projection"
8
-
9
- varying vec4 v_color;
10
-
11
- void main() {
12
- v_color = a_Color;
13
-
14
- vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));
15
-
16
- if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x
17
- gl_Position = u_Mvp * (vec4(project_pos.xy, 0.0, 1.0));
18
- } else {
19
- gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy, 0.0, 1.0));
20
- }
21
- }
@@ -1,15 +0,0 @@
1
- import { IAttribute, IElements, IModel, IModelUniform } from '@antv/l7-core';
2
- import BaseModel from '../../core/BaseModel';
3
- export default class FillModel extends BaseModel {
4
- getUninforms(): IModelUniform;
5
- getAttribute(): {
6
- attributes: {
7
- [attributeName: string]: IAttribute;
8
- };
9
- elements: IElements;
10
- };
11
- initModels(): Promise<IModel[]>;
12
- buildModels(): Promise<IModel[]>;
13
- clearModels(): void;
14
- protected registerBuiltinAttributes(): void;
15
- }
@@ -1,217 +0,0 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
- import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck";
3
- import _createClass from "@babel/runtime/helpers/esm/createClass";
4
- import _inherits from "@babel/runtime/helpers/esm/inherits";
5
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
6
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
7
- import _regeneratorRuntime from "@babel/runtime/regenerator";
8
-
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); }; }
10
-
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
-
13
- import { AttributeType, gl } from '@antv/l7-core';
14
- import { getCullFace } from '@antv/l7-utils';
15
- import BaseModel from "../../core/BaseModel";
16
- import { PointFillTriangulation } from "../../core/triangulation";
17
-
18
- /* babel-plugin-inline-import '../shaders/tile/fill_tile_frag.glsl' */
19
- var point_tile_frag = "uniform float u_additive;\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];\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + u_stroke_width);\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\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = u_stroke_width < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(u_stroke_width < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_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";
20
-
21
- /* babel-plugin-inline-import '../shaders/tile/fill_tile_vert.glsl' */
22
- var point_tile_vert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\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];\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n float newSize = setPickingSize(a_Size);\n\n // cal style mapping\n\n v_color = a_Color;\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / a_Size, 0.0);\n\n vec2 offset = (extrude.xy * (newSize + u_stroke_width));\n offset = project_pixel(offset);\n\n v_data = vec4(extrude.x, extrude.y, antialiasblur,shape_type);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\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 }\n\n// if(u_coord > 0.0) {\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n gl_Position = u_Mvp * vec4(project_pos.xy + offset, 0.0, 1.0);\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xy + offset, 0.0, 1.0));\n }\n// } else {\n\n // vec2 pointPos = a_Position.xy;\n // vec4 world = vec4(project_mvt_offset_position(vec4(u_tileOrigin, 0.0, 1.0)).xyz, 1.0); // \u74E6\u7247\u8D77\u59CB\u70B9\u7684\u4E16\u754C\u5750\u6807\n\n // vec2 pointOffset = pointPos * pow(2.0, u_Zoom); // \u74E6\u7247\u5185\u7684\u70B9\u7684\u504F\u79FB\u5750\u6807\n \n // world.xy += offset;\n // world.xy += pointOffset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // world.w *= u_PixelsPerMeter.z;\n // }\n\n // gl_Position = u_ViewProjectionMatrix * world + u_ViewportCenterProjection;\n// }\n\n \n setPickingColor(a_PickingColor);\n\n\n}\n";
23
-
24
- var FillModel = /*#__PURE__*/function (_BaseModel) {
25
- _inherits(FillModel, _BaseModel);
26
-
27
- var _super = _createSuper(FillModel);
28
-
29
- function FillModel() {
30
- _classCallCheck(this, FillModel);
31
-
32
- return _super.apply(this, arguments);
33
- }
34
-
35
- _createClass(FillModel, [{
36
- key: "getUninforms",
37
- value: function getUninforms() {
38
- var _ref = this.layer.getLayerConfig(),
39
- _ref$opacity = _ref.opacity,
40
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
41
- _ref$strokeOpacity = _ref.strokeOpacity,
42
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
43
- _ref$strokeWidth = _ref.strokeWidth,
44
- strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
45
- _ref$stroke = _ref.stroke,
46
- stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
47
- blend = _ref.blend;
48
-
49
- return {
50
- // u_tileOrigin: tileOrigin || [0, 0],
51
- // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
52
- u_additive: blend === 'additive' ? 1.0 : 0.0,
53
- u_opacity: Number(opacity),
54
- u_stroke_opacity: Number(strokeOpacity),
55
- u_stroke_width: Number(strokeWidth),
56
- u_stroke_color: this.getStrokeColor(stroke)
57
- };
58
- }
59
- }, {
60
- key: "getAttribute",
61
- value: function getAttribute() {
62
- return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), PointFillTriangulation);
63
- }
64
- }, {
65
- key: "initModels",
66
- value: function () {
67
- var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
68
- return _regeneratorRuntime.wrap(function _callee$(_context) {
69
- while (1) {
70
- switch (_context.prev = _context.next) {
71
- case 0:
72
- _context.next = 2;
73
- return this.buildModels();
74
-
75
- case 2:
76
- return _context.abrupt("return", _context.sent);
77
-
78
- case 3:
79
- case "end":
80
- return _context.stop();
81
- }
82
- }
83
- }, _callee, this);
84
- }));
85
-
86
- function initModels() {
87
- return _initModels.apply(this, arguments);
88
- }
89
-
90
- return initModels;
91
- }()
92
- }, {
93
- key: "buildModels",
94
- value: function () {
95
- var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
96
- var _ref2, _ref2$workerEnabled, workerEnabled, usage, model;
97
-
98
- return _regeneratorRuntime.wrap(function _callee2$(_context2) {
99
- while (1) {
100
- switch (_context2.prev = _context2.next) {
101
- case 0:
102
- _ref2 = this.layer.getLayerConfig(), _ref2$workerEnabled = _ref2.workerEnabled, workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled, usage = _ref2.usage;
103
- this.layer.triangulation = PointFillTriangulation;
104
- _context2.next = 4;
105
- return this.layer.buildLayerModel({
106
- moduleName: 'pointTile_' + usage,
107
- vertexShader: point_tile_vert,
108
- fragmentShader: point_tile_frag,
109
- triangulation: PointFillTriangulation,
110
- depth: {
111
- enable: false
112
- },
113
- cull: {
114
- enable: true,
115
- face: getCullFace(this.mapService.version)
116
- },
117
- blend: this.getBlend(),
118
- workerEnabled: workerEnabled,
119
- workerOptions: {
120
- modelType: 'pointTile'
121
- },
122
- pick: usage !== 'basemap'
123
- });
124
-
125
- case 4:
126
- model = _context2.sent;
127
- return _context2.abrupt("return", [model]);
128
-
129
- case 6:
130
- case "end":
131
- return _context2.stop();
132
- }
133
- }
134
- }, _callee2, this);
135
- }));
136
-
137
- function buildModels() {
138
- return _buildModels.apply(this, arguments);
139
- }
140
-
141
- return buildModels;
142
- }()
143
- }, {
144
- key: "clearModels",
145
- value: function clearModels() {}
146
- }, {
147
- key: "registerBuiltinAttributes",
148
- value: function registerBuiltinAttributes() {
149
- var _this = this;
150
-
151
- this.styleAttributeService.registerStyleAttribute({
152
- name: 'extrude',
153
- type: AttributeType.Attribute,
154
- descriptor: {
155
- name: 'a_Extrude',
156
- buffer: {
157
- // give the WebGL driver a hint that this buffer may change
158
- usage: gl.DYNAMIC_DRAW,
159
- data: [],
160
- type: gl.FLOAT
161
- },
162
- size: 3,
163
- update: function update(feature, featureIdx, vertex, attributeIdx) {
164
- var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
165
- var extrudeIndex = attributeIdx % 4 * 3;
166
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
167
- }
168
- }
169
- });
170
- this.styleAttributeService.registerStyleAttribute({
171
- name: 'size',
172
- type: AttributeType.Attribute,
173
- descriptor: {
174
- name: 'a_Size',
175
- buffer: {
176
- usage: gl.DYNAMIC_DRAW,
177
- data: [],
178
- type: gl.FLOAT
179
- },
180
- size: 1,
181
- update: function update(feature) {
182
- var _feature$size = feature.size,
183
- size = _feature$size === void 0 ? 5 : _feature$size;
184
- return Array.isArray(size) ? [size[0]] : [size];
185
- }
186
- }
187
- });
188
- this.styleAttributeService.registerStyleAttribute({
189
- name: 'shape',
190
- type: AttributeType.Attribute,
191
- descriptor: {
192
- name: 'a_Shape',
193
- buffer: {
194
- // give the WebGL driver a hint that this buffer may change
195
- usage: gl.DYNAMIC_DRAW,
196
- data: [],
197
- type: gl.FLOAT
198
- },
199
- size: 1,
200
- update: function update(feature) {
201
- var _feature$shape = feature.shape,
202
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
203
-
204
- var shape2d = _this.layer.getLayerConfig().shape2d;
205
-
206
- var shapeIndex = shape2d.indexOf(shape);
207
- return [shapeIndex];
208
- }
209
- }
210
- });
211
- }
212
- }]);
213
-
214
- return FillModel;
215
- }(BaseModel);
216
-
217
- export { FillModel as default };
@@ -1,52 +0,0 @@
1
- import { IEncodeFeature, IModel, IModelUniform } from '@antv/l7-core';
2
- import BaseModel from '../../core/BaseModel';
3
- import { IGlyphQuad } from '../../utils/symbol-layout';
4
- export declare function TextTriangulation(feature: IEncodeFeature): {
5
- vertices: number[];
6
- indices: number[];
7
- size: number;
8
- };
9
- export default class TextModel extends BaseModel {
10
- glyphInfo: IEncodeFeature[];
11
- glyphInfoMap: {
12
- [key: string]: {
13
- shaping: any;
14
- glyphQuads: IGlyphQuad[];
15
- centroid: number[];
16
- };
17
- };
18
- private texture;
19
- private currentZoom;
20
- private extent;
21
- private textureHeight;
22
- private textCount;
23
- private preTextStyle;
24
- getUninforms(): IModelUniform;
25
- initModels(): Promise<IModel[]>;
26
- buildModels(): Promise<IModel[]>;
27
- clearModels(): void;
28
- protected registerBuiltinAttributes(): void;
29
- private mapping;
30
- private textExtent;
31
- /**
32
- * 生成文字纹理(生成文字纹理字典)
33
- */
34
- private initTextFont;
35
- /**
36
- * 生成文字布局(对照文字纹理字典提取对应文字的位置很好信息)
37
- */
38
- private generateGlyphLayout;
39
- /**
40
- * 文字避让 depend on originCentorid
41
- */
42
- private filterGlyphs;
43
- /**
44
- * 初始化文字布局
45
- */
46
- private initGlyph;
47
- /**
48
- * 更新文字纹理
49
- */
50
- private updateTexture;
51
- private reBuildModel;
52
- }