@antv/l7-layers 2.15.1 → 2.15.3
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 +320 -484
- package/es/core/BaseModel.js +97 -126
- 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 +10 -31
- package/es/core/triangulation.js +54 -114
- 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 +91 -146
- 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 -34
- package/es/line/models/arc.js +66 -118
- package/es/line/models/arc_3d.js +60 -108
- package/es/line/models/earthArc_3d.js +63 -111
- package/es/line/models/great_circle.js +56 -100
- package/es/line/models/half.js +46 -77
- package/es/line/models/line.js +94 -148
- package/es/line/models/linearline.js +45 -80
- package/es/line/models/simpleLine.js +41 -74
- package/es/line/models/wall.js +52 -92
- package/es/mask/index.js +9 -28
- package/es/mask/models/fill.js +29 -54
- package/es/plugins/DataMappingPlugin.js +80 -117
- 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 +67 -104
- package/es/plugins/LayerStylePlugin.js +3 -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 -77
- package/es/point/models/earthExtrude.js +61 -102
- package/es/point/models/earthFill.js +57 -87
- package/es/point/models/extrude.js +60 -101
- package/es/point/models/fill.js +70 -100
- package/es/point/models/fillmage.js +63 -107
- package/es/point/models/image.js +48 -88
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +30 -54
- package/es/point/models/radar.js +40 -64
- package/es/point/models/simplePoint.js +41 -69
- package/es/point/models/text.d.ts +2 -0
- package/es/point/models/text.js +214 -295
- package/es/point/shape/extrude.js +4 -13
- package/es/polygon/index.js +11 -40
- package/es/polygon/models/extrude.js +48 -92
- package/es/polygon/models/fill.js +54 -88
- 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 +30 -52
- package/es/tile/service/TilePickService.js +26 -40
- package/es/tile/service/TileSourceService.js +3 -7
- package/es/tile/tileFactory/DebugTile.js +28 -45
- 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/dataMappingStyle.js +8 -18
- 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 +320 -478
- package/lib/core/BaseModel.js +97 -139
- 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 +10 -54
- package/lib/core/triangulation.js +53 -153
- 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 +91 -162
- 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 +64 -128
- package/lib/line/models/arc_3d.js +58 -119
- package/lib/line/models/earthArc_3d.js +61 -122
- package/lib/line/models/great_circle.js +56 -111
- package/lib/line/models/half.js +46 -87
- package/lib/line/models/index.js +0 -11
- package/lib/line/models/line.js +92 -156
- package/lib/line/models/linearline.js +45 -92
- package/lib/line/models/simpleLine.js +41 -84
- package/lib/line/models/wall.js +52 -103
- 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 +80 -128
- 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 +68 -113
- package/lib/plugins/LayerStylePlugin.js +4 -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 +61 -113
- package/lib/point/models/earthFill.js +57 -117
- package/lib/point/models/extrude.js +60 -111
- package/lib/point/models/fill.js +68 -109
- package/lib/point/models/fillmage.js +61 -115
- package/lib/point/models/image.js +48 -98
- package/lib/point/models/index.js +1 -12
- package/lib/point/models/normal.js +30 -64
- package/lib/point/models/radar.js +40 -74
- package/lib/point/models/simplePoint.js +41 -79
- package/lib/point/models/text.js +214 -303
- package/lib/point/shape/extrude.js +4 -20
- package/lib/polygon/index.js +11 -48
- package/lib/polygon/models/extrude.js +48 -103
- package/lib/polygon/models/fill.js +54 -98
- 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 +30 -57
- 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 +28 -53
- 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/dataMappingStyle.js +8 -19
- package/lib/utils/extrude_polyline.js +101 -181
- package/lib/utils/grid-index.js +2 -28
- package/lib/utils/identityScale.js +0 -9
- package/lib/utils/layerData.js +30 -49
- package/lib/utils/multiPassRender.js +11 -16
- package/lib/utils/polylineNormal.js +31 -66
- package/lib/utils/simpleLine.js +2 -21
- package/lib/utils/stencil.js +0 -4
- package/lib/utils/symbol-layout.js +27 -55
- package/lib/wind/index.js +9 -37
- package/lib/wind/models/index.js +0 -3
- package/lib/wind/models/utils.js +26 -62
- package/lib/wind/models/wind.js +101 -157
- package/lib/wind/models/windRender.js +53 -71
- package/lib/wind/models/windShader.js +0 -1
- package/package.json +7 -7
package/es/Geometry/index.js
CHANGED
|
@@ -7,32 +7,21 @@ 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 GeometryModels from "./models";
|
|
17
|
-
|
|
18
14
|
var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
19
15
|
_inherits(GeometryLayer, _BaseLayer);
|
|
20
|
-
|
|
21
16
|
var _super = _createSuper(GeometryLayer);
|
|
22
|
-
|
|
23
17
|
function GeometryLayer() {
|
|
24
18
|
var _this;
|
|
25
|
-
|
|
26
19
|
_classCallCheck(this, GeometryLayer);
|
|
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", 'GeometryLayer');
|
|
35
|
-
|
|
36
25
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
37
26
|
data: [{
|
|
38
27
|
x: 0,
|
|
@@ -46,36 +35,29 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
46
35
|
}
|
|
47
36
|
}
|
|
48
37
|
});
|
|
49
|
-
|
|
50
38
|
return _this;
|
|
51
39
|
}
|
|
52
|
-
|
|
53
40
|
_createClass(GeometryLayer, [{
|
|
54
41
|
key: "buildModels",
|
|
55
42
|
value: function () {
|
|
56
43
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
57
44
|
var modelType;
|
|
58
45
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
59
|
-
while (1) {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
case "end":
|
|
69
|
-
return _context.stop();
|
|
70
|
-
}
|
|
46
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
|
+
case 0:
|
|
48
|
+
modelType = this.getModelType();
|
|
49
|
+
this.layerModel = new GeometryModels[modelType](this);
|
|
50
|
+
_context.next = 4;
|
|
51
|
+
return this.initLayerModels();
|
|
52
|
+
case 4:
|
|
53
|
+
case "end":
|
|
54
|
+
return _context.stop();
|
|
71
55
|
}
|
|
72
56
|
}, _callee, this);
|
|
73
57
|
}));
|
|
74
|
-
|
|
75
58
|
function buildModels() {
|
|
76
59
|
return _buildModels.apply(this, arguments);
|
|
77
60
|
}
|
|
78
|
-
|
|
79
61
|
return buildModels;
|
|
80
62
|
}()
|
|
81
63
|
}, {
|
|
@@ -93,10 +75,8 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
93
75
|
key: "getModelType",
|
|
94
76
|
value: function getModelType() {
|
|
95
77
|
var _shapeAttribute$scale;
|
|
96
|
-
|
|
97
78
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
98
79
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
99
|
-
|
|
100
80
|
if (shape === 'plane') {
|
|
101
81
|
return 'plane';
|
|
102
82
|
} else if (shape === 'sprite') {
|
|
@@ -108,8 +88,6 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
108
88
|
}
|
|
109
89
|
}
|
|
110
90
|
}]);
|
|
111
|
-
|
|
112
91
|
return GeometryLayer;
|
|
113
92
|
}(BaseLayer);
|
|
114
|
-
|
|
115
93
|
export { GeometryLayer as default };
|
|
@@ -8,64 +8,49 @@ import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConst
|
|
|
8
8
|
import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf";
|
|
9
9
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
10
10
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
11
|
-
|
|
12
11
|
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); }; }
|
|
13
|
-
|
|
14
12
|
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; } }
|
|
15
|
-
|
|
16
13
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
17
14
|
import BaseModel from "../../core/BaseModel";
|
|
18
|
-
|
|
19
15
|
/* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
|
|
20
16
|
var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"picking\"\nvoid main() {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
21
|
-
|
|
22
17
|
/* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
|
|
23
18
|
var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform float u_raisingHeight: 0.0;\nuniform mat4 u_Mvp;\nuniform float u_opacity;\nuniform vec2 u_size: [1.0, 1.0];\nuniform mat2 u_RotateMatrix;\n\nattribute vec3 a_Extrude;\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n vec3 extrude = a_Extrude;\n v_Color = a_Color;\n v_uv = a_Uv;\n\n float raiseHeight = 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 raiseHeight = u_raisingHeight * mapboxZoomScale;\n }\n\n // \u8BA1\u7B97\u7ECF\u7EAC\u5EA6\u70B9\u4F4D\u5750\u6807\n vec4 project_pos = project_position(vec4(a_Position.xy, 0.0, 1.0));\n\n // \u8BA1\u7B97\u7ED5 z \u8F74\u65CB\u8F6C\u540E\u7684\u504F\u79FB\n vec2 offsetXY = project_pixel(u_RotateMatrix * vec2(extrude.x * u_size.x, 0.0));\n // \u7ED5 z \u8F74\u65CB\u8F6C\n float x = project_pos.x + offsetXY.x;\n float y = project_pos.y + offsetXY.y;\n // z \u8F74\u4E0D\u53C2\u4E0E\u65CB\u8F6C\n float z = project_pixel(extrude.y * u_size.y + raiseHeight);\n\n\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) { // gaode2.x\n // gl_Position = u_Mvp * (vec4(project_pos.xy, a_Position.z, 1.0));\n gl_Position = u_Mvp * (vec4(x, y, z, 1.0));\n } else {\n gl_Position = project_common_position_to_clipspace(vec4(x , y, z , 1.0));\n }\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
24
|
-
|
|
25
19
|
var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
20
|
_inherits(BillBoardModel, _BaseModel);
|
|
27
|
-
|
|
28
21
|
var _super = _createSuper(BillBoardModel);
|
|
29
|
-
|
|
30
22
|
function BillBoardModel() {
|
|
31
23
|
var _this;
|
|
32
|
-
|
|
33
24
|
_classCallCheck(this, BillBoardModel);
|
|
34
|
-
|
|
35
25
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
26
|
args[_key] = arguments[_key];
|
|
37
27
|
}
|
|
38
|
-
|
|
39
28
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
-
|
|
41
29
|
_defineProperty(_assertThisInitialized(_this), "radian", 0);
|
|
42
|
-
|
|
43
30
|
_defineProperty(_assertThisInitialized(_this), "planeGeometryTriangulation", function () {
|
|
44
31
|
var _ref = _this.layer.getLayerConfig(),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
32
|
+
_ref$center = _ref.center,
|
|
33
|
+
center = _ref$center === void 0 ? [120, 30] : _ref$center;
|
|
48
34
|
return {
|
|
49
35
|
size: 4,
|
|
50
36
|
indices: [0, 1, 2, 2, 3, 0],
|
|
51
37
|
vertices: [].concat(_toConsumableArray(center), [1, 1], _toConsumableArray(center), [0, 1], _toConsumableArray(center), [0, 0], _toConsumableArray(center), [1, 0])
|
|
52
38
|
};
|
|
53
39
|
});
|
|
54
|
-
|
|
55
40
|
return _this;
|
|
56
41
|
}
|
|
57
|
-
|
|
58
42
|
_createClass(BillBoardModel, [{
|
|
59
43
|
key: "getUninforms",
|
|
60
44
|
value: function getUninforms() {
|
|
61
45
|
var _ref2 = this.layer.getLayerConfig(),
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
46
|
+
opacity = _ref2.opacity,
|
|
47
|
+
_ref2$width = _ref2.width,
|
|
48
|
+
width = _ref2$width === void 0 ? 1 : _ref2$width,
|
|
49
|
+
_ref2$height = _ref2.height,
|
|
50
|
+
height = _ref2$height === void 0 ? 1 : _ref2$height,
|
|
51
|
+
_ref2$raisingHeight = _ref2.raisingHeight,
|
|
52
|
+
raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight;
|
|
53
|
+
|
|
69
54
|
/**
|
|
70
55
|
* rotateFlag
|
|
71
56
|
* DEFAULT 1
|
|
@@ -73,19 +58,16 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
73
58
|
* GAODE2.x -1
|
|
74
59
|
* GAODE1.x -1
|
|
75
60
|
*/
|
|
76
|
-
|
|
77
|
-
|
|
78
61
|
var rotateFlag = 1;
|
|
79
|
-
|
|
80
62
|
if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
|
|
81
63
|
rotateFlag = -1;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
|
|
64
|
+
}
|
|
65
|
+
// 控制图标的旋转角度(绕 Z 轴旋转)
|
|
85
66
|
this.radian = rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
|
|
86
67
|
return {
|
|
87
68
|
u_raisingHeight: Number(raisingHeight),
|
|
88
|
-
u_RotateMatrix: new Float32Array([
|
|
69
|
+
u_RotateMatrix: new Float32Array([
|
|
70
|
+
// z
|
|
89
71
|
Math.cos(this.radian), Math.sin(this.radian), -Math.sin(this.radian), Math.cos(this.radian)]),
|
|
90
72
|
u_opacity: opacity || 1,
|
|
91
73
|
u_texture: this.texture,
|
|
@@ -96,7 +78,6 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
96
78
|
key: "clearModels",
|
|
97
79
|
value: function clearModels() {
|
|
98
80
|
var _this$texture;
|
|
99
|
-
|
|
100
81
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
101
82
|
}
|
|
102
83
|
}, {
|
|
@@ -104,50 +85,41 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
104
85
|
value: function () {
|
|
105
86
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
106
87
|
var _ref3, drawCanvas, createTexture2D, model;
|
|
107
|
-
|
|
108
88
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
109
|
-
while (1) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
89
|
+
while (1) switch (_context.prev = _context.next) {
|
|
90
|
+
case 0:
|
|
91
|
+
_ref3 = this.layer.getLayerConfig(), drawCanvas = _ref3.drawCanvas;
|
|
92
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
93
|
+
this.texture = createTexture2D({
|
|
94
|
+
height: 0,
|
|
95
|
+
width: 0
|
|
96
|
+
});
|
|
97
|
+
if (drawCanvas) {
|
|
98
|
+
this.updateTexture(drawCanvas);
|
|
99
|
+
}
|
|
100
|
+
_context.next = 6;
|
|
101
|
+
return this.layer.buildLayerModel({
|
|
102
|
+
moduleName: 'geometryBillboard',
|
|
103
|
+
vertexShader: planeVert,
|
|
104
|
+
fragmentShader: planeFrag,
|
|
105
|
+
triangulation: this.planeGeometryTriangulation,
|
|
106
|
+
primitive: gl.TRIANGLES,
|
|
107
|
+
depth: {
|
|
108
|
+
enable: true
|
|
121
109
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
primitive: gl.TRIANGLES,
|
|
130
|
-
depth: {
|
|
131
|
-
enable: true
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
case 6:
|
|
136
|
-
model = _context.sent;
|
|
137
|
-
return _context.abrupt("return", [model]);
|
|
138
|
-
|
|
139
|
-
case 8:
|
|
140
|
-
case "end":
|
|
141
|
-
return _context.stop();
|
|
142
|
-
}
|
|
110
|
+
});
|
|
111
|
+
case 6:
|
|
112
|
+
model = _context.sent;
|
|
113
|
+
return _context.abrupt("return", [model]);
|
|
114
|
+
case 8:
|
|
115
|
+
case "end":
|
|
116
|
+
return _context.stop();
|
|
143
117
|
}
|
|
144
118
|
}, _callee, this);
|
|
145
119
|
}));
|
|
146
|
-
|
|
147
120
|
function initModels() {
|
|
148
121
|
return _initModels.apply(this, arguments);
|
|
149
122
|
}
|
|
150
|
-
|
|
151
123
|
return initModels;
|
|
152
124
|
}()
|
|
153
125
|
}, {
|
|
@@ -155,41 +127,33 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
155
127
|
value: function () {
|
|
156
128
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
157
129
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
158
|
-
while (1) {
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
case "end":
|
|
165
|
-
return _context2.stop();
|
|
166
|
-
}
|
|
130
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
131
|
+
case 0:
|
|
132
|
+
return _context2.abrupt("return", this.initModels());
|
|
133
|
+
case 1:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context2.stop();
|
|
167
136
|
}
|
|
168
137
|
}, _callee2, this);
|
|
169
138
|
}));
|
|
170
|
-
|
|
171
139
|
function buildModels() {
|
|
172
140
|
return _buildModels.apply(this, arguments);
|
|
173
141
|
}
|
|
174
|
-
|
|
175
142
|
return buildModels;
|
|
176
143
|
}()
|
|
177
144
|
}, {
|
|
178
145
|
key: "updateTexture",
|
|
179
146
|
value: function updateTexture(drawCanvas) {
|
|
180
147
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
181
|
-
|
|
182
148
|
var _ref4 = this.layer.getLayerConfig(),
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
149
|
+
_ref4$canvasWidth = _ref4.canvasWidth,
|
|
150
|
+
canvasWidth = _ref4$canvasWidth === void 0 ? 1 : _ref4$canvasWidth,
|
|
151
|
+
_ref4$canvasHeight = _ref4.canvasHeight,
|
|
152
|
+
canvasHeight = _ref4$canvasHeight === void 0 ? 1 : _ref4$canvasHeight;
|
|
188
153
|
var canvas = document.createElement('canvas');
|
|
189
154
|
canvas.width = canvasWidth;
|
|
190
155
|
canvas.height = canvasHeight;
|
|
191
156
|
var ctx = canvas.getContext('2d');
|
|
192
|
-
|
|
193
157
|
if (ctx) {
|
|
194
158
|
drawCanvas(canvas);
|
|
195
159
|
this.texture = createTexture2D({
|
|
@@ -241,8 +205,6 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
241
205
|
});
|
|
242
206
|
}
|
|
243
207
|
}]);
|
|
244
|
-
|
|
245
208
|
return BillBoardModel;
|
|
246
209
|
}(BaseModel);
|
|
247
|
-
|
|
248
210
|
export { BillBoardModel as default };
|