@antv/l7-layers 2.17.4 → 2.17.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -39
- package/es/core/triangulation.js +99 -136
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +92 -149
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -62
- package/lib/core/triangulation.js +98 -177
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +92 -166
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +78 -125
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/lib/utils/grid-index.js
CHANGED
|
@@ -1,24 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
11
|
-
|
|
12
9
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
|
|
14
10
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
15
|
-
|
|
16
11
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }
|
|
17
|
-
|
|
18
12
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
19
|
-
|
|
20
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
21
|
-
|
|
13
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
22
14
|
/**
|
|
23
15
|
* 网格索引,相比 @mapbox/grid-index,在简单计算碰撞检测结果时效率更高
|
|
24
16
|
* @see https://zhuanlan.zhihu.com/p/74373214
|
|
@@ -30,11 +22,9 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
30
22
|
var boxCells = this.boxCells;
|
|
31
23
|
this.xCellCount = Math.ceil(width / cellSize);
|
|
32
24
|
this.yCellCount = Math.ceil(height / cellSize);
|
|
33
|
-
|
|
34
25
|
for (var i = 0; i < this.xCellCount * this.yCellCount; i++) {
|
|
35
26
|
boxCells.push([]);
|
|
36
27
|
}
|
|
37
|
-
|
|
38
28
|
this.boxKeys = [];
|
|
39
29
|
this.bboxes = [];
|
|
40
30
|
this.width = width;
|
|
@@ -43,7 +33,6 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
43
33
|
this.yScale = this.yCellCount / height;
|
|
44
34
|
this.boxUid = 0;
|
|
45
35
|
}
|
|
46
|
-
|
|
47
36
|
(0, _createClass2.default)(GridIndex, [{
|
|
48
37
|
key: "insert",
|
|
49
38
|
value: function insert(key, x1, y1, x2, y2) {
|
|
@@ -75,15 +64,12 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
75
64
|
if (x2 < 0 || x1 > this.width || y2 < 0 || y1 > this.height) {
|
|
76
65
|
return hitTest ? false : [];
|
|
77
66
|
}
|
|
78
|
-
|
|
79
67
|
var result = [];
|
|
80
|
-
|
|
81
68
|
if (x1 <= 0 && y1 <= 0 && this.width <= x2 && this.height <= y2) {
|
|
82
69
|
// 这一步是高效的关键,后续精确碰撞检测结果在计算文本可见性时并不需要
|
|
83
70
|
if (hitTest) {
|
|
84
71
|
return true;
|
|
85
72
|
}
|
|
86
|
-
|
|
87
73
|
for (var boxUid = 0; boxUid < this.boxKeys.length; boxUid++) {
|
|
88
74
|
result.push({
|
|
89
75
|
key: this.boxKeys[boxUid],
|
|
@@ -93,10 +79,8 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
93
79
|
y2: this.bboxes[boxUid * 4 + 3]
|
|
94
80
|
});
|
|
95
81
|
}
|
|
96
|
-
|
|
97
82
|
return predicate ? result.filter(predicate) : result;
|
|
98
83
|
}
|
|
99
|
-
|
|
100
84
|
var queryArgs = {
|
|
101
85
|
hitTest: hitTest,
|
|
102
86
|
seenUids: {
|
|
@@ -112,27 +96,21 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
112
96
|
value: function queryCell(x1, y1, x2, y2, cellIndex, result, queryArgs, predicate) {
|
|
113
97
|
var seenUids = queryArgs.seenUids;
|
|
114
98
|
var boxCell = this.boxCells[cellIndex];
|
|
115
|
-
|
|
116
99
|
if (boxCell !== null) {
|
|
117
100
|
var bboxes = this.bboxes;
|
|
118
|
-
|
|
119
101
|
var _iterator = _createForOfIteratorHelper(boxCell),
|
|
120
|
-
|
|
121
|
-
|
|
102
|
+
_step;
|
|
122
103
|
try {
|
|
123
104
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
124
105
|
var boxUid = _step.value;
|
|
125
|
-
|
|
126
106
|
if (!seenUids.box[boxUid]) {
|
|
127
107
|
seenUids.box[boxUid] = true;
|
|
128
108
|
var offset = boxUid * 4;
|
|
129
|
-
|
|
130
109
|
if (x1 <= bboxes[offset + 2] && y1 <= bboxes[offset + 3] && x2 >= bboxes[offset + 0] && y2 >= bboxes[offset + 1] && (!predicate || predicate(this.boxKeys[boxUid]))) {
|
|
131
110
|
if (queryArgs.hitTest) {
|
|
132
111
|
result.push(true);
|
|
133
112
|
return true;
|
|
134
113
|
}
|
|
135
|
-
|
|
136
114
|
result.push({
|
|
137
115
|
key: this.boxKeys[boxUid],
|
|
138
116
|
x1: bboxes[offset],
|
|
@@ -149,7 +127,6 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
149
127
|
_iterator.f();
|
|
150
128
|
}
|
|
151
129
|
}
|
|
152
|
-
|
|
153
130
|
return false;
|
|
154
131
|
}
|
|
155
132
|
}, {
|
|
@@ -159,11 +136,9 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
159
136
|
var cy1 = this.convertToYCellCoord(y1);
|
|
160
137
|
var cx2 = this.convertToXCellCoord(x2);
|
|
161
138
|
var cy2 = this.convertToYCellCoord(y2);
|
|
162
|
-
|
|
163
139
|
for (var x = cx1; x <= cx2; x++) {
|
|
164
140
|
for (var y = cy1; y <= cy2; y++) {
|
|
165
141
|
var cellIndex = this.xCellCount * y + x;
|
|
166
|
-
|
|
167
142
|
if (fn.call(this, x1, y1, x2, y2, cellIndex, arg1, arg2, predicate)) {
|
|
168
143
|
return;
|
|
169
144
|
}
|
|
@@ -183,6 +158,5 @@ var GridIndex = /*#__PURE__*/function () {
|
|
|
183
158
|
}]);
|
|
184
159
|
return GridIndex;
|
|
185
160
|
}();
|
|
186
|
-
|
|
187
161
|
var _default = GridIndex;
|
|
188
162
|
exports.default = _default;
|
|
@@ -4,38 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = identity;
|
|
7
|
-
|
|
8
7
|
function identity(d) {
|
|
9
8
|
var unknown;
|
|
10
9
|
var domain = [];
|
|
11
|
-
|
|
12
10
|
function scale(x) {
|
|
13
11
|
return x == null ? unknown : x;
|
|
14
12
|
}
|
|
15
|
-
|
|
16
13
|
scale.invert = scale;
|
|
17
|
-
|
|
18
14
|
scale.domain = scale.range = function (v) {
|
|
19
15
|
if (v) {
|
|
20
16
|
domain = v;
|
|
21
17
|
return v;
|
|
22
18
|
}
|
|
23
|
-
|
|
24
19
|
return domain;
|
|
25
20
|
};
|
|
26
|
-
|
|
27
21
|
scale.unknown = function (v) {
|
|
28
22
|
if (v) {
|
|
29
23
|
unknown = v;
|
|
30
24
|
return v;
|
|
31
25
|
}
|
|
32
|
-
|
|
33
26
|
return unknown;
|
|
34
27
|
};
|
|
35
|
-
|
|
36
28
|
scale.copy = function () {
|
|
37
29
|
return identity(d).unknown(unknown);
|
|
38
30
|
};
|
|
39
|
-
|
|
40
31
|
return scale;
|
|
41
32
|
}
|
package/lib/utils/layerData.js
CHANGED
|
@@ -1,66 +1,57 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.calculateData = calculateData;
|
|
9
|
-
|
|
10
8
|
var _l7Maps = require("@antv/l7-maps");
|
|
11
|
-
|
|
12
9
|
var _l7Source = _interopRequireDefault(require("@antv/l7-source"));
|
|
13
|
-
|
|
14
10
|
var _l7Utils = require("@antv/l7-utils");
|
|
15
|
-
|
|
16
11
|
var _lodash = require("lodash");
|
|
17
|
-
|
|
18
12
|
function getArrowPoints(p1, p2) {
|
|
19
13
|
var dir = [p2[0] - p1[0], p2[1] - p1[1]];
|
|
20
14
|
var normalizeDir = (0, _l7Utils.normalize)(dir);
|
|
21
15
|
var arrowPoint = [p1[0] + normalizeDir[0] * 0.0001, p1[1] + normalizeDir[1] * 0.0001];
|
|
22
16
|
return arrowPoint;
|
|
23
17
|
}
|
|
24
|
-
|
|
25
18
|
function adjustData2Amap2Coordinates(mappedData, mapService, layer) {
|
|
26
19
|
// 根据地图的类型判断是否需要对点位数据进行处理, 若是高德2.0则需要对坐标进行相对偏移
|
|
27
20
|
if (mappedData.length > 0 && mapService.version === _l7Maps.Version['GAODE2.x']) {
|
|
28
21
|
var layerCenter = layer.coordCenter;
|
|
29
|
-
|
|
30
22
|
if (typeof mappedData[0].coordinates[0] === 'number') {
|
|
31
23
|
// 单个的点数据
|
|
32
24
|
// @ts-ignore
|
|
33
|
-
mappedData
|
|
25
|
+
mappedData
|
|
26
|
+
// 避免经纬度被重复计算导致坐标位置偏移
|
|
34
27
|
.filter(function (d) {
|
|
35
28
|
return !d.originCoordinates;
|
|
36
29
|
}).map(function (d) {
|
|
37
|
-
d.version = _l7Maps.Version['GAODE2.x'];
|
|
38
|
-
|
|
30
|
+
d.version = _l7Maps.Version['GAODE2.x'];
|
|
31
|
+
// @ts-ignore
|
|
39
32
|
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
40
33
|
// @ts-ignore
|
|
41
34
|
// d.coordinates = mapService.lngLatToCoord(d.coordinates);
|
|
42
|
-
|
|
43
35
|
d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
44
36
|
});
|
|
45
37
|
} else {
|
|
46
38
|
// 连续的线、面数据
|
|
47
39
|
// @ts-ignore
|
|
48
|
-
mappedData
|
|
40
|
+
mappedData
|
|
41
|
+
// 避免经纬度被重复计算导致坐标位置偏移
|
|
49
42
|
.filter(function (d) {
|
|
50
43
|
return !d.originCoordinates;
|
|
51
44
|
}).map(function (d) {
|
|
52
|
-
d.version = _l7Maps.Version['GAODE2.x'];
|
|
53
|
-
|
|
45
|
+
d.version = _l7Maps.Version['GAODE2.x'];
|
|
46
|
+
// @ts-ignore
|
|
54
47
|
d.originCoordinates = (0, _lodash.cloneDeep)(d.coordinates); // 为了兼容高德1.x 需要保存一份原始的经纬度坐标数据(许多上层逻辑依赖经纬度数据)
|
|
55
48
|
// @ts-ignore
|
|
56
49
|
// d.coordinates = mapService.lngLatToCoords(d.coordinates);
|
|
57
|
-
|
|
58
50
|
d.coordinates = mapService.coordToAMap2RelativeCoordinates(d.coordinates, layerCenter);
|
|
59
51
|
});
|
|
60
52
|
}
|
|
61
53
|
}
|
|
62
54
|
}
|
|
63
|
-
|
|
64
55
|
function adjustData2SimpleCoordinates(mappedData, mapService) {
|
|
65
56
|
if (mappedData.length > 0 && mapService.version === _l7Maps.Version.SIMPLE) {
|
|
66
57
|
mappedData.map(function (d) {
|
|
@@ -71,12 +62,10 @@ function adjustData2SimpleCoordinates(mappedData, mapService) {
|
|
|
71
62
|
});
|
|
72
63
|
}
|
|
73
64
|
}
|
|
74
|
-
|
|
75
65
|
function unProjectCoordinates(coordinates, mapService) {
|
|
76
66
|
if (typeof coordinates[0] === 'number') {
|
|
77
67
|
return mapService.simpleMapCoord.unproject(coordinates);
|
|
78
68
|
}
|
|
79
|
-
|
|
80
69
|
if (coordinates[0] && coordinates[0][0] instanceof Array) {
|
|
81
70
|
// @ts-ignore
|
|
82
71
|
var coords = [];
|
|
@@ -85,38 +74,33 @@ function unProjectCoordinates(coordinates, mapService) {
|
|
|
85
74
|
var c1 = [];
|
|
86
75
|
coord.map(function (co) {
|
|
87
76
|
c1.push(mapService.simpleMapCoord.unproject(co));
|
|
88
|
-
});
|
|
89
|
-
|
|
77
|
+
});
|
|
78
|
+
// @ts-ignore
|
|
90
79
|
coords.push(c1);
|
|
91
|
-
});
|
|
92
|
-
|
|
80
|
+
});
|
|
81
|
+
// @ts-ignore
|
|
93
82
|
return coords;
|
|
94
83
|
} else {
|
|
95
84
|
// @ts-ignore
|
|
96
|
-
var _coords = [];
|
|
97
|
-
|
|
85
|
+
var _coords = [];
|
|
86
|
+
// @ts-ignore
|
|
98
87
|
coordinates.map(function (coord) {
|
|
99
88
|
_coords.push(mapService.simpleMapCoord.unproject(coord));
|
|
100
|
-
});
|
|
101
|
-
|
|
89
|
+
});
|
|
90
|
+
// @ts-ignore
|
|
102
91
|
return _coords;
|
|
103
92
|
}
|
|
104
93
|
}
|
|
105
|
-
|
|
106
94
|
function applyAttributeMapping(attribute, record) {
|
|
107
95
|
var _attribute$scale;
|
|
108
|
-
|
|
109
96
|
if (!attribute.scale) {
|
|
110
97
|
return [];
|
|
111
98
|
}
|
|
112
|
-
|
|
113
99
|
var scalers = (attribute === null || attribute === void 0 ? void 0 : (_attribute$scale = attribute.scale) === null || _attribute$scale === void 0 ? void 0 : _attribute$scale.scalers) || [];
|
|
114
100
|
var params = [];
|
|
115
101
|
scalers.forEach(function (_ref) {
|
|
116
102
|
var _attribute$scale2;
|
|
117
|
-
|
|
118
103
|
var field = _ref.field;
|
|
119
|
-
|
|
120
104
|
if (record.hasOwnProperty(field) || ((_attribute$scale2 = attribute.scale) === null || _attribute$scale2 === void 0 ? void 0 : _attribute$scale2.type) === 'variable') {
|
|
121
105
|
// TODO:多字段,常量
|
|
122
106
|
params.push(record[field]);
|
|
@@ -125,14 +109,12 @@ function applyAttributeMapping(attribute, record) {
|
|
|
125
109
|
var mappingResult = attribute.mapping ? attribute.mapping(params) : [];
|
|
126
110
|
return mappingResult;
|
|
127
111
|
}
|
|
128
|
-
|
|
129
112
|
function mapping(attributes, data, fontService, mapService, layer) {
|
|
130
113
|
var _ref2 = layer === null || layer === void 0 ? void 0 : layer.getLayerConfig(),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
114
|
+
_ref2$arrow = _ref2.arrow,
|
|
115
|
+
arrow = _ref2$arrow === void 0 ? {
|
|
116
|
+
enable: false
|
|
117
|
+
} : _ref2$arrow;
|
|
136
118
|
var mappedData = data.map(function (record) {
|
|
137
119
|
var encodeRecord = {
|
|
138
120
|
id: record._id,
|
|
@@ -142,38 +124,37 @@ function mapping(attributes, data, fontService, mapService, layer) {
|
|
|
142
124
|
return attribute.scale !== undefined;
|
|
143
125
|
}).forEach(function (attribute) {
|
|
144
126
|
var values = applyAttributeMapping(attribute, record);
|
|
145
|
-
attribute.needRemapping = false;
|
|
127
|
+
attribute.needRemapping = false;
|
|
146
128
|
|
|
129
|
+
// TODO: 支持每个属性配置 postprocess
|
|
147
130
|
if (attribute.name === 'color') {
|
|
148
131
|
values = values.map(function (c) {
|
|
149
132
|
return (0, _l7Utils.rgb2arr)(c);
|
|
150
133
|
});
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
encodeRecord[attribute.name] = Array.isArray(values) && values.length === 1 ? values[0] : values; // 增加对 layer/text/iconfont unicode 映射的解析
|
|
134
|
+
}
|
|
135
|
+
// @ts-ignore
|
|
136
|
+
encodeRecord[attribute.name] = Array.isArray(values) && values.length === 1 ? values[0] : values;
|
|
155
137
|
|
|
138
|
+
// 增加对 layer/text/iconfont unicode 映射的解析
|
|
156
139
|
if (attribute.name === 'shape') {
|
|
157
140
|
encodeRecord.shape = fontService.getIconFontKey(encodeRecord[attribute.name]);
|
|
158
141
|
}
|
|
159
142
|
});
|
|
160
|
-
|
|
161
143
|
if (encodeRecord.shape === 'line' && arrow.enable) {
|
|
162
144
|
// 只有在线图层且支持配置箭头的时候进行插入顶点的处理
|
|
163
145
|
var coords = encodeRecord.coordinates;
|
|
164
146
|
var arrowPoint = getArrowPoints(coords[0], coords[1]);
|
|
165
147
|
encodeRecord.coordinates.splice(1, 0, arrowPoint, arrowPoint);
|
|
166
148
|
}
|
|
167
|
-
|
|
168
149
|
return encodeRecord;
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
adjustData2Amap2Coordinates(mappedData, mapService, layer);
|
|
150
|
+
});
|
|
151
|
+
// 调整数据兼容 Amap2.0
|
|
152
|
+
adjustData2Amap2Coordinates(mappedData, mapService, layer);
|
|
172
153
|
|
|
154
|
+
// 调整数据兼容 SimpleCoordinates
|
|
173
155
|
adjustData2SimpleCoordinates(mappedData, mapService);
|
|
174
156
|
return mappedData;
|
|
175
157
|
}
|
|
176
|
-
|
|
177
158
|
function calculateData(layer, fontService, mapService, styleAttributeService, data, options) {
|
|
178
159
|
var source = new _l7Source.default(data, options);
|
|
179
160
|
var attributes = styleAttributeService.getLayerStyleAttributes() || [];
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.createMultiPassRenderer = createMultiPassRenderer;
|
|
9
8
|
exports.normalizePasses = normalizePasses;
|
|
10
|
-
|
|
11
9
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
|
-
|
|
13
10
|
/**
|
|
14
11
|
* 'blurH' -> ['blurH', {}]
|
|
15
12
|
*/
|
|
@@ -18,43 +15,41 @@ function normalizePasses(passes) {
|
|
|
18
15
|
if (typeof pass === 'string') {
|
|
19
16
|
pass = [pass, {}];
|
|
20
17
|
}
|
|
21
|
-
|
|
22
18
|
return pass;
|
|
23
19
|
});
|
|
24
20
|
}
|
|
21
|
+
|
|
25
22
|
/**
|
|
26
23
|
* 默认添加 ClearPass、RenderPass
|
|
27
24
|
* 以及 PostProcessing 中的最后一个 CopyPass
|
|
28
25
|
*/
|
|
29
|
-
|
|
30
|
-
|
|
31
26
|
function createMultiPassRenderer(layer, passes, postProcessingPassFactory, normalPassFactory) {
|
|
32
27
|
var multiPassRenderer = layer.multiPassRenderer;
|
|
33
|
-
|
|
34
28
|
var _layer$getLayerConfig = layer.getLayerConfig(),
|
|
35
|
-
|
|
29
|
+
enableTAA = _layer$getLayerConfig.enableTAA;
|
|
30
|
+
|
|
31
|
+
// picking pass if enabled
|
|
36
32
|
// if (enablePicking) {
|
|
37
33
|
// multiPassRenderer.add(normalPassFactory('pixelPicking'));
|
|
38
34
|
// }
|
|
39
|
-
// use TAA pass if enabled instead of render pass
|
|
40
|
-
|
|
41
35
|
|
|
36
|
+
// use TAA pass if enabled instead of render pass
|
|
42
37
|
if (enableTAA) {
|
|
43
38
|
multiPassRenderer.add(normalPassFactory('taa'));
|
|
44
39
|
} else {
|
|
45
40
|
// render all layers in this pass
|
|
46
41
|
multiPassRenderer.add(normalPassFactory('render'));
|
|
47
|
-
}
|
|
48
|
-
|
|
42
|
+
}
|
|
49
43
|
|
|
44
|
+
// post processing
|
|
50
45
|
normalizePasses(passes).forEach(function (pass) {
|
|
51
46
|
var _pass = (0, _slicedToArray2.default)(pass, 2),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
47
|
+
passName = _pass[0],
|
|
48
|
+
initializationOptions = _pass[1];
|
|
55
49
|
multiPassRenderer.add(postProcessingPassFactory(passName), initializationOptions);
|
|
56
|
-
});
|
|
50
|
+
});
|
|
57
51
|
|
|
52
|
+
// 末尾为固定的 CopyPass
|
|
58
53
|
multiPassRenderer.add(postProcessingPassFactory('copy'));
|
|
59
54
|
return multiPassRenderer;
|
|
60
55
|
}
|