@antv/l7-layers 2.15.5 → 2.16.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +486 -321
- package/es/core/BaseModel.js +126 -97
- 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 +31 -10
- package/es/core/triangulation.js +114 -54
- 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 +146 -91
- 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 +34 -9
- package/es/line/models/arc.js +118 -66
- package/es/line/models/arc_3d.js +108 -60
- package/es/line/models/earthArc_3d.js +111 -63
- package/es/line/models/great_circle.js +100 -56
- package/es/line/models/half.js +77 -46
- package/es/line/models/line.js +148 -94
- package/es/line/models/linearline.js +80 -45
- package/es/line/models/simpleLine.js +74 -41
- 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 +117 -80
- 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 +104 -67
- 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 +77 -26
- package/es/point/models/earthExtrude.js +102 -61
- package/es/point/models/earthFill.js +87 -57
- package/es/point/models/extrude.js +101 -60
- package/es/point/models/fill.js +100 -70
- package/es/point/models/fillmage.js +107 -63
- package/es/point/models/image.js +88 -48
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +64 -40
- package/es/point/models/simplePoint.js +69 -41
- package/es/point/models/text.d.ts +2 -1
- package/es/point/models/text.js +305 -201
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +40 -11
- package/es/polygon/models/extrude.js +92 -48
- package/es/polygon/models/fill.js +88 -54
- 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/dataMappingStyle.js +18 -8
- 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 +480 -321
- package/lib/core/BaseModel.js +139 -97
- 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 +54 -10
- package/lib/core/triangulation.js +153 -53
- 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 +162 -91
- 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 +128 -64
- package/lib/line/models/arc_3d.js +119 -58
- package/lib/line/models/earthArc_3d.js +122 -61
- package/lib/line/models/great_circle.js +111 -56
- package/lib/line/models/half.js +87 -46
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +156 -92
- package/lib/line/models/linearline.js +92 -45
- package/lib/line/models/simpleLine.js +84 -41
- 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 +128 -80
- 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 +113 -68
- 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 +113 -61
- package/lib/point/models/earthFill.js +117 -57
- package/lib/point/models/extrude.js +111 -60
- package/lib/point/models/fill.js +109 -68
- package/lib/point/models/fillmage.js +115 -61
- package/lib/point/models/image.js +98 -48
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +74 -40
- package/lib/point/models/simplePoint.js +79 -41
- package/lib/point/models/text.js +314 -202
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +103 -48
- package/lib/polygon/models/fill.js +98 -54
- 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/dataMappingStyle.js +19 -8
- 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
|
@@ -1,31 +1,41 @@
|
|
|
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 _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
|
+
|
|
9
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
13
|
+
|
|
10
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
11
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
12
18
|
var _l7Core = require("@antv/l7-core");
|
|
19
|
+
|
|
13
20
|
var _l7Utils = require("@antv/l7-utils");
|
|
21
|
+
|
|
14
22
|
var BaseLayerPickService = /*#__PURE__*/function () {
|
|
15
23
|
function BaseLayerPickService(layer) {
|
|
16
24
|
(0, _classCallCheck2.default)(this, BaseLayerPickService);
|
|
17
25
|
this.layer = layer;
|
|
18
26
|
}
|
|
27
|
+
|
|
19
28
|
(0, _createClass2.default)(BaseLayerPickService, [{
|
|
20
29
|
key: "pickRender",
|
|
21
30
|
value: function pickRender(target) {
|
|
22
31
|
var container = this.layer.getContainer();
|
|
23
32
|
var layerService = container.get(_l7Core.TYPES.ILayerService);
|
|
24
|
-
var layer = this.layer;
|
|
25
|
-
|
|
33
|
+
var layer = this.layer; // 瓦片图层的拾取绘制
|
|
34
|
+
|
|
26
35
|
if (layer.tileLayer) {
|
|
27
36
|
return layer.tileLayer.pickRender(target);
|
|
28
37
|
}
|
|
38
|
+
|
|
29
39
|
layer.hooks.beforePickingEncode.call();
|
|
30
40
|
layerService.renderTileLayerMask(layer);
|
|
31
41
|
layer.renderModels({
|
|
@@ -38,9 +48,11 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
38
48
|
value: function pick(layer, target) {
|
|
39
49
|
var container = this.layer.getContainer();
|
|
40
50
|
var pickingService = container.get(_l7Core.TYPES.IPickingService);
|
|
51
|
+
|
|
41
52
|
if (layer.type === 'RasterLayer') {
|
|
42
53
|
return this.pickRasterLayer(layer, target);
|
|
43
54
|
}
|
|
55
|
+
|
|
44
56
|
this.pickRender(target);
|
|
45
57
|
return pickingService.pickFromPickingFBO(layer, target);
|
|
46
58
|
}
|
|
@@ -61,6 +73,7 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
61
73
|
rasterValue: null
|
|
62
74
|
};
|
|
63
75
|
var adviceTarget = parent ? parent : layer;
|
|
76
|
+
|
|
64
77
|
if (isPick) {
|
|
65
78
|
var rasterValue = this.readRasterValue(layer, extent, mapService, target.x, target.y);
|
|
66
79
|
layerTarget.rasterValue = rasterValue;
|
|
@@ -79,24 +92,24 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
79
92
|
key: "readRasterValue",
|
|
80
93
|
value: function readRasterValue(layer, bbox, mapService, x, y) {
|
|
81
94
|
var rasterData = layer.getSource().data.dataArray[0];
|
|
95
|
+
|
|
82
96
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
_bbox$ = _bbox[0],
|
|
98
|
+
minLng = _bbox$ === void 0 ? 0 : _bbox$,
|
|
99
|
+
_bbox$2 = _bbox[1],
|
|
100
|
+
minLat = _bbox$2 === void 0 ? 0 : _bbox$2,
|
|
101
|
+
_bbox$3 = _bbox[2],
|
|
102
|
+
maxLng = _bbox$3 === void 0 ? 10 : _bbox$3,
|
|
103
|
+
_bbox$4 = _bbox[3],
|
|
104
|
+
maxLat = _bbox$4 === void 0 ? -10 : _bbox$4;
|
|
105
|
+
|
|
91
106
|
var tileXY = mapService.lngLatToContainer([minLng, minLat]);
|
|
92
107
|
var tileMaxXY = mapService.lngLatToContainer([maxLng, maxLat]);
|
|
93
108
|
var tilePixelWidth = tileMaxXY.x - tileXY.x;
|
|
94
109
|
var tilePixelHeight = tileXY.y - tileMaxXY.y;
|
|
95
|
-
var pos = [(x - tileXY.x) / tilePixelWidth,
|
|
96
|
-
// x
|
|
110
|
+
var pos = [(x - tileXY.x) / tilePixelWidth, // x
|
|
97
111
|
(y - tileMaxXY.y) / tilePixelHeight // y
|
|
98
112
|
];
|
|
99
|
-
|
|
100
113
|
var tileWidth = rasterData.width || 1;
|
|
101
114
|
var tileHeight = rasterData.height || 1;
|
|
102
115
|
var indexX = Math.floor(pos[0] * tileWidth);
|
|
@@ -108,12 +121,13 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
108
121
|
}, {
|
|
109
122
|
key: "selectFeature",
|
|
110
123
|
value: function selectFeature(pickedColors) {
|
|
111
|
-
var layer = this.layer;
|
|
112
|
-
|
|
124
|
+
var layer = this.layer; // @ts-ignore
|
|
125
|
+
|
|
113
126
|
var _pickedColors = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
127
|
+
r = _pickedColors[0],
|
|
128
|
+
g = _pickedColors[1],
|
|
129
|
+
b = _pickedColors[2];
|
|
130
|
+
|
|
117
131
|
layer.hooks.beforeSelect.call([r, g, b]);
|
|
118
132
|
}
|
|
119
133
|
}, {
|
|
@@ -121,9 +135,10 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
121
135
|
value: function highlightPickedFeature(pickedColors) {
|
|
122
136
|
// @ts-ignore
|
|
123
137
|
var _pickedColors2 = (0, _slicedToArray2.default)(pickedColors, 3),
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
138
|
+
r = _pickedColors2[0],
|
|
139
|
+
g = _pickedColors2[1],
|
|
140
|
+
b = _pickedColors2[2];
|
|
141
|
+
|
|
127
142
|
this.layer.hooks.beforeHighlight.call([r, g, b]);
|
|
128
143
|
}
|
|
129
144
|
}, {
|
|
@@ -134,4 +149,5 @@ var BaseLayerPickService = /*#__PURE__*/function () {
|
|
|
134
149
|
}]);
|
|
135
150
|
return BaseLayerPickService;
|
|
136
151
|
}();
|
|
152
|
+
|
|
137
153
|
exports.default = BaseLayerPickService;
|
|
@@ -1,14 +1,20 @@
|
|
|
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 _l7Core = require("@antv/l7-core");
|
|
15
|
+
|
|
11
16
|
var _l7Utils = require("@antv/l7-utils");
|
|
17
|
+
|
|
12
18
|
var TextureService = /*#__PURE__*/function () {
|
|
13
19
|
function TextureService(layer) {
|
|
14
20
|
(0, _classCallCheck2.default)(this, TextureService);
|
|
@@ -16,16 +22,19 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
16
22
|
var container = this.layer.getContainer();
|
|
17
23
|
this.rendererService = container.get(_l7Core.TYPES.IRendererService);
|
|
18
24
|
}
|
|
25
|
+
|
|
19
26
|
(0, _createClass2.default)(TextureService, [{
|
|
20
27
|
key: "getColorTexture",
|
|
21
28
|
value: function getColorTexture(colorRamp, domain) {
|
|
22
29
|
// TODO 支持传入图片
|
|
23
30
|
var currentkey = this.getTextureKey(colorRamp, domain);
|
|
31
|
+
|
|
24
32
|
if (this.key === currentkey) {
|
|
25
33
|
return this.colorTexture;
|
|
26
34
|
} else {
|
|
27
35
|
this.createColorTexture(colorRamp, domain);
|
|
28
36
|
}
|
|
37
|
+
|
|
29
38
|
this.key = currentkey;
|
|
30
39
|
return this.colorTexture;
|
|
31
40
|
}
|
|
@@ -53,6 +62,7 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
53
62
|
key: "destroy",
|
|
54
63
|
value: function destroy() {
|
|
55
64
|
var _this$colorTexture;
|
|
65
|
+
|
|
56
66
|
(_this$colorTexture = this.colorTexture) === null || _this$colorTexture === void 0 ? void 0 : _this$colorTexture.destroy();
|
|
57
67
|
}
|
|
58
68
|
}, {
|
|
@@ -61,12 +71,16 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
61
71
|
switch (colorRamp.type) {
|
|
62
72
|
case 'cat':
|
|
63
73
|
return (0, _l7Utils.generateCatRamp)(colorRamp);
|
|
74
|
+
|
|
64
75
|
case 'quantize':
|
|
65
76
|
return (0, _l7Utils.generateQuantizeRamp)(colorRamp);
|
|
77
|
+
|
|
66
78
|
case 'custom':
|
|
67
79
|
return (0, _l7Utils.generateCustomRamp)(colorRamp, domain);
|
|
80
|
+
|
|
68
81
|
case 'linear':
|
|
69
82
|
return (0, _l7Utils.generateLinearRamp)(colorRamp, domain);
|
|
83
|
+
|
|
70
84
|
default:
|
|
71
85
|
return (0, _l7Utils.generateColorRamp)(colorRamp);
|
|
72
86
|
}
|
|
@@ -75,9 +89,11 @@ var TextureService = /*#__PURE__*/function () {
|
|
|
75
89
|
key: "getTextureKey",
|
|
76
90
|
value: function getTextureKey(colorRamp, domain) {
|
|
77
91
|
var _colorRamp$positions;
|
|
92
|
+
|
|
78
93
|
return "".concat(colorRamp.colors.join('_'), "_").concat(colorRamp === null || colorRamp === void 0 ? void 0 : (_colorRamp$positions = colorRamp.positions) === null || _colorRamp$positions === void 0 ? void 0 : _colorRamp$positions.join('_'), "_").concat(colorRamp.type, "_").concat(domain === null || domain === void 0 ? void 0 : domain.join('_'));
|
|
79
94
|
}
|
|
80
95
|
}]);
|
|
81
96
|
return TextureService;
|
|
82
97
|
}();
|
|
98
|
+
|
|
83
99
|
exports.default = TextureService;
|
package/lib/core/interface.js
CHANGED
|
@@ -4,36 +4,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.lineStyleType = exports.TextureBlend = exports.SizeUnitType = exports.LinearDir = exports.CanvasUpdateType = void 0;
|
|
7
|
-
var lineStyleType
|
|
7
|
+
var lineStyleType;
|
|
8
|
+
exports.lineStyleType = lineStyleType;
|
|
9
|
+
|
|
10
|
+
(function (lineStyleType) {
|
|
8
11
|
lineStyleType[lineStyleType["solid"] = 0] = "solid";
|
|
9
12
|
lineStyleType[lineStyleType["dash"] = 1] = "dash";
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
})(lineStyleType || (exports.lineStyleType = lineStyleType = {}));
|
|
14
|
+
|
|
15
|
+
var LinearDir;
|
|
16
|
+
exports.LinearDir = LinearDir;
|
|
17
|
+
|
|
18
|
+
(function (LinearDir) {
|
|
14
19
|
LinearDir["VERTICAL"] = "vertical";
|
|
15
20
|
LinearDir["HORIZONTAL"] = "horizontal";
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
var TextureBlend = /*#__PURE__*/function (TextureBlend) {
|
|
20
|
-
TextureBlend["NORMAL"] = "normal";
|
|
21
|
-
TextureBlend["REPLACE"] = "replace";
|
|
22
|
-
return TextureBlend;
|
|
23
|
-
}({});
|
|
21
|
+
})(LinearDir || (exports.LinearDir = LinearDir = {}));
|
|
22
|
+
|
|
23
|
+
var TextureBlend;
|
|
24
24
|
/**
|
|
25
25
|
* 基础图层类型定义
|
|
26
26
|
*/
|
|
27
|
+
|
|
27
28
|
exports.TextureBlend = TextureBlend;
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
(function (TextureBlend) {
|
|
31
|
+
TextureBlend["NORMAL"] = "normal";
|
|
32
|
+
TextureBlend["REPLACE"] = "replace";
|
|
33
|
+
})(TextureBlend || (exports.TextureBlend = TextureBlend = {}));
|
|
34
|
+
|
|
35
|
+
var SizeUnitType;
|
|
36
|
+
exports.SizeUnitType = SizeUnitType;
|
|
37
|
+
|
|
38
|
+
(function (SizeUnitType) {
|
|
29
39
|
SizeUnitType[SizeUnitType["pixel"] = 0] = "pixel";
|
|
30
40
|
SizeUnitType[SizeUnitType["meter"] = 1] = "meter";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
41
|
+
})(SizeUnitType || (exports.SizeUnitType = SizeUnitType = {}));
|
|
42
|
+
|
|
43
|
+
var CanvasUpdateType;
|
|
44
|
+
exports.CanvasUpdateType = CanvasUpdateType;
|
|
45
|
+
|
|
46
|
+
(function (CanvasUpdateType) {
|
|
35
47
|
CanvasUpdateType["ALWAYS"] = "always";
|
|
36
48
|
CanvasUpdateType["DRAGEND"] = "dragend";
|
|
37
|
-
|
|
38
|
-
}({});
|
|
39
|
-
exports.CanvasUpdateType = CanvasUpdateType;
|
|
49
|
+
})(CanvasUpdateType || (exports.CanvasUpdateType = CanvasUpdateType = {}));
|
package/lib/core/schema.js
CHANGED
package/lib/core/shape/Path.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
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
|
});
|
|
@@ -12,60 +13,76 @@ exports.pentagon = pentagon;
|
|
|
12
13
|
exports.polygonPath = polygonPath;
|
|
13
14
|
exports.square = square;
|
|
14
15
|
exports.triangle = triangle;
|
|
16
|
+
|
|
15
17
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
18
|
+
|
|
16
19
|
var _geometryShape;
|
|
17
|
-
|
|
20
|
+
|
|
21
|
+
var ShapeType3D;
|
|
22
|
+
exports.ShapeType3D = ShapeType3D;
|
|
23
|
+
|
|
24
|
+
(function (ShapeType3D) {
|
|
18
25
|
ShapeType3D["CYLINDER"] = "cylinder";
|
|
19
26
|
ShapeType3D["SQUARECOLUMN"] = "squareColumn";
|
|
20
27
|
ShapeType3D["TRIANGLECOLUMN"] = "triangleColumn";
|
|
21
28
|
ShapeType3D["HEXAGONCOLUMN"] = "hexagonColumn";
|
|
22
29
|
ShapeType3D["PENTAGONCOLUMN"] = "pentagonColumn";
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
|
|
27
|
-
ShapeType2D["CIRCLE"] = "circle";
|
|
28
|
-
ShapeType2D["SQUARE"] = "square";
|
|
29
|
-
ShapeType2D["TRIANGLE"] = "triangle";
|
|
30
|
-
ShapeType2D["HEXAGON"] = "hexagon";
|
|
31
|
-
ShapeType2D["PENTAGON"] = "pentagon";
|
|
32
|
-
return ShapeType2D;
|
|
33
|
-
}({});
|
|
30
|
+
})(ShapeType3D || (exports.ShapeType3D = ShapeType3D = {}));
|
|
31
|
+
|
|
32
|
+
var ShapeType2D;
|
|
34
33
|
/**
|
|
35
34
|
* 生成规则多边形顶点个数
|
|
36
35
|
* @param pointCount 顶点个数 3 => 三角形
|
|
37
36
|
* @param start 顶点起始角度 调整图形的方向
|
|
38
37
|
*/
|
|
38
|
+
|
|
39
39
|
exports.ShapeType2D = ShapeType2D;
|
|
40
|
+
|
|
41
|
+
(function (ShapeType2D) {
|
|
42
|
+
ShapeType2D["CIRCLE"] = "circle";
|
|
43
|
+
ShapeType2D["SQUARE"] = "square";
|
|
44
|
+
ShapeType2D["TRIANGLE"] = "triangle";
|
|
45
|
+
ShapeType2D["HEXAGON"] = "hexagon";
|
|
46
|
+
ShapeType2D["PENTAGON"] = "pentagon";
|
|
47
|
+
})(ShapeType2D || (exports.ShapeType2D = ShapeType2D = {}));
|
|
48
|
+
|
|
40
49
|
function polygonPath(pointCount) {
|
|
41
50
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
42
51
|
var step = Math.PI * 2 / pointCount;
|
|
43
52
|
var line = [];
|
|
53
|
+
|
|
44
54
|
for (var i = 0; i < pointCount; i++) {
|
|
45
55
|
line.push(step * i + start * Math.PI / 12);
|
|
46
56
|
}
|
|
57
|
+
|
|
47
58
|
var path = line.map(function (t) {
|
|
48
59
|
var x = Math.sin(t + Math.PI / 4);
|
|
49
60
|
var y = Math.cos(t + Math.PI / 4);
|
|
50
61
|
return [x, y, 0];
|
|
51
|
-
});
|
|
52
|
-
|
|
62
|
+
}); // path.push(path[0]);
|
|
63
|
+
|
|
53
64
|
return path;
|
|
54
65
|
}
|
|
66
|
+
|
|
55
67
|
function circle() {
|
|
56
68
|
return polygonPath(30);
|
|
57
69
|
}
|
|
70
|
+
|
|
58
71
|
function square() {
|
|
59
72
|
return polygonPath(4);
|
|
60
73
|
}
|
|
74
|
+
|
|
61
75
|
function triangle() {
|
|
62
76
|
return polygonPath(3);
|
|
63
77
|
}
|
|
78
|
+
|
|
64
79
|
function hexagon() {
|
|
65
80
|
return polygonPath(6, 1);
|
|
66
81
|
}
|
|
82
|
+
|
|
67
83
|
function pentagon() {
|
|
68
84
|
return polygonPath(5);
|
|
69
85
|
}
|
|
86
|
+
|
|
70
87
|
var geometryShape = (_geometryShape = {}, (0, _defineProperty2.default)(_geometryShape, ShapeType2D.CIRCLE, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.HEXAGON, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.TRIANGLE, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.SQUARE, square), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.PENTAGON, pentagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.CYLINDER, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.HEXAGONCOLUMN, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.TRIANGLECOLUMN, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.SQUARECOLUMN, square), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.PENTAGONCOLUMN, pentagon), _geometryShape);
|
|
71
88
|
exports.geometryShape = geometryShape;
|
|
@@ -1,16 +1,22 @@
|
|
|
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 = extrudePolygon;
|
|
8
9
|
exports.extrude_PolygonNormal = extrude_PolygonNormal;
|
|
9
10
|
exports.fillPolygon = fillPolygon;
|
|
11
|
+
|
|
10
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
11
14
|
var _l7Utils = require("@antv/l7-utils");
|
|
15
|
+
|
|
12
16
|
var _earcut = _interopRequireDefault(require("earcut"));
|
|
17
|
+
|
|
13
18
|
var _glMatrix = require("gl-matrix");
|
|
19
|
+
|
|
14
20
|
/**
|
|
15
21
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
16
22
|
* @param paths 路径数据组
|
|
@@ -19,16 +25,20 @@ var _glMatrix = require("gl-matrix");
|
|
|
19
25
|
function extrudePolygon(path) {
|
|
20
26
|
var p1 = path[0][0];
|
|
21
27
|
var p2 = path[0][path[0].length - 1];
|
|
28
|
+
|
|
22
29
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
23
30
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
24
31
|
}
|
|
32
|
+
|
|
25
33
|
var n = path[0].length;
|
|
34
|
+
|
|
26
35
|
var flattengeo = _earcut.default.flatten(path);
|
|
36
|
+
|
|
27
37
|
var vertices = flattengeo.vertices,
|
|
28
|
-
|
|
38
|
+
dimensions = flattengeo.dimensions;
|
|
29
39
|
var positions = [];
|
|
30
|
-
var indexArray = [];
|
|
31
|
-
|
|
40
|
+
var indexArray = []; // 设置顶部z值
|
|
41
|
+
|
|
32
42
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
33
43
|
if (dimensions === 2) {
|
|
34
44
|
positions.push(vertices[j * 2], vertices[j * 2 + 1], 1);
|
|
@@ -36,67 +46,85 @@ function extrudePolygon(path) {
|
|
|
36
46
|
positions.push(vertices[j * 3], vertices[j * 3 + 1], 1);
|
|
37
47
|
}
|
|
38
48
|
}
|
|
49
|
+
|
|
39
50
|
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
40
51
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)(triangles));
|
|
41
|
-
|
|
52
|
+
|
|
53
|
+
var _loop = function _loop(i) {
|
|
42
54
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
43
55
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
56
|
+
|
|
44
57
|
if (nextPoint.length === 0) {
|
|
45
58
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
46
59
|
}
|
|
60
|
+
|
|
47
61
|
var indexOffset = positions.length / 3;
|
|
48
62
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
49
63
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([0, 2, 1, 2, 3, 1].map(function (v) {
|
|
50
64
|
return v + indexOffset;
|
|
51
65
|
})));
|
|
52
66
|
};
|
|
67
|
+
|
|
53
68
|
for (var i = 0; i < n; i++) {
|
|
54
|
-
_loop();
|
|
69
|
+
_loop(i);
|
|
55
70
|
}
|
|
71
|
+
|
|
56
72
|
return {
|
|
57
73
|
positions: positions,
|
|
58
74
|
index: indexArray
|
|
59
75
|
};
|
|
60
76
|
}
|
|
77
|
+
|
|
61
78
|
function fillPolygon(points) {
|
|
62
79
|
var flattengeo = _earcut.default.flatten(points);
|
|
80
|
+
|
|
63
81
|
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
64
82
|
return {
|
|
65
83
|
positions: flattengeo.vertices,
|
|
66
84
|
index: triangles
|
|
67
85
|
};
|
|
68
86
|
}
|
|
87
|
+
|
|
69
88
|
function extrude_PolygonNormal(path) {
|
|
70
89
|
var needFlat = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
71
90
|
var p1 = path[0][0];
|
|
72
91
|
var p2 = path[0][path[0].length - 1];
|
|
92
|
+
|
|
73
93
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
74
94
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
75
95
|
}
|
|
96
|
+
|
|
76
97
|
var n = path[0].length;
|
|
98
|
+
|
|
77
99
|
var flattengeo = _earcut.default.flatten(path);
|
|
100
|
+
|
|
78
101
|
var vertices = flattengeo.vertices,
|
|
79
|
-
|
|
102
|
+
dimensions = flattengeo.dimensions;
|
|
80
103
|
var positions = [];
|
|
81
104
|
var indexArray = [];
|
|
82
|
-
var normals = [];
|
|
83
|
-
|
|
105
|
+
var normals = []; // 设置顶部z值 position uv
|
|
106
|
+
|
|
84
107
|
for (var j = 0; j < vertices.length / dimensions; j++) {
|
|
85
108
|
if (dimensions === 2) {
|
|
86
109
|
positions.push(vertices[j * 2], vertices[j * 2 + 1], 1, -1, -1);
|
|
87
110
|
} else {
|
|
88
111
|
positions.push(vertices[j * 3], vertices[j * 3 + 1], 1, -1, -1);
|
|
89
112
|
}
|
|
113
|
+
|
|
90
114
|
normals.push(0, 0, 1);
|
|
91
115
|
}
|
|
116
|
+
|
|
92
117
|
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
93
118
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)(triangles));
|
|
94
|
-
|
|
119
|
+
|
|
120
|
+
var _loop2 = function _loop2(i) {
|
|
95
121
|
var prePoint = flattengeo.vertices.slice(i * dimensions, (i + 1) * dimensions);
|
|
96
122
|
var nextPoint = flattengeo.vertices.slice((i + 1) * dimensions, (i + 2) * dimensions);
|
|
123
|
+
|
|
97
124
|
if (nextPoint.length === 0) {
|
|
98
125
|
nextPoint = flattengeo.vertices.slice(0, dimensions);
|
|
99
126
|
}
|
|
127
|
+
|
|
100
128
|
var indexOffset = positions.length / 5;
|
|
101
129
|
positions.push(prePoint[0], prePoint[1], 1, 0, 0, nextPoint[0], nextPoint[1], 1, 0.1, 0, prePoint[0], prePoint[1], 0, 0, 0.8, nextPoint[0], nextPoint[1], 0, 0.1, 0.8);
|
|
102
130
|
var normal = computeVertexNormals([nextPoint[0], nextPoint[1], 1], [prePoint[0], prePoint[1], 0], [prePoint[0], prePoint[1], 1], needFlat);
|
|
@@ -105,32 +133,48 @@ function extrude_PolygonNormal(path) {
|
|
|
105
133
|
return v + indexOffset;
|
|
106
134
|
})));
|
|
107
135
|
};
|
|
136
|
+
|
|
108
137
|
for (var i = 0; i < n; i++) {
|
|
109
|
-
_loop2();
|
|
138
|
+
_loop2(i);
|
|
110
139
|
}
|
|
140
|
+
|
|
111
141
|
return {
|
|
112
142
|
positions: positions,
|
|
113
143
|
index: indexArray,
|
|
114
144
|
normals: normals
|
|
115
145
|
};
|
|
116
146
|
}
|
|
147
|
+
|
|
117
148
|
function computeVertexNormals(p1, p2, p3) {
|
|
118
149
|
var needFlat = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
150
|
+
|
|
119
151
|
var cb = _glMatrix.vec3.create();
|
|
152
|
+
|
|
120
153
|
var ab = _glMatrix.vec3.create();
|
|
154
|
+
|
|
121
155
|
var normal = _glMatrix.vec3.create();
|
|
156
|
+
|
|
122
157
|
if (needFlat) {
|
|
123
158
|
p1 = (0, _l7Utils.lngLatToMeters)(p1);
|
|
124
159
|
p2 = (0, _l7Utils.lngLatToMeters)(p2);
|
|
125
160
|
p3 = (0, _l7Utils.lngLatToMeters)(p3);
|
|
126
161
|
}
|
|
162
|
+
|
|
127
163
|
var pA = _glMatrix.vec3.fromValues.apply(_glMatrix.vec3, (0, _toConsumableArray2.default)(p1));
|
|
164
|
+
|
|
128
165
|
var pB = _glMatrix.vec3.fromValues.apply(_glMatrix.vec3, (0, _toConsumableArray2.default)(p2));
|
|
166
|
+
|
|
129
167
|
var pC = _glMatrix.vec3.fromValues.apply(_glMatrix.vec3, (0, _toConsumableArray2.default)(p3));
|
|
168
|
+
|
|
130
169
|
_glMatrix.vec3.sub(cb, pC, pB);
|
|
170
|
+
|
|
131
171
|
_glMatrix.vec3.sub(ab, pA, pB);
|
|
172
|
+
|
|
132
173
|
_glMatrix.vec3.cross(normal, cb, ab);
|
|
174
|
+
|
|
133
175
|
var newNormal = _glMatrix.vec3.create();
|
|
176
|
+
|
|
134
177
|
_glMatrix.vec3.normalize(newNormal, normal);
|
|
178
|
+
|
|
135
179
|
return newNormal;
|
|
136
180
|
}
|