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