@antv/l7-layers 2.16.0 → 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 +485 -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.js +301 -198
- 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 +479 -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 +309 -198
- 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,13 +1,17 @@
|
|
|
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.fillPolygon = fillPolygon;
|
|
10
|
+
|
|
9
11
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
|
|
10
13
|
var _earcut = _interopRequireDefault(require("earcut"));
|
|
14
|
+
|
|
11
15
|
/**
|
|
12
16
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
13
17
|
* @param paths 路径数据组
|
|
@@ -16,44 +20,56 @@ var _earcut = _interopRequireDefault(require("earcut"));
|
|
|
16
20
|
function extrudePolygon(path) {
|
|
17
21
|
var p1 = path[0][0];
|
|
18
22
|
var p2 = path[0][path[0].length - 1];
|
|
23
|
+
|
|
19
24
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
20
25
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
21
26
|
}
|
|
27
|
+
|
|
22
28
|
var n = path[0].length;
|
|
29
|
+
|
|
23
30
|
var flattengeo = _earcut.default.flatten(path);
|
|
31
|
+
|
|
24
32
|
var positions = [];
|
|
25
33
|
var indexArray = [];
|
|
26
|
-
var normals = [];
|
|
27
|
-
|
|
34
|
+
var normals = []; // 设置顶部z值
|
|
35
|
+
|
|
28
36
|
for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
|
|
29
37
|
flattengeo.vertices[j * 3 + 2] = 1;
|
|
30
38
|
normals.push(0, 0, 1);
|
|
31
39
|
}
|
|
40
|
+
|
|
32
41
|
positions.push.apply(positions, (0, _toConsumableArray2.default)(flattengeo.vertices));
|
|
33
42
|
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
34
43
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)(triangles));
|
|
35
|
-
|
|
44
|
+
|
|
45
|
+
var _loop = function _loop(i) {
|
|
36
46
|
var prePoint = flattengeo.vertices.slice(i * 3, i * 3 + 3);
|
|
37
47
|
var nextPoint = flattengeo.vertices.slice(i * 3 + 3, i * 3 + 6);
|
|
48
|
+
|
|
38
49
|
if (nextPoint.length === 0) {
|
|
39
50
|
nextPoint = flattengeo.vertices.slice(0, 3);
|
|
40
51
|
}
|
|
52
|
+
|
|
41
53
|
var indexOffset = positions.length / 3;
|
|
42
54
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
43
55
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([1, 2, 0, 3, 2, 1].map(function (v) {
|
|
44
56
|
return v + indexOffset;
|
|
45
57
|
})));
|
|
46
58
|
};
|
|
59
|
+
|
|
47
60
|
for (var i = 0; i < n; i++) {
|
|
48
|
-
_loop();
|
|
61
|
+
_loop(i);
|
|
49
62
|
}
|
|
63
|
+
|
|
50
64
|
return {
|
|
51
65
|
positions: positions,
|
|
52
66
|
index: indexArray
|
|
53
67
|
};
|
|
54
68
|
}
|
|
69
|
+
|
|
55
70
|
function fillPolygon(points) {
|
|
56
71
|
var flattengeo = _earcut.default.flatten(points);
|
|
72
|
+
|
|
57
73
|
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
58
74
|
return {
|
|
59
75
|
positions: flattengeo.vertices,
|
package/lib/polygon/index.js
CHANGED
|
@@ -1,65 +1,93 @@
|
|
|
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
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 _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
13
20
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
14
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
15
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
16
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
17
28
|
var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
29
|
+
|
|
18
30
|
var _models = _interopRequireDefault(require("./models/"));
|
|
31
|
+
|
|
19
32
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
33
|
+
|
|
20
34
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
35
|
+
|
|
21
36
|
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
22
37
|
(0, _inherits2.default)(PolygonLayer, _BaseLayer);
|
|
38
|
+
|
|
23
39
|
var _super = _createSuper(PolygonLayer);
|
|
40
|
+
|
|
24
41
|
function PolygonLayer() {
|
|
25
42
|
var _this;
|
|
43
|
+
|
|
26
44
|
(0, _classCallCheck2.default)(this, PolygonLayer);
|
|
45
|
+
|
|
27
46
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
28
47
|
args[_key] = arguments[_key];
|
|
29
48
|
}
|
|
49
|
+
|
|
30
50
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
31
51
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "type", 'PolygonLayer');
|
|
32
52
|
return _this;
|
|
33
53
|
}
|
|
54
|
+
|
|
34
55
|
(0, _createClass2.default)(PolygonLayer, [{
|
|
35
56
|
key: "buildModels",
|
|
36
57
|
value: function () {
|
|
37
58
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
38
59
|
var shape;
|
|
39
60
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
40
|
-
while (1)
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
61
|
+
while (1) {
|
|
62
|
+
switch (_context.prev = _context.next) {
|
|
63
|
+
case 0:
|
|
64
|
+
shape = this.getModelType();
|
|
65
|
+
this.layerModel = new _models.default[shape](this);
|
|
66
|
+
_context.next = 4;
|
|
67
|
+
return this.initLayerModels();
|
|
68
|
+
|
|
69
|
+
case 4:
|
|
70
|
+
case "end":
|
|
71
|
+
return _context.stop();
|
|
72
|
+
}
|
|
49
73
|
}
|
|
50
74
|
}, _callee, this);
|
|
51
75
|
}));
|
|
76
|
+
|
|
52
77
|
function buildModels() {
|
|
53
78
|
return _buildModels.apply(this, arguments);
|
|
54
79
|
}
|
|
80
|
+
|
|
55
81
|
return buildModels;
|
|
56
82
|
}()
|
|
57
83
|
}, {
|
|
58
84
|
key: "getModelType",
|
|
59
85
|
value: function getModelType() {
|
|
60
86
|
var _shapeAttribute$scale;
|
|
87
|
+
|
|
61
88
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
62
89
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
90
|
+
|
|
63
91
|
if (shape === 'fill' || !shape) {
|
|
64
92
|
return 'fill';
|
|
65
93
|
} else if (shape === 'extrude') {
|
|
@@ -80,33 +108,42 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
80
108
|
// pointlayer
|
|
81
109
|
// 2D、 3d、 shape、image、text、normal、
|
|
82
110
|
var layerData = this.getEncodedData();
|
|
111
|
+
|
|
83
112
|
var _this$getLayerConfig = this.getLayerConfig(),
|
|
84
|
-
|
|
85
|
-
|
|
113
|
+
shape2d = _this$getLayerConfig.shape2d,
|
|
114
|
+
shape3d = _this$getLayerConfig.shape3d;
|
|
115
|
+
|
|
86
116
|
var iconMap = this.iconService.getIconMap();
|
|
87
117
|
var item = layerData.find(function (fe) {
|
|
88
118
|
return fe.hasOwnProperty('shape');
|
|
89
119
|
});
|
|
120
|
+
|
|
90
121
|
if (!item) {
|
|
91
122
|
return 'fill';
|
|
92
123
|
} else {
|
|
93
124
|
var shape = item.shape;
|
|
125
|
+
|
|
94
126
|
if (shape === 'dot') {
|
|
95
127
|
return 'point_normal';
|
|
96
128
|
}
|
|
129
|
+
|
|
97
130
|
if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
|
|
98
131
|
return 'point_fill';
|
|
99
132
|
}
|
|
133
|
+
|
|
100
134
|
if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
|
|
101
135
|
return 'point_extrude';
|
|
102
136
|
}
|
|
137
|
+
|
|
103
138
|
if (iconMap.hasOwnProperty(shape)) {
|
|
104
139
|
return 'point_image';
|
|
105
140
|
}
|
|
141
|
+
|
|
106
142
|
return 'text';
|
|
107
143
|
}
|
|
108
144
|
}
|
|
109
145
|
}]);
|
|
110
146
|
return PolygonLayer;
|
|
111
147
|
}(_BaseLayer2.default);
|
|
148
|
+
|
|
112
149
|
exports.default = PolygonLayer;
|
|
@@ -1,60 +1,87 @@
|
|
|
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
13
|
+
|
|
10
14
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
15
|
+
|
|
11
16
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
17
|
+
|
|
12
18
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
19
|
+
|
|
13
20
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
14
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
15
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
16
26
|
var _l7Core = require("@antv/l7-core");
|
|
27
|
+
|
|
17
28
|
var _l7Utils = require("@antv/l7-utils");
|
|
29
|
+
|
|
18
30
|
var _lodash = require("lodash");
|
|
31
|
+
|
|
19
32
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
33
|
+
|
|
20
34
|
var _triangulation = require("../../core/triangulation");
|
|
35
|
+
|
|
21
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
37
|
+
|
|
22
38
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
23
40
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
24
41
|
var polygonExtrudeFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0]; \n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
42
|
+
|
|
25
43
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
26
44
|
var polygonExtrudeVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
|
|
45
|
+
|
|
27
46
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
28
47
|
var polygonExtrudeTexFrag = "uniform sampler2D u_texture;\nuniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float lightWeight = styleMappingMat[3][1];\n float topU = styleMappingMat[2][2];\n float topV = styleMappingMat[2][3];\n\n float sidey = styleMappingMat[3][0];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n\n if(u_linearColor == 1.0) {\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n gl_FragColor = v_Color;\n }\n } else {\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = texture2D(u_texture, vec2(topU, topV));\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
|
|
48
|
+
|
|
29
49
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
|
|
30
50
|
var polygonExtrudeTexVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n v_Color = a_Color;\n\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - a_Position.z(judge side by a_Position.z)\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1] - u - v\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n \n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[2][2] = a_uvs[0];\n styleMappingMat[2][3] = 1.0 - a_uvs[1];\n styleMappingMat[3][0] = a_uvs[2];\n\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // project_pos.z += 500000.0; // amap1\n\n // project_pos.z += (500000.0 * 4.0)/pow(2.0, 21.0 - u_Zoom); // mapbox\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
|
|
51
|
+
|
|
31
52
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
|
|
32
53
|
var polygonExtrudePickLightFrag = "uniform float u_opacity: 1.0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_linearColor: 0;\n\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\n\nvarying vec4 v_Color;\nvarying mat4 styleMappingMat; // \u4F20\u9012\u4ECE\u7247\u5143\u4E2D\u4F20\u9012\u7684\u6620\u5C04\u6570\u636E\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = styleMappingMat[0][0];\n float isSide = styleMappingMat[0][3];\n float sidey = styleMappingMat[3][0];\n float lightWeight = styleMappingMat[3][1];\n\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {\n // side face\n if(u_sidesurface < 1.0) {\n discard;\n }\n \n if( u_linearColor == 1.0) {\n // side use linear\n vec4 linearColor = mix(u_targetColor, u_sourceColor, sidey);\n linearColor.rgb *= lightWeight;\n gl_FragColor = linearColor;\n } else {\n // side notuse linear\n gl_FragColor = v_Color;\n }\n } else {\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n gl_FragColor = v_Color;\n }\n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColorAlpha(gl_FragColor, lightWeight);\n}\n";
|
|
54
|
+
|
|
33
55
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
34
56
|
var polygonExtrudePickLightVert = "precision highp float;\n\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute float a_Size;\nattribute vec3 a_uvs;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_opacity: 1.0;\nvarying mat4 styleMappingMat; // \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n#pragma include \"styleMapping\"\n#pragma include \"styleMappingCalOpacity\"\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n styleMappingMat = mat4(\n 0.0, 0.0, 0.0, 0.0, // opacity - strokeOpacity - strokeWidth - isSide\n 0.0, 0.0, 0.0, 0.0, // strokeR - strokeG - strokeB - strokeA\n 0.0, 0.0, 0.0, 0.0, // offsets[0] - offsets[1]\n 0.0, 0.0, 0.0, 0.0 // sidey\n );\n styleMappingMat[0][3] = a_Position.z;\n styleMappingMat[3][0] = a_uvs[2];\n\n float rowCount = u_cellTypeLayout[0][0]; // \u5F53\u524D\u7684\u6570\u636E\u7EB9\u7406\u6709\u51E0\u884C\n float columnCount = u_cellTypeLayout[0][1]; // \u5F53\u770B\u5230\u6570\u636E\u7EB9\u7406\u6709\u51E0\u5217\n float columnWidth = 1.0/columnCount; // \u5217\u5BBD\n float rowHeight = 1.0/rowCount; // \u884C\u9AD8\n float cellCount = calCellCount(); // opacity - strokeOpacity - strokeWidth - stroke - offsets\n float id = a_vertexId; // \u7B2Cn\u4E2A\u9876\u70B9\n float cellCurrentRow = floor(id * cellCount / columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u884C\n float cellCurrentColumn = mod(id * cellCount, columnCount) + 1.0; // \u8D77\u59CB\u70B9\u5728\u7B2C\u51E0\u5217\n \n // cell \u56FA\u5B9A\u987A\u5E8F opacity -> strokeOpacity -> strokeWidth -> stroke ... \n // \u6309\u987A\u5E8F\u4ECE cell \u4E2D\u53D6\u503C\u3001\u82E5\u6CA1\u6709\u5219\u81EA\u52A8\u5F80\u4E0B\u53D6\u503C\n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n vec2 opacityAndOffset = calOpacityAndOffset(cellCurrentRow, cellCurrentColumn, columnCount, textureOffset, columnWidth, rowHeight);\n styleMappingMat[0][0] = opacityAndOffset.r;\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n vec4 project_pos = project_position(pos);\n\n if(u_heightfixed > 0.0) { // \u5224\u65AD\u51E0\u4F55\u4F53\u662F\u5426\u56FA\u5B9A\u9AD8\u5EA6\n project_pos.z = a_Position.z * a_Size;\n project_pos.z += u_raisingHeight;\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n float mapboxZoomScale = 4.0/pow(2.0, 21.0 - u_Zoom);\n project_pos.z *= mapboxZoomScale;\n project_pos.z += u_raisingHeight * mapboxZoomScale;\n }\n }\n\n // gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xyz * vec3(1.0, 1.0, -1.0), 1.0));\n gl_Position = u_Mvp * (vec4(project_pos.xyz, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(project_pos.xyz, 1.0));\n }\n\n float lightWeight = calc_lighting(pos);\n // v_Color = a_Color;\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n styleMappingMat[3][1] = lightWeight;\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
57
|
+
|
|
35
58
|
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
36
59
|
(0, _inherits2.default)(ExtrudeModel, _BaseModel);
|
|
60
|
+
|
|
37
61
|
var _super = _createSuper(ExtrudeModel);
|
|
62
|
+
|
|
38
63
|
function ExtrudeModel() {
|
|
39
64
|
(0, _classCallCheck2.default)(this, ExtrudeModel);
|
|
40
65
|
return _super.apply(this, arguments);
|
|
41
66
|
}
|
|
67
|
+
|
|
42
68
|
(0, _createClass2.default)(ExtrudeModel, [{
|
|
43
69
|
key: "getUninforms",
|
|
44
70
|
value: function getUninforms() {
|
|
45
71
|
var _ref = this.layer.getLayerConfig(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
72
|
+
_ref$opacity = _ref.opacity,
|
|
73
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
74
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
75
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
76
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
77
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
78
|
+
_ref$topsurface = _ref.topsurface,
|
|
79
|
+
topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
|
|
80
|
+
_ref$sidesurface = _ref.sidesurface,
|
|
81
|
+
sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
|
|
82
|
+
sourceColor = _ref.sourceColor,
|
|
83
|
+
targetColor = _ref.targetColor;
|
|
84
|
+
|
|
58
85
|
if (this.dataTextureTest && this.dataTextureNeedUpdate({
|
|
59
86
|
opacity: opacity
|
|
60
87
|
})) {
|
|
@@ -62,10 +89,12 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
62
89
|
opacity: opacity
|
|
63
90
|
});
|
|
64
91
|
var encodeData = this.layer.getEncodedData();
|
|
92
|
+
|
|
65
93
|
var _this$calDataFrame = this.calDataFrame(this.cellLength, encodeData, this.cellProperties),
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
94
|
+
data = _this$calDataFrame.data,
|
|
95
|
+
width = _this$calDataFrame.width,
|
|
96
|
+
height = _this$calDataFrame.height;
|
|
97
|
+
|
|
69
98
|
this.rowCount = height; // 当前数据纹理有多少行
|
|
70
99
|
|
|
71
100
|
this.dataTexture = this.cellLength > 0 && data.length > 0 ? this.createTexture2D({
|
|
@@ -83,17 +112,20 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
83
112
|
width: 1,
|
|
84
113
|
height: 1
|
|
85
114
|
});
|
|
86
|
-
}
|
|
115
|
+
} // 转化渐变色
|
|
116
|
+
|
|
87
117
|
|
|
88
|
-
// 转化渐变色
|
|
89
118
|
var useLinearColor = 0; // 默认不生效
|
|
119
|
+
|
|
90
120
|
var sourceColorArr = [1, 1, 1, 1];
|
|
91
121
|
var targetColorArr = [1, 1, 1, 1];
|
|
122
|
+
|
|
92
123
|
if (sourceColor && targetColor) {
|
|
93
124
|
sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
|
|
94
125
|
targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
|
|
95
126
|
useLinearColor = 1;
|
|
96
127
|
}
|
|
128
|
+
|
|
97
129
|
return {
|
|
98
130
|
// 控制侧面和顶面的显示隐藏
|
|
99
131
|
u_topsurface: Number(topsurface),
|
|
@@ -116,19 +148,24 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
116
148
|
value: function () {
|
|
117
149
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
118
150
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
119
|
-
while (1)
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
151
|
+
while (1) {
|
|
152
|
+
switch (_context.prev = _context.next) {
|
|
153
|
+
case 0:
|
|
154
|
+
this.loadTexture();
|
|
155
|
+
return _context.abrupt("return", this.buildModels());
|
|
156
|
+
|
|
157
|
+
case 2:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context.stop();
|
|
160
|
+
}
|
|
126
161
|
}
|
|
127
162
|
}, _callee, this);
|
|
128
163
|
}));
|
|
164
|
+
|
|
129
165
|
function initModels() {
|
|
130
166
|
return _initModels.apply(this, arguments);
|
|
131
167
|
}
|
|
168
|
+
|
|
132
169
|
return initModels;
|
|
133
170
|
}()
|
|
134
171
|
}, {
|
|
@@ -136,37 +173,45 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
136
173
|
value: function () {
|
|
137
174
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
138
175
|
var _this$getShaders, frag, vert, type, model;
|
|
176
|
+
|
|
139
177
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
140
|
-
while (1)
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
178
|
+
while (1) {
|
|
179
|
+
switch (_context2.prev = _context2.next) {
|
|
180
|
+
case 0:
|
|
181
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
182
|
+
_context2.next = 3;
|
|
183
|
+
return this.layer.buildLayerModel({
|
|
184
|
+
moduleName: type,
|
|
185
|
+
vertexShader: vert,
|
|
186
|
+
fragmentShader: frag,
|
|
187
|
+
triangulation: _triangulation.PolygonExtrudeTriangulation
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
case 3:
|
|
191
|
+
model = _context2.sent;
|
|
192
|
+
return _context2.abrupt("return", [model]);
|
|
193
|
+
|
|
194
|
+
case 5:
|
|
195
|
+
case "end":
|
|
196
|
+
return _context2.stop();
|
|
197
|
+
}
|
|
156
198
|
}
|
|
157
199
|
}, _callee2, this);
|
|
158
200
|
}));
|
|
201
|
+
|
|
159
202
|
function buildModels() {
|
|
160
203
|
return _buildModels.apply(this, arguments);
|
|
161
204
|
}
|
|
205
|
+
|
|
162
206
|
return buildModels;
|
|
163
207
|
}()
|
|
164
208
|
}, {
|
|
165
209
|
key: "getShaders",
|
|
166
210
|
value: function getShaders() {
|
|
167
211
|
var _ref2 = this.layer.getLayerConfig(),
|
|
168
|
-
|
|
169
|
-
|
|
212
|
+
pickLight = _ref2.pickLight,
|
|
213
|
+
mapTexture = _ref2.mapTexture;
|
|
214
|
+
|
|
170
215
|
if (mapTexture) {
|
|
171
216
|
return {
|
|
172
217
|
frag: polygonExtrudeTexFrag,
|
|
@@ -174,6 +219,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
174
219
|
type: 'polygonExtrudeTexture'
|
|
175
220
|
};
|
|
176
221
|
}
|
|
222
|
+
|
|
177
223
|
if (pickLight) {
|
|
178
224
|
return {
|
|
179
225
|
frag: polygonExtrudePickLightFrag,
|
|
@@ -192,6 +238,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
192
238
|
key: "clearModels",
|
|
193
239
|
value: function clearModels() {
|
|
194
240
|
var _this$dataTexture, _this$texture;
|
|
241
|
+
|
|
195
242
|
(_this$dataTexture = this.dataTexture) === null || _this$dataTexture === void 0 ? void 0 : _this$dataTexture.destroy();
|
|
196
243
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
197
244
|
}
|
|
@@ -199,11 +246,13 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
199
246
|
key: "registerBuiltinAttributes",
|
|
200
247
|
value: function registerBuiltinAttributes() {
|
|
201
248
|
var bbox = this.layer.getSource().extent;
|
|
249
|
+
|
|
202
250
|
var _bbox = (0, _slicedToArray2.default)(bbox, 4),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
251
|
+
minLng = _bbox[0],
|
|
252
|
+
minLat = _bbox[1],
|
|
253
|
+
maxLng = _bbox[2],
|
|
254
|
+
maxLat = _bbox[3];
|
|
255
|
+
|
|
207
256
|
var lngLen = maxLng - minLng;
|
|
208
257
|
var latLen = maxLat - minLat;
|
|
209
258
|
this.styleAttributeService.registerStyleAttribute({
|
|
@@ -255,7 +304,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
255
304
|
size: 1,
|
|
256
305
|
update: function update(feature) {
|
|
257
306
|
var _feature$size = feature.size,
|
|
258
|
-
|
|
307
|
+
size = _feature$size === void 0 ? 10 : _feature$size;
|
|
259
308
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
260
309
|
}
|
|
261
310
|
}
|
|
@@ -265,17 +314,21 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
265
314
|
key: "loadTexture",
|
|
266
315
|
value: function loadTexture() {
|
|
267
316
|
var _this = this;
|
|
317
|
+
|
|
268
318
|
var _ref3 = this.layer.getLayerConfig(),
|
|
269
|
-
|
|
319
|
+
mapTexture = _ref3.mapTexture;
|
|
320
|
+
|
|
270
321
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
271
322
|
this.texture = createTexture2D({
|
|
272
323
|
height: 0,
|
|
273
324
|
width: 0
|
|
274
325
|
});
|
|
326
|
+
|
|
275
327
|
if (mapTexture) {
|
|
276
328
|
var image = new Image();
|
|
277
329
|
image.crossOrigin = '';
|
|
278
330
|
image.src = mapTexture;
|
|
331
|
+
|
|
279
332
|
image.onload = function () {
|
|
280
333
|
_this.texture = createTexture2D({
|
|
281
334
|
data: image,
|
|
@@ -286,6 +339,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
286
339
|
min: _l7Core.gl.LINEAR,
|
|
287
340
|
mag: _l7Core.gl.LINEAR
|
|
288
341
|
});
|
|
342
|
+
|
|
289
343
|
_this.layerService.reRender();
|
|
290
344
|
};
|
|
291
345
|
}
|
|
@@ -293,4 +347,5 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
293
347
|
}]);
|
|
294
348
|
return ExtrudeModel;
|
|
295
349
|
}(_BaseModel2.default);
|
|
350
|
+
|
|
296
351
|
exports.default = ExtrudeModel;
|