@antv/l7-layers 2.17.4 → 2.17.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +9 -31
- package/es/Geometry/models/billboard.js +51 -89
- package/es/Geometry/models/plane.js +81 -143
- package/es/Geometry/models/sprite.js +60 -118
- package/es/canvas/index.js +10 -33
- package/es/canvas/models/canvas.js +41 -97
- package/es/citybuliding/building.js +8 -27
- package/es/citybuliding/models/build.js +57 -82
- package/es/core/BaseLayer.js +325 -483
- package/es/core/BaseModel.js +51 -80
- package/es/core/CommonStyleAttribute.js +2 -5
- package/es/core/LayerPickService.js +21 -32
- package/es/core/TextureService.js +0 -13
- package/es/core/interface.js +17 -24
- package/es/core/shape/Path.js +13 -20
- package/es/core/shape/extrude.js +27 -39
- package/es/core/triangulation.js +99 -136
- package/es/earth/index.js +9 -33
- package/es/earth/models/atmosphere.js +30 -54
- package/es/earth/models/base.js +47 -85
- package/es/earth/models/bloomsphere.js +30 -54
- package/es/earth/utils.js +9 -13
- package/es/heatmap/index.js +10 -40
- package/es/heatmap/models/grid.js +28 -52
- package/es/heatmap/models/grid3d.js +28 -52
- package/es/heatmap/models/heatmap.js +92 -149
- package/es/heatmap/models/hexagon.js +28 -52
- package/es/heatmap/triangulation.js +0 -4
- package/es/image/index.js +9 -28
- package/es/image/models/image.js +66 -100
- package/es/index.js +9 -17
- package/es/line/index.js +9 -35
- package/es/line/models/arc.js +63 -112
- package/es/line/models/arc_3d.js +58 -102
- package/es/line/models/earthArc_3d.js +60 -105
- package/es/line/models/flow.js +36 -60
- package/es/line/models/great_circle.js +53 -94
- package/es/line/models/line.js +92 -144
- package/es/line/models/linearline.js +42 -74
- package/es/line/models/simpleLine.js +38 -67
- package/es/line/models/wall.js +52 -92
- package/es/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/es/line/shaders/line_frag.glsl +1 -3
- package/es/line/shaders/line_vert.glsl +2 -0
- package/es/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +78 -114
- package/es/plugins/DataSourcePlugin.js +45 -68
- package/es/plugins/FeatureScalePlugin.js +67 -122
- package/es/plugins/LayerAnimateStylePlugin.js +0 -5
- package/es/plugins/LayerMaskPlugin.js +3 -11
- package/es/plugins/LayerModelPlugin.js +69 -118
- package/es/plugins/LayerStylePlugin.js +4 -9
- package/es/plugins/LightingPlugin.js +12 -18
- package/es/plugins/MultiPassRendererPlugin.js +11 -16
- package/es/plugins/PixelPickingPlugin.js +12 -21
- package/es/plugins/RegisterStyleAttributePlugin.js +5 -12
- package/es/plugins/ShaderUniformPlugin.js +13 -27
- package/es/plugins/UpdateModelPlugin.js +0 -5
- package/es/plugins/UpdateStyleAttributePlugin.js +5 -11
- package/es/point/index.js +26 -78
- package/es/point/models/earthExtrude.js +58 -95
- package/es/point/models/earthFill.js +52 -80
- package/es/point/models/extrude.js +57 -94
- package/es/point/models/fill.js +56 -81
- package/es/point/models/fillmage.js +60 -100
- package/es/point/models/image.js +47 -83
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +38 -63
- package/es/point/models/simplePoint.js +38 -62
- package/es/point/models/text.js +199 -296
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -41
- package/es/polygon/models/extrude.js +87 -135
- package/es/polygon/models/fill.js +50 -79
- package/es/polygon/models/index.js +3 -2
- package/es/polygon/models/ocean.js +42 -76
- package/es/polygon/models/water.js +37 -71
- package/es/raster/buffers/triangulation.js +2 -4
- package/es/raster/index.js +9 -32
- package/es/raster/models/raster.js +80 -116
- package/es/raster/models/rasterRgb.js +84 -127
- package/es/raster/models/rasterTerrainRgb.js +56 -84
- package/es/tile/interaction/getRasterData.js +14 -20
- package/es/tile/interaction/utils.js +7 -9
- package/es/tile/manager/base.js +63 -96
- package/es/tile/service/TileLayerService.js +33 -55
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +29 -46
- package/es/tile/tileFactory/ImageTile.js +20 -38
- package/es/tile/tileFactory/MaskTile.js +22 -43
- package/es/tile/tileFactory/RasterRGBTile.js +22 -42
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +20 -38
- package/es/tile/tileFactory/RasterTile.js +30 -53
- package/es/tile/tileFactory/Tile.js +63 -97
- package/es/tile/tileFactory/VectorTile.js +41 -68
- package/es/tile/tileFactory/index.js +0 -11
- package/es/tile/tileFactory/layers/TileDebugLayer.js +6 -27
- package/es/tile/tileFactory/util.js +0 -3
- package/es/tile/tileLayer/BaseLayer.js +105 -146
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +0 -2
- package/es/utils/collision-index.js +9 -16
- package/es/utils/extrude_polyline.js +101 -149
- package/es/utils/grid-index.js +2 -27
- package/es/utils/identityScale.js +0 -8
- package/es/utils/layerData.js +30 -44
- package/es/utils/multiPassRender.js +11 -13
- package/es/utils/polylineNormal.js +31 -37
- package/es/utils/simpleLine.js +2 -16
- package/es/utils/stencil.js +2 -3
- package/es/utils/symbol-layout.js +27 -53
- package/es/wind/index.js +9 -29
- package/es/wind/models/utils.js +26 -51
- package/es/wind/models/wind.js +101 -147
- package/es/wind/models/windRender.js +53 -66
- package/lib/Geometry/index.js +9 -38
- package/lib/Geometry/models/billboard.js +51 -97
- package/lib/Geometry/models/index.js +0 -5
- package/lib/Geometry/models/plane.js +79 -151
- package/lib/Geometry/models/sprite.js +60 -127
- package/lib/canvas/index.js +10 -40
- package/lib/canvas/models/canvas.js +41 -101
- package/lib/canvas/models/index.js +0 -3
- package/lib/citybuliding/building.js +8 -35
- package/lib/citybuliding/models/build.js +57 -92
- package/lib/core/BaseLayer.js +325 -474
- package/lib/core/BaseModel.js +51 -90
- package/lib/core/CommonStyleAttribute.js +2 -7
- package/lib/core/LayerPickService.js +21 -37
- package/lib/core/TextureService.js +0 -16
- package/lib/core/interface.js +21 -31
- package/lib/core/schema.js +0 -1
- package/lib/core/shape/Path.js +14 -31
- package/lib/core/shape/extrude.js +27 -62
- package/lib/core/triangulation.js +98 -177
- package/lib/earth/index.js +9 -43
- package/lib/earth/models/atmosphere.js +30 -63
- package/lib/earth/models/base.js +47 -90
- package/lib/earth/models/bloomsphere.js +30 -63
- package/lib/earth/utils.js +7 -31
- package/lib/heatmap/index.js +10 -48
- package/lib/heatmap/models/grid.js +28 -60
- package/lib/heatmap/models/grid3d.js +28 -60
- package/lib/heatmap/models/heatmap.js +92 -166
- package/lib/heatmap/models/hexagon.js +28 -60
- package/lib/heatmap/models/index.js +0 -6
- package/lib/heatmap/triangulation.js +0 -5
- package/lib/image/index.js +9 -36
- package/lib/image/models/image.js +66 -109
- package/lib/image/models/index.js +0 -3
- package/lib/index.js +7 -61
- package/lib/line/index.js +9 -40
- package/lib/line/models/arc.js +61 -122
- package/lib/line/models/arc_3d.js +56 -113
- package/lib/line/models/earthArc_3d.js +58 -115
- package/lib/line/models/flow.js +36 -70
- package/lib/line/models/great_circle.js +53 -104
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +90 -152
- package/lib/line/models/linearline.js +42 -86
- package/lib/line/models/simpleLine.js +38 -77
- package/lib/line/models/wall.js +52 -103
- package/lib/line/shaders/dash/line_dash_vert.glsl +1 -2
- package/lib/line/shaders/line_frag.glsl +1 -3
- package/lib/line/shaders/line_vert.glsl +2 -0
- package/lib/line/shaders/linear/line_linear_frag.glsl +1 -1
- package/lib/mask/index.js +9 -36
- package/lib/mask/models/fill.js +29 -63
- package/lib/mask/models/index.js +0 -3
- package/lib/plugins/DataMappingPlugin.js +78 -125
- package/lib/plugins/DataSourcePlugin.js +45 -76
- package/lib/plugins/FeatureScalePlugin.js +67 -138
- package/lib/plugins/LayerAnimateStylePlugin.js +0 -10
- package/lib/plugins/LayerMaskPlugin.js +4 -17
- package/lib/plugins/LayerModelPlugin.js +70 -127
- package/lib/plugins/LayerStylePlugin.js +5 -14
- package/lib/plugins/LightingPlugin.js +12 -25
- package/lib/plugins/MultiPassRendererPlugin.js +11 -22
- package/lib/plugins/PixelPickingPlugin.js +12 -27
- package/lib/plugins/RegisterStyleAttributePlugin.js +5 -19
- package/lib/plugins/ShaderUniformPlugin.js +13 -34
- package/lib/plugins/UpdateModelPlugin.js +1 -10
- package/lib/plugins/UpdateStyleAttributePlugin.js +5 -16
- package/lib/point/index.js +26 -83
- package/lib/point/models/earthExtrude.js +58 -106
- package/lib/point/models/earthFill.js +52 -110
- package/lib/point/models/extrude.js +57 -103
- package/lib/point/models/fill.js +54 -90
- package/lib/point/models/fillmage.js +58 -107
- package/lib/point/models/image.js +47 -92
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +38 -72
- package/lib/point/models/simplePoint.js +38 -72
- package/lib/point/models/text.js +199 -305
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +87 -146
- package/lib/polygon/models/fill.js +50 -89
- package/lib/polygon/models/index.js +2 -14
- package/lib/polygon/models/ocean.js +42 -88
- package/lib/polygon/models/water.js +37 -82
- package/lib/raster/buffers/triangulation.js +3 -7
- package/lib/raster/index.js +9 -40
- package/lib/raster/models/index.js +0 -5
- package/lib/raster/models/raster.js +80 -125
- package/lib/raster/models/rasterRgb.js +84 -139
- package/lib/raster/models/rasterTerrainRgb.js +56 -93
- package/lib/tile/interaction/getRasterData.js +14 -25
- package/lib/tile/interaction/utils.js +7 -19
- package/lib/tile/manager/base.js +63 -104
- package/lib/tile/service/TileLayerService.js +33 -60
- package/lib/tile/service/TilePickService.js +26 -48
- package/lib/tile/service/TileSourceService.js +2 -16
- package/lib/tile/style/utils.js +0 -3
- package/lib/tile/tileFactory/DebugTile.js +29 -54
- package/lib/tile/tileFactory/ImageTile.js +20 -46
- package/lib/tile/tileFactory/MaskTile.js +22 -51
- package/lib/tile/tileFactory/RasterRGBTile.js +22 -50
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +20 -46
- package/lib/tile/tileFactory/RasterTile.js +30 -63
- package/lib/tile/tileFactory/Tile.js +63 -102
- package/lib/tile/tileFactory/VectorTile.js +41 -76
- package/lib/tile/tileFactory/index.js +0 -25
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +6 -32
- package/lib/tile/tileFactory/util.js +0 -9
- package/lib/tile/tileLayer/BaseLayer.js +105 -153
- package/lib/tile/utils.js +1 -5
- package/lib/utils/blend.js +0 -5
- package/lib/utils/collision-index.js +9 -25
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
2
|
import earcut from 'earcut';
|
|
3
|
-
|
|
4
3
|
/**
|
|
5
4
|
* 拉伸多边形顶点,返回拉伸后的顶点信息
|
|
6
5
|
* @param paths 路径数据组
|
|
@@ -9,45 +8,37 @@ import earcut from 'earcut';
|
|
|
9
8
|
export default function extrudePolygon(path) {
|
|
10
9
|
var p1 = path[0][0];
|
|
11
10
|
var p2 = path[0][path[0].length - 1];
|
|
12
|
-
|
|
13
11
|
if (p1[0] === p2[0] && p1[1] === p2[1]) {
|
|
14
12
|
path[0] = path[0].slice(0, path[0].length - 1);
|
|
15
13
|
}
|
|
16
|
-
|
|
17
14
|
var n = path[0].length;
|
|
18
15
|
var flattengeo = earcut.flatten(path);
|
|
19
16
|
var positions = [];
|
|
20
17
|
var indexArray = [];
|
|
21
|
-
var normals = [];
|
|
22
|
-
|
|
18
|
+
var normals = [];
|
|
19
|
+
// 设置顶部z值
|
|
23
20
|
for (var j = 0; j < flattengeo.vertices.length / 3; j++) {
|
|
24
21
|
flattengeo.vertices[j * 3 + 2] = 1;
|
|
25
22
|
normals.push(0, 0, 1);
|
|
26
23
|
}
|
|
27
|
-
|
|
28
24
|
positions.push.apply(positions, _toConsumableArray(flattengeo.vertices));
|
|
29
25
|
var triangles = earcut(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
30
26
|
indexArray.push.apply(indexArray, _toConsumableArray(triangles));
|
|
31
|
-
|
|
32
|
-
var _loop = function _loop(i) {
|
|
27
|
+
var _loop = function _loop() {
|
|
33
28
|
var prePoint = flattengeo.vertices.slice(i * 3, i * 3 + 3);
|
|
34
29
|
var nextPoint = flattengeo.vertices.slice(i * 3 + 3, i * 3 + 6);
|
|
35
|
-
|
|
36
30
|
if (nextPoint.length === 0) {
|
|
37
31
|
nextPoint = flattengeo.vertices.slice(0, 3);
|
|
38
32
|
}
|
|
39
|
-
|
|
40
33
|
var indexOffset = positions.length / 3;
|
|
41
34
|
positions.push(prePoint[0], prePoint[1], 1, nextPoint[0], nextPoint[1], 1, prePoint[0], prePoint[1], 0, nextPoint[0], nextPoint[1], 0);
|
|
42
35
|
indexArray.push.apply(indexArray, _toConsumableArray([1, 2, 0, 3, 2, 1].map(function (v) {
|
|
43
36
|
return v + indexOffset;
|
|
44
37
|
})));
|
|
45
38
|
};
|
|
46
|
-
|
|
47
39
|
for (var i = 0; i < n; i++) {
|
|
48
|
-
_loop(
|
|
40
|
+
_loop();
|
|
49
41
|
}
|
|
50
|
-
|
|
51
42
|
return {
|
|
52
43
|
positions: positions,
|
|
53
44
|
index: indexArray
|
package/es/polygon/index.js
CHANGED
|
@@ -7,73 +7,53 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
7
7
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
8
8
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
-
|
|
15
12
|
import BaseLayer from "../core/BaseLayer";
|
|
16
13
|
import PolygonModels from "./models/";
|
|
17
|
-
|
|
18
14
|
var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
19
15
|
_inherits(PolygonLayer, _BaseLayer);
|
|
20
|
-
|
|
21
16
|
var _super = _createSuper(PolygonLayer);
|
|
22
|
-
|
|
23
17
|
function PolygonLayer() {
|
|
24
18
|
var _this;
|
|
25
|
-
|
|
26
19
|
_classCallCheck(this, PolygonLayer);
|
|
27
|
-
|
|
28
20
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
29
21
|
args[_key] = arguments[_key];
|
|
30
22
|
}
|
|
31
|
-
|
|
32
23
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
-
|
|
34
24
|
_defineProperty(_assertThisInitialized(_this), "type", 'PolygonLayer');
|
|
35
|
-
|
|
36
25
|
_defineProperty(_assertThisInitialized(_this), "enableEncodeStyles", ['opacity']);
|
|
37
|
-
|
|
38
26
|
return _this;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
28
|
_createClass(PolygonLayer, [{
|
|
42
29
|
key: "buildModels",
|
|
43
30
|
value: function () {
|
|
44
31
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
45
32
|
var shape;
|
|
46
33
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
47
|
-
while (1) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
case "end":
|
|
57
|
-
return _context.stop();
|
|
58
|
-
}
|
|
34
|
+
while (1) switch (_context.prev = _context.next) {
|
|
35
|
+
case 0:
|
|
36
|
+
shape = this.getModelType();
|
|
37
|
+
this.layerModel = new PolygonModels[shape](this);
|
|
38
|
+
_context.next = 4;
|
|
39
|
+
return this.initLayerModels();
|
|
40
|
+
case 4:
|
|
41
|
+
case "end":
|
|
42
|
+
return _context.stop();
|
|
59
43
|
}
|
|
60
44
|
}, _callee, this);
|
|
61
45
|
}));
|
|
62
|
-
|
|
63
46
|
function buildModels() {
|
|
64
47
|
return _buildModels.apply(this, arguments);
|
|
65
48
|
}
|
|
66
|
-
|
|
67
49
|
return buildModels;
|
|
68
50
|
}()
|
|
69
51
|
}, {
|
|
70
52
|
key: "getModelType",
|
|
71
53
|
value: function getModelType() {
|
|
72
54
|
var _shapeAttribute$scale;
|
|
73
|
-
|
|
74
55
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
75
56
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
76
|
-
|
|
77
57
|
if (shape === 'fill' || !shape) {
|
|
78
58
|
return 'fill';
|
|
79
59
|
} else if (shape === 'extrude') {
|
|
@@ -94,43 +74,33 @@ var PolygonLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
94
74
|
// pointlayer
|
|
95
75
|
// 2D、 3d、 shape、image、text、normal、
|
|
96
76
|
var layerData = this.getEncodedData();
|
|
97
|
-
|
|
98
77
|
var _this$getLayerConfig = this.getLayerConfig(),
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
78
|
+
shape2d = _this$getLayerConfig.shape2d,
|
|
79
|
+
shape3d = _this$getLayerConfig.shape3d;
|
|
102
80
|
var iconMap = this.iconService.getIconMap();
|
|
103
81
|
var item = layerData.find(function (fe) {
|
|
104
82
|
return fe.hasOwnProperty('shape');
|
|
105
83
|
});
|
|
106
|
-
|
|
107
84
|
if (!item) {
|
|
108
85
|
return 'fill';
|
|
109
86
|
} else {
|
|
110
87
|
var shape = item.shape;
|
|
111
|
-
|
|
112
88
|
if (shape === 'dot') {
|
|
113
89
|
return 'point_normal';
|
|
114
90
|
}
|
|
115
|
-
|
|
116
91
|
if ((shape2d === null || shape2d === void 0 ? void 0 : shape2d.indexOf(shape)) !== -1) {
|
|
117
92
|
return 'point_fill';
|
|
118
93
|
}
|
|
119
|
-
|
|
120
94
|
if ((shape3d === null || shape3d === void 0 ? void 0 : shape3d.indexOf(shape)) !== -1) {
|
|
121
95
|
return 'point_extrude';
|
|
122
96
|
}
|
|
123
|
-
|
|
124
97
|
if (iconMap.hasOwnProperty(shape)) {
|
|
125
98
|
return 'point_image';
|
|
126
99
|
}
|
|
127
|
-
|
|
128
100
|
return 'text';
|
|
129
101
|
}
|
|
130
102
|
}
|
|
131
103
|
}]);
|
|
132
|
-
|
|
133
104
|
return PolygonLayer;
|
|
134
105
|
}(BaseLayer);
|
|
135
|
-
|
|
136
106
|
export { PolygonLayer as default };
|
|
@@ -7,72 +7,55 @@ import _inherits from "@babel/runtime/helpers/esm/inherits";
|
|
|
7
7
|
import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn";
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
10
|
-
|
|
11
10
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
|
|
13
11
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
14
|
-
|
|
15
12
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
16
13
|
import { rgb2arr } from '@antv/l7-utils';
|
|
17
14
|
import BaseModel from "../../core/BaseModel";
|
|
18
15
|
import { PolygonExtrudeTriangulation } from "../../core/triangulation";
|
|
19
|
-
|
|
20
16
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_frag.glsl' */
|
|
21
17
|
var polygonExtrudeFrag = "uniform 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;\n\n#pragma include \"picking\"\n\nvoid main() {\n\n\n // top face\n if(u_topsurface < 1.0) {\n discard;\n }\n\n gl_FragColor = v_Color;\n \n\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
22
|
-
|
|
23
18
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_vert.glsl' */
|
|
24
19
|
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;\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;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n float isSide = a_Position.z;\n float topU = a_uvs[0];\n float topV = 1.0 - a_uvs[1];\n float sidey = a_uvs[2];\n\n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n\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\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 // 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 v_Color = linearColor;\n } else {\n v_Color = a_Color;\n }\n\n } else {\n v_Color = a_Color;\n }\n\n v_Color = vec4(v_Color.rgb * lightWeight, v_Color.w * opacity);\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude
|
|
25
|
-
|
|
26
20
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_frag.glsl' */
|
|
27
21
|
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 vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float lightWeight = v_texture_data.y;\n float topU = v_uvs[0];\n float topV = 1.0 - v_uvs[1];\n float sidey = v_uvs[2];\n // Tip: \u90E8\u5206\u673A\u578B GPU \u8BA1\u7B97\u7CBE\u5EA6\u517C\u5BB9\n if(isSide < 0.999) {// \u662F\u5426\u662F\u8FB9\u7F18\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 // gl_FragColor = vec4(1.0, 0., 0., 1.0);\n }\n \n\n gl_FragColor.a *= opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n"; // texture
|
|
28
|
-
|
|
29
22
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrudetex_vert.glsl' */
|
|
30
23
|
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;\nuniform sampler2D u_texture;\n\n\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\nuniform float u_topsurface: 1.0;\nuniform float u_sidesurface: 1.0;\nvarying vec4 v_Color;\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\nuniform float u_linearColor: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n \n vec4 pos = vec4(a_Position.xy, a_Position.z * a_Size, 1.0);\n float lightWeight = calc_lighting(pos);\n vec4 project_pos = project_position(pos);\n v_uvs = a_uvs;\n\n v_texture_data = vec2(a_Position.z, lightWeight);\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\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\n\n\n setPickingColor(a_PickingColor);\n}\n"; // extrude picking
|
|
31
|
-
|
|
32
24
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_frag.glsl' */
|
|
33
25
|
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 vec3 v_uvs;\nvarying vec2 v_texture_data;\n\n#pragma include \"picking\"\n\nvoid main() {\n float opacity = u_opacity;\n float isSide = v_texture_data.x;\n float sidey = v_uvs[2];\n float lightWeight = v_texture_data.y;\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";
|
|
34
|
-
|
|
35
26
|
/* babel-plugin-inline-import '../shaders/extrude/polygon_extrude_picklight_vert.glsl' */
|
|
36
27
|
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\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_raisingHeight: 0.0;\n\nvarying vec2 v_texture_data;\nvarying vec3 v_uvs;\nvarying vec4 v_Color;\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nvoid main() {\n\n\n v_uvs = a_uvs;\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_texture_data = vec2(a_Position.z,lightWeight);\n\n v_Color = vec4(a_Color.rgb * lightWeight, a_Color.w);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
37
|
-
|
|
38
28
|
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
39
29
|
_inherits(ExtrudeModel, _BaseModel);
|
|
40
|
-
|
|
41
30
|
var _super = _createSuper(ExtrudeModel);
|
|
42
|
-
|
|
43
31
|
function ExtrudeModel() {
|
|
44
32
|
_classCallCheck(this, ExtrudeModel);
|
|
45
|
-
|
|
46
33
|
return _super.apply(this, arguments);
|
|
47
34
|
}
|
|
48
|
-
|
|
49
35
|
_createClass(ExtrudeModel, [{
|
|
50
36
|
key: "getUninforms",
|
|
51
37
|
value: function getUninforms() {
|
|
52
38
|
var _ref = this.layer.getLayerConfig(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
39
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
40
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
41
|
+
_ref$raisingHeight = _ref.raisingHeight,
|
|
42
|
+
raisingHeight = _ref$raisingHeight === void 0 ? 0 : _ref$raisingHeight,
|
|
43
|
+
_ref$topsurface = _ref.topsurface,
|
|
44
|
+
topsurface = _ref$topsurface === void 0 ? true : _ref$topsurface,
|
|
45
|
+
_ref$sidesurface = _ref.sidesurface,
|
|
46
|
+
sidesurface = _ref$sidesurface === void 0 ? true : _ref$sidesurface,
|
|
47
|
+
sourceColor = _ref.sourceColor,
|
|
48
|
+
targetColor = _ref.targetColor;
|
|
49
|
+
|
|
50
|
+
// 转化渐变色
|
|
65
51
|
var useLinearColor = 0; // 默认不生效
|
|
66
|
-
|
|
67
52
|
var sourceColorArr = [1, 1, 1, 1];
|
|
68
53
|
var targetColorArr = [1, 1, 1, 1];
|
|
69
|
-
|
|
70
54
|
if (sourceColor && targetColor) {
|
|
71
55
|
sourceColorArr = rgb2arr(sourceColor);
|
|
72
56
|
targetColorArr = rgb2arr(targetColor);
|
|
73
57
|
useLinearColor = 1;
|
|
74
58
|
}
|
|
75
|
-
|
|
76
59
|
return _objectSpread({
|
|
77
60
|
// 控制侧面和顶面的显示隐藏
|
|
78
61
|
u_topsurface: Number(topsurface),
|
|
@@ -91,27 +74,21 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
91
74
|
value: function () {
|
|
92
75
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
93
76
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
94
|
-
while (1) {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
case 3:
|
|
104
|
-
case "end":
|
|
105
|
-
return _context.stop();
|
|
106
|
-
}
|
|
77
|
+
while (1) switch (_context.prev = _context.next) {
|
|
78
|
+
case 0:
|
|
79
|
+
_context.next = 2;
|
|
80
|
+
return this.loadTexture();
|
|
81
|
+
case 2:
|
|
82
|
+
return _context.abrupt("return", this.buildModels());
|
|
83
|
+
case 3:
|
|
84
|
+
case "end":
|
|
85
|
+
return _context.stop();
|
|
107
86
|
}
|
|
108
87
|
}, _callee, this);
|
|
109
88
|
}));
|
|
110
|
-
|
|
111
89
|
function initModels() {
|
|
112
90
|
return _initModels.apply(this, arguments);
|
|
113
91
|
}
|
|
114
|
-
|
|
115
92
|
return initModels;
|
|
116
93
|
}()
|
|
117
94
|
}, {
|
|
@@ -119,46 +96,38 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
119
96
|
value: function () {
|
|
120
97
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
121
98
|
var _this$getShaders, frag, vert, type, model;
|
|
122
|
-
|
|
123
99
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
124
|
-
while (1) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
case 5:
|
|
142
|
-
case "end":
|
|
143
|
-
return _context2.stop();
|
|
144
|
-
}
|
|
100
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
_this$getShaders = this.getShaders(), frag = _this$getShaders.frag, vert = _this$getShaders.vert, type = _this$getShaders.type;
|
|
103
|
+
_context2.next = 3;
|
|
104
|
+
return this.layer.buildLayerModel({
|
|
105
|
+
moduleName: type,
|
|
106
|
+
vertexShader: vert,
|
|
107
|
+
fragmentShader: frag,
|
|
108
|
+
inject: this.getInject(),
|
|
109
|
+
triangulation: PolygonExtrudeTriangulation
|
|
110
|
+
});
|
|
111
|
+
case 3:
|
|
112
|
+
model = _context2.sent;
|
|
113
|
+
return _context2.abrupt("return", [model]);
|
|
114
|
+
case 5:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context2.stop();
|
|
145
117
|
}
|
|
146
118
|
}, _callee2, this);
|
|
147
119
|
}));
|
|
148
|
-
|
|
149
120
|
function buildModels() {
|
|
150
121
|
return _buildModels.apply(this, arguments);
|
|
151
122
|
}
|
|
152
|
-
|
|
153
123
|
return buildModels;
|
|
154
124
|
}()
|
|
155
125
|
}, {
|
|
156
126
|
key: "getShaders",
|
|
157
127
|
value: function getShaders() {
|
|
158
128
|
var _ref2 = this.layer.getLayerConfig(),
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
129
|
+
pickLight = _ref2.pickLight,
|
|
130
|
+
mapTexture = _ref2.mapTexture;
|
|
162
131
|
if (mapTexture) {
|
|
163
132
|
return {
|
|
164
133
|
frag: polygonExtrudeTexFrag,
|
|
@@ -166,7 +135,6 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
166
135
|
type: 'polygonExtrudeTexture'
|
|
167
136
|
};
|
|
168
137
|
}
|
|
169
|
-
|
|
170
138
|
if (pickLight) {
|
|
171
139
|
return {
|
|
172
140
|
frag: polygonExtrudePickLightFrag,
|
|
@@ -185,7 +153,6 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
185
153
|
key: "clearModels",
|
|
186
154
|
value: function clearModels() {
|
|
187
155
|
var _this$texture;
|
|
188
|
-
|
|
189
156
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
190
157
|
}
|
|
191
158
|
}, {
|
|
@@ -196,25 +163,21 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
196
163
|
var layerCenter = this.layer.coordCenter || this.layer.getSource().center;
|
|
197
164
|
var lngLen = bounds[2] - bounds[0];
|
|
198
165
|
var latLen = bounds[3] - bounds[1];
|
|
199
|
-
|
|
200
166
|
if (this.mapService.version === 'GAODE2.x') {
|
|
201
167
|
// @ts-ignore
|
|
202
168
|
var _this$mapService$coor = this.mapService.coordToAMap2RelativeCoordinates([bbox[0], bbox[1]], layerCenter),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
169
|
+
_this$mapService$coor2 = _slicedToArray(_this$mapService$coor, 2),
|
|
170
|
+
minX = _this$mapService$coor2[0],
|
|
171
|
+
minY = _this$mapService$coor2[1];
|
|
172
|
+
// @ts-ignore
|
|
208
173
|
var _this$mapService$coor3 = this.mapService.coordToAMap2RelativeCoordinates([bbox[2], bbox[3]], layerCenter),
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
174
|
+
_this$mapService$coor4 = _slicedToArray(_this$mapService$coor3, 2),
|
|
175
|
+
maxX = _this$mapService$coor4[0],
|
|
176
|
+
maxY = _this$mapService$coor4[1];
|
|
213
177
|
lngLen = maxX - minX;
|
|
214
178
|
latLen = maxY - minY;
|
|
215
179
|
bounds = [minX, minY, maxX, maxY];
|
|
216
180
|
}
|
|
217
|
-
|
|
218
181
|
this.styleAttributeService.registerStyleAttribute({
|
|
219
182
|
name: 'uvs',
|
|
220
183
|
type: AttributeType.Attribute,
|
|
@@ -229,9 +192,9 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
229
192
|
size: 3,
|
|
230
193
|
update: function update(feature, featureIdx, vertex) {
|
|
231
194
|
var lng = vertex[0];
|
|
232
|
-
var lat = vertex[1];
|
|
195
|
+
var lat = vertex[1];
|
|
196
|
+
// console.log((lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4])
|
|
233
197
|
// 临时 兼容高德V2
|
|
234
|
-
|
|
235
198
|
return [(lng - bounds[0]) / lngLen, (lat - bounds[1]) / latLen, vertex[4]];
|
|
236
199
|
}
|
|
237
200
|
}
|
|
@@ -266,7 +229,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
266
229
|
size: 1,
|
|
267
230
|
update: function update(feature) {
|
|
268
231
|
var _feature$size = feature.size,
|
|
269
|
-
|
|
232
|
+
size = _feature$size === void 0 ? 10 : _feature$size;
|
|
270
233
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
271
234
|
}
|
|
272
235
|
}
|
|
@@ -277,65 +240,54 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
277
240
|
value: function () {
|
|
278
241
|
var _loadTexture = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee3() {
|
|
279
242
|
var _this = this;
|
|
280
|
-
|
|
281
243
|
var _ref3, mapTexture, createTexture2D;
|
|
282
|
-
|
|
283
244
|
return _regeneratorRuntime.wrap(function _callee3$(_context3) {
|
|
284
|
-
while (1) {
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
case 5:
|
|
323
|
-
case "end":
|
|
324
|
-
return _context3.stop();
|
|
325
|
-
}
|
|
245
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
246
|
+
case 0:
|
|
247
|
+
_ref3 = this.layer.getLayerConfig(), mapTexture = _ref3.mapTexture;
|
|
248
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
249
|
+
this.texture = createTexture2D({
|
|
250
|
+
height: 0,
|
|
251
|
+
width: 0
|
|
252
|
+
});
|
|
253
|
+
if (!mapTexture) {
|
|
254
|
+
_context3.next = 5;
|
|
255
|
+
break;
|
|
256
|
+
}
|
|
257
|
+
return _context3.abrupt("return", new Promise(function (resolve, reject) {
|
|
258
|
+
var image = new Image();
|
|
259
|
+
image.crossOrigin = 'anonymous';
|
|
260
|
+
image.src = mapTexture;
|
|
261
|
+
image.onload = function () {
|
|
262
|
+
_this.texture = createTexture2D({
|
|
263
|
+
data: image,
|
|
264
|
+
width: image.width,
|
|
265
|
+
height: image.height,
|
|
266
|
+
wrapS: gl.CLAMP_TO_EDGE,
|
|
267
|
+
wrapT: gl.CLAMP_TO_EDGE,
|
|
268
|
+
min: gl.LINEAR,
|
|
269
|
+
mag: gl.LINEAR
|
|
270
|
+
});
|
|
271
|
+
return resolve(null);
|
|
272
|
+
// this.layerService.reRender();
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
image.onerror = function () {
|
|
276
|
+
reject(new Error('image load error'));
|
|
277
|
+
};
|
|
278
|
+
}));
|
|
279
|
+
case 5:
|
|
280
|
+
case "end":
|
|
281
|
+
return _context3.stop();
|
|
326
282
|
}
|
|
327
283
|
}, _callee3, this);
|
|
328
284
|
}));
|
|
329
|
-
|
|
330
285
|
function loadTexture() {
|
|
331
286
|
return _loadTexture.apply(this, arguments);
|
|
332
287
|
}
|
|
333
|
-
|
|
334
288
|
return loadTexture;
|
|
335
289
|
}()
|
|
336
290
|
}]);
|
|
337
|
-
|
|
338
291
|
return ExtrudeModel;
|
|
339
292
|
}(BaseModel);
|
|
340
|
-
|
|
341
293
|
export { ExtrudeModel as default };
|