@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
@@ -1,89 +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 _assertThisInitialized from "@babel/runtime/helpers/esm/assertThisInitialized";
5
- import _inherits from "@babel/runtime/helpers/esm/inherits";
6
- import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
7
- import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
8
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
9
- import _regeneratorRuntime from "@babel/runtime/regenerator";
10
-
11
- 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); }; }
12
-
13
- 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; } }
14
-
15
- import BaseLayer from "../../../core/BaseLayer";
16
- import RasterModel from "../../../raster/models/rasterTile";
17
- import RasterRgbModel from "../../../raster/models/rasterRgb";
18
-
19
- var RasterTiffLayer = /*#__PURE__*/function (_BaseLayer) {
20
- _inherits(RasterTiffLayer, _BaseLayer);
21
-
22
- var _super = _createSuper(RasterTiffLayer);
23
-
24
- function RasterTiffLayer() {
25
- var _this;
26
-
27
- _classCallCheck(this, RasterTiffLayer);
28
-
29
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
30
- args[_key] = arguments[_key];
31
- }
32
-
33
- _this = _super.call.apply(_super, [this].concat(args));
34
-
35
- _defineProperty(_assertThisInitialized(_this), "type", 'RasterLayer');
36
-
37
- return _this;
38
- }
39
-
40
- _createClass(RasterTiffLayer, [{
41
- key: "buildModels",
42
- value: function () {
43
- var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
44
- var model;
45
- return _regeneratorRuntime.wrap(function _callee$(_context) {
46
- while (1) {
47
- switch (_context.prev = _context.next) {
48
- case 0:
49
- model = this.getModel();
50
- this.layerModel = new model(this);
51
- _context.next = 4;
52
- return this.initLayerModels();
53
-
54
- case 4:
55
- case "end":
56
- return _context.stop();
57
- }
58
- }
59
- }, _callee, this);
60
- }));
61
-
62
- function buildModels() {
63
- return _buildModels.apply(this, arguments);
64
- }
65
-
66
- return buildModels;
67
- }()
68
- }, {
69
- key: "getModel",
70
- value: function getModel() {
71
- var type = this.getModelType();
72
- return type === 'rasterRgb' ? RasterRgbModel : RasterModel;
73
- }
74
- }, {
75
- key: "getModelType",
76
- value: function getModelType() {
77
- return this.layerSource.parser.type === 'rasterRgb' ? 'rasterRgb' : 'raster';
78
- }
79
- }, {
80
- key: "getDefaultConfig",
81
- value: function getDefaultConfig() {
82
- return {};
83
- }
84
- }]);
85
-
86
- return RasterTiffLayer;
87
- }(BaseLayer);
88
-
89
- export { RasterTiffLayer as default };
@@ -1,217 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
29
-
30
- var _triangulation = require("../../core/triangulation");
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
- 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; } }
35
-
36
- /* babel-plugin-inline-import '../../shader/minify_picking_frag.glsl' */
37
- var line_tile_frag = "uniform float u_opacity : 1.0;\nvarying vec4 v_color;\n\n#pragma include \"picking\"\n\nvoid main() {\n gl_FragColor = v_color;\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
38
-
39
- /* babel-plugin-inline-import '../shaders/tile/line_tile_vert.glsl' */
40
- var line_tile_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec2 a_Size;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\n// uniform vec2 u_tileOrigin;\n// uniform float u_coord;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\nvarying vec4 v_color;\n\nvoid main() {\n v_color = a_Color;\n\n vec3 size = a_Miter * setPickingSize(a_Size.x) * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\n // if(u_coord > 0.0) { // \u4F7F\u7528\u7ECF\u7EAC\u5EA6\u5750\u6807\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 { // \u4F7F\u7528\u504F\u79FB\u5750\u6807\n // vec2 pointPos = a_Position.xy;\n // vec4 tileWorld = 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 // tileWorld.xy += pointOffset;\n\n // tileWorld.xy += offset;\n\n // if (u_CoordinateSystem == COORDINATE_SYSTEM_METER_OFFSET || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n // // Needs to be divided with project_uCommonUnitsPerMeter\n // tileWorld.w *= u_PixelsPerMeter.z;\n // }\n // gl_Position = u_ViewProjectionMatrix * tileWorld + u_ViewportCenterProjection;\n // }\n\n setPickingColor(a_PickingColor);\n}\n";
41
-
42
- /* babel-plugin-inline-import '../../shader/minify_frag.glsl' */
43
- var line_tile_map_frag = "uniform float u_opacity : 1.0;\nuniform vec4 u_color;\n\nvoid main() {\n gl_FragColor = u_color;\n gl_FragColor.a *= u_opacity;\n}\n";
44
-
45
- /* babel-plugin-inline-import '../shaders/tile/line_tile_map_vert.glsl' */
46
- var line_tile_map_vert = "attribute float a_Miter;\nattribute vec4 a_Color;\nattribute vec3 a_Normal;\nattribute vec3 a_Position;\n\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nuniform float u_size;\n\n#pragma include \"projection\"\n\nvoid main() {\n\n vec3 size = a_Miter * u_size * reverse_offset_normal(a_Normal);\n \n vec2 offset = project_pixel(size.xy);\n\n vec4 project_pos = project_position(vec4(a_Position.xy, 0, 1.0));\n\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}\n";
47
-
48
- var LineModel = /*#__PURE__*/function (_BaseModel) {
49
- (0, _inherits2.default)(LineModel, _BaseModel);
50
-
51
- var _super = _createSuper(LineModel);
52
-
53
- function LineModel() {
54
- (0, _classCallCheck2.default)(this, LineModel);
55
- return _super.apply(this, arguments);
56
- }
57
-
58
- (0, _createClass2.default)(LineModel, [{
59
- key: "getUninforms",
60
- value: function getUninforms() {
61
- var _ref = this.layer.getLayerConfig(),
62
- _ref$opacity = _ref.opacity,
63
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
64
- usage = _ref.usage,
65
- _ref$color = _ref.color,
66
- color = _ref$color === void 0 ? '#fff' : _ref$color,
67
- _ref$size = _ref.size,
68
- size = _ref$size === void 0 ? 1 : _ref$size;
69
-
70
- return {
71
- // u_tileOrigin: tileOrigin || [0, 0],
72
- // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
73
- u_opacity: Number(opacity),
74
- u_color: usage === 'basemap' ? (0, _l7Utils.rgb2arr)(color) : [0, 0, 0, 0],
75
- u_size: usage === 'basemap' ? size : 1
76
- };
77
- }
78
- }, {
79
- key: "initModels",
80
- value: function () {
81
- var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
82
- return _regenerator.default.wrap(function _callee$(_context) {
83
- while (1) {
84
- switch (_context.prev = _context.next) {
85
- case 0:
86
- _context.next = 2;
87
- return this.buildModels();
88
-
89
- case 2:
90
- return _context.abrupt("return", _context.sent);
91
-
92
- case 3:
93
- case "end":
94
- return _context.stop();
95
- }
96
- }
97
- }, _callee, this);
98
- }));
99
-
100
- function initModels() {
101
- return _initModels.apply(this, arguments);
102
- }
103
-
104
- return initModels;
105
- }()
106
- }, {
107
- key: "buildModels",
108
- value: function () {
109
- var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
110
- var _ref2, _ref2$mask, mask, _ref2$maskInside, maskInside, _ref2$depth, depth, usage, model;
111
-
112
- return _regenerator.default.wrap(function _callee2$(_context2) {
113
- while (1) {
114
- switch (_context2.prev = _context2.next) {
115
- case 0:
116
- _ref2 = this.layer.getLayerConfig(), _ref2$mask = _ref2.mask, mask = _ref2$mask === void 0 ? false : _ref2$mask, _ref2$maskInside = _ref2.maskInside, maskInside = _ref2$maskInside === void 0 ? true : _ref2$maskInside, _ref2$depth = _ref2.depth, depth = _ref2$depth === void 0 ? false : _ref2$depth, usage = _ref2.usage;
117
- this.layer.triangulation = _triangulation.LineTriangulation;
118
- _context2.next = 4;
119
- return this.layer.buildLayerModel({
120
- moduleName: 'lineTile_' + usage,
121
- vertexShader: usage === 'basemap' ? line_tile_map_vert : line_tile_vert,
122
- fragmentShader: usage === 'basemap' ? line_tile_map_frag : line_tile_frag,
123
- triangulation: _triangulation.LineTriangulation,
124
- blend: this.getBlend(),
125
- depth: {
126
- enable: depth
127
- },
128
- stencil: (0, _l7Utils.getMask)(mask, maskInside),
129
- pick: usage !== 'basemap'
130
- });
131
-
132
- case 4:
133
- model = _context2.sent;
134
- return _context2.abrupt("return", [model]);
135
-
136
- case 6:
137
- case "end":
138
- return _context2.stop();
139
- }
140
- }
141
- }, _callee2, this);
142
- }));
143
-
144
- function buildModels() {
145
- return _buildModels.apply(this, arguments);
146
- }
147
-
148
- return buildModels;
149
- }()
150
- }, {
151
- key: "registerBuiltinAttributes",
152
- value: function registerBuiltinAttributes() {
153
- var _this$layer$getLayerC = this.layer.getLayerConfig(),
154
- usage = _this$layer$getLayerC.usage;
155
-
156
- if (usage !== 'basemap') {
157
- this.styleAttributeService.registerStyleAttribute({
158
- name: 'size',
159
- type: _l7Core.AttributeType.Attribute,
160
- descriptor: {
161
- name: 'a_Size',
162
- buffer: {
163
- // give the WebGL driver a hint that this buffer may change
164
- usage: _l7Core.gl.DYNAMIC_DRAW,
165
- data: [],
166
- type: _l7Core.gl.FLOAT
167
- },
168
- size: 2,
169
- update: function update(feature) {
170
- var _feature$size = feature.size,
171
- size = _feature$size === void 0 ? 1 : _feature$size;
172
- return Array.isArray(size) ? [size[0], size[1]] : [size, 0];
173
- }
174
- }
175
- });
176
- }
177
-
178
- this.styleAttributeService.registerStyleAttribute({
179
- name: 'normal',
180
- type: _l7Core.AttributeType.Attribute,
181
- descriptor: {
182
- name: 'a_Normal',
183
- buffer: {
184
- // give the WebGL driver a hint that this buffer may change
185
- usage: _l7Core.gl.STATIC_DRAW,
186
- data: [],
187
- type: _l7Core.gl.FLOAT
188
- },
189
- size: 3,
190
- update: function update(feature, featureIdx, vertex, attributeIdx, normal) {
191
- return normal;
192
- }
193
- }
194
- });
195
- this.styleAttributeService.registerStyleAttribute({
196
- name: 'miter',
197
- type: _l7Core.AttributeType.Attribute,
198
- descriptor: {
199
- name: 'a_Miter',
200
- buffer: {
201
- // give the WebGL driver a hint that this buffer may change
202
- usage: _l7Core.gl.STATIC_DRAW,
203
- data: [],
204
- type: _l7Core.gl.FLOAT
205
- },
206
- size: 1,
207
- update: function update(feature, featureIdx, vertex) {
208
- return [vertex[4]];
209
- }
210
- }
211
- });
212
- }
213
- }]);
214
- return LineModel;
215
- }(_BaseModel2.default);
216
-
217
- exports.default = LineModel;
@@ -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,233 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = void 0;
9
-
10
- var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
-
12
- var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
13
-
14
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
15
-
16
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
17
-
18
- var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
-
20
- var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
-
22
- var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
-
24
- var _l7Core = require("@antv/l7-core");
25
-
26
- var _l7Utils = require("@antv/l7-utils");
27
-
28
- var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
29
-
30
- var _triangulation = require("../../core/triangulation");
31
-
32
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
33
-
34
- 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; } }
35
-
36
- /* babel-plugin-inline-import '../shaders/tile/fill_tile_frag.glsl' */
37
- 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";
38
-
39
- /* babel-plugin-inline-import '../shaders/tile/fill_tile_vert.glsl' */
40
- 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";
41
-
42
- var FillModel = /*#__PURE__*/function (_BaseModel) {
43
- (0, _inherits2.default)(FillModel, _BaseModel);
44
-
45
- var _super = _createSuper(FillModel);
46
-
47
- function FillModel() {
48
- (0, _classCallCheck2.default)(this, FillModel);
49
- return _super.apply(this, arguments);
50
- }
51
-
52
- (0, _createClass2.default)(FillModel, [{
53
- key: "getUninforms",
54
- value: function getUninforms() {
55
- var _ref = this.layer.getLayerConfig(),
56
- _ref$opacity = _ref.opacity,
57
- opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
58
- _ref$strokeOpacity = _ref.strokeOpacity,
59
- strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
60
- _ref$strokeWidth = _ref.strokeWidth,
61
- strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
62
- _ref$stroke = _ref.stroke,
63
- stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
64
- blend = _ref.blend;
65
-
66
- return {
67
- // u_tileOrigin: tileOrigin || [0, 0],
68
- // u_coord: coord === 'lnglat' ? 1.0 : 0.0,
69
- u_additive: blend === 'additive' ? 1.0 : 0.0,
70
- u_opacity: Number(opacity),
71
- u_stroke_opacity: Number(strokeOpacity),
72
- u_stroke_width: Number(strokeWidth),
73
- u_stroke_color: this.getStrokeColor(stroke)
74
- };
75
- }
76
- }, {
77
- key: "getAttribute",
78
- value: function getAttribute() {
79
- return this.styleAttributeService.createAttributesAndIndices(this.layer.getEncodedData(), _triangulation.PointFillTriangulation);
80
- }
81
- }, {
82
- key: "initModels",
83
- value: function () {
84
- var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
85
- return _regenerator.default.wrap(function _callee$(_context) {
86
- while (1) {
87
- switch (_context.prev = _context.next) {
88
- case 0:
89
- _context.next = 2;
90
- return this.buildModels();
91
-
92
- case 2:
93
- return _context.abrupt("return", _context.sent);
94
-
95
- case 3:
96
- case "end":
97
- return _context.stop();
98
- }
99
- }
100
- }, _callee, this);
101
- }));
102
-
103
- function initModels() {
104
- return _initModels.apply(this, arguments);
105
- }
106
-
107
- return initModels;
108
- }()
109
- }, {
110
- key: "buildModels",
111
- value: function () {
112
- var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
113
- var _ref2, _ref2$workerEnabled, workerEnabled, usage, model;
114
-
115
- return _regenerator.default.wrap(function _callee2$(_context2) {
116
- while (1) {
117
- switch (_context2.prev = _context2.next) {
118
- case 0:
119
- _ref2 = this.layer.getLayerConfig(), _ref2$workerEnabled = _ref2.workerEnabled, workerEnabled = _ref2$workerEnabled === void 0 ? false : _ref2$workerEnabled, usage = _ref2.usage;
120
- this.layer.triangulation = _triangulation.PointFillTriangulation;
121
- _context2.next = 4;
122
- return this.layer.buildLayerModel({
123
- moduleName: 'pointTile_' + usage,
124
- vertexShader: point_tile_vert,
125
- fragmentShader: point_tile_frag,
126
- triangulation: _triangulation.PointFillTriangulation,
127
- depth: {
128
- enable: false
129
- },
130
- cull: {
131
- enable: true,
132
- face: (0, _l7Utils.getCullFace)(this.mapService.version)
133
- },
134
- blend: this.getBlend(),
135
- workerEnabled: workerEnabled,
136
- workerOptions: {
137
- modelType: 'pointTile'
138
- },
139
- pick: usage !== 'basemap'
140
- });
141
-
142
- case 4:
143
- model = _context2.sent;
144
- return _context2.abrupt("return", [model]);
145
-
146
- case 6:
147
- case "end":
148
- return _context2.stop();
149
- }
150
- }
151
- }, _callee2, this);
152
- }));
153
-
154
- function buildModels() {
155
- return _buildModels.apply(this, arguments);
156
- }
157
-
158
- return buildModels;
159
- }()
160
- }, {
161
- key: "clearModels",
162
- value: function clearModels() {}
163
- }, {
164
- key: "registerBuiltinAttributes",
165
- value: function registerBuiltinAttributes() {
166
- var _this = this;
167
-
168
- this.styleAttributeService.registerStyleAttribute({
169
- name: 'extrude',
170
- type: _l7Core.AttributeType.Attribute,
171
- descriptor: {
172
- name: 'a_Extrude',
173
- buffer: {
174
- // give the WebGL driver a hint that this buffer may change
175
- usage: _l7Core.gl.DYNAMIC_DRAW,
176
- data: [],
177
- type: _l7Core.gl.FLOAT
178
- },
179
- size: 3,
180
- update: function update(feature, featureIdx, vertex, attributeIdx) {
181
- var extrude = [1, 1, 0, -1, 1, 0, -1, -1, 0, 1, -1, 0];
182
- var extrudeIndex = attributeIdx % 4 * 3;
183
- return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
184
- }
185
- }
186
- });
187
- this.styleAttributeService.registerStyleAttribute({
188
- name: 'size',
189
- type: _l7Core.AttributeType.Attribute,
190
- descriptor: {
191
- name: 'a_Size',
192
- buffer: {
193
- usage: _l7Core.gl.DYNAMIC_DRAW,
194
- data: [],
195
- type: _l7Core.gl.FLOAT
196
- },
197
- size: 1,
198
- update: function update(feature) {
199
- var _feature$size = feature.size,
200
- size = _feature$size === void 0 ? 5 : _feature$size;
201
- return Array.isArray(size) ? [size[0]] : [size];
202
- }
203
- }
204
- });
205
- this.styleAttributeService.registerStyleAttribute({
206
- name: 'shape',
207
- type: _l7Core.AttributeType.Attribute,
208
- descriptor: {
209
- name: 'a_Shape',
210
- buffer: {
211
- // give the WebGL driver a hint that this buffer may change
212
- usage: _l7Core.gl.DYNAMIC_DRAW,
213
- data: [],
214
- type: _l7Core.gl.FLOAT
215
- },
216
- size: 1,
217
- update: function update(feature) {
218
- var _feature$shape = feature.shape,
219
- shape = _feature$shape === void 0 ? 2 : _feature$shape;
220
-
221
- var shape2d = _this.layer.getLayerConfig().shape2d;
222
-
223
- var shapeIndex = shape2d.indexOf(shape);
224
- return [shapeIndex];
225
- }
226
- }
227
- });
228
- }
229
- }]);
230
- return FillModel;
231
- }(_BaseModel2.default);
232
-
233
- exports.default = FillModel;