@antv/l7-layers 2.17.3 → 2.17.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Geometry/index.js +31 -9
- package/es/Geometry/models/billboard.js +89 -51
- package/es/Geometry/models/plane.js +143 -81
- package/es/Geometry/models/sprite.js +118 -60
- package/es/canvas/index.js +33 -10
- package/es/canvas/models/canvas.js +97 -41
- package/es/citybuliding/building.js +27 -8
- package/es/citybuliding/models/build.js +82 -57
- package/es/core/BaseLayer.js +478 -313
- package/es/core/BaseModel.js +80 -51
- package/es/core/CommonStyleAttribute.js +5 -2
- package/es/core/LayerPickService.js +32 -21
- package/es/core/TextureService.js +13 -0
- package/es/core/interface.js +24 -17
- package/es/core/shape/Path.js +20 -13
- package/es/core/shape/extrude.js +39 -27
- package/es/core/triangulation.js +136 -99
- package/es/earth/index.js +33 -9
- package/es/earth/models/atmosphere.js +54 -30
- package/es/earth/models/base.js +85 -47
- package/es/earth/models/bloomsphere.js +54 -30
- package/es/earth/utils.js +13 -9
- package/es/heatmap/index.js +40 -10
- package/es/heatmap/models/grid.js +52 -28
- package/es/heatmap/models/grid3d.js +52 -28
- package/es/heatmap/models/heatmap.js +149 -92
- package/es/heatmap/models/hexagon.js +52 -28
- package/es/heatmap/triangulation.js +4 -0
- package/es/image/index.js +28 -9
- package/es/image/models/image.js +100 -66
- package/es/index.js +17 -9
- package/es/line/index.js +35 -9
- package/es/line/models/arc.js +112 -63
- package/es/line/models/arc_3d.js +102 -58
- package/es/line/models/earthArc_3d.js +105 -60
- package/es/line/models/flow.js +60 -36
- package/es/line/models/great_circle.js +94 -53
- package/es/line/models/line.js +136 -85
- package/es/line/models/linearline.js +74 -42
- package/es/line/models/simpleLine.js +67 -38
- package/es/line/models/wall.js +92 -52
- package/es/mask/index.js +28 -9
- package/es/mask/models/fill.js +54 -29
- package/es/plugins/DataMappingPlugin.js +114 -78
- package/es/plugins/DataSourcePlugin.js +68 -45
- package/es/plugins/FeatureScalePlugin.js +122 -67
- package/es/plugins/LayerAnimateStylePlugin.js +5 -0
- package/es/plugins/LayerMaskPlugin.js +11 -3
- package/es/plugins/LayerModelPlugin.js +108 -69
- package/es/plugins/LayerStylePlugin.js +9 -3
- package/es/plugins/LightingPlugin.js +18 -12
- package/es/plugins/MultiPassRendererPlugin.js +16 -11
- package/es/plugins/PixelPickingPlugin.js +21 -12
- package/es/plugins/RegisterStyleAttributePlugin.js +12 -5
- package/es/plugins/ShaderUniformPlugin.js +27 -13
- package/es/plugins/UpdateModelPlugin.js +5 -0
- package/es/plugins/UpdateStyleAttributePlugin.js +11 -5
- package/es/point/index.js +78 -26
- package/es/point/models/earthExtrude.js +95 -58
- package/es/point/models/earthFill.js +80 -52
- package/es/point/models/extrude.js +94 -57
- package/es/point/models/fill.js +81 -56
- package/es/point/models/fillmage.js +100 -60
- package/es/point/models/image.js +83 -47
- package/es/point/models/index.js +2 -2
- package/es/point/models/normal.js +54 -30
- package/es/point/models/radar.js +63 -38
- package/es/point/models/simplePoint.js +62 -38
- package/es/point/models/text.js +296 -199
- package/es/point/shape/extrude.js +13 -4
- package/es/polygon/index.js +41 -11
- package/es/polygon/models/extrude.js +135 -87
- package/es/polygon/models/fill.js +79 -50
- package/es/polygon/models/index.js +2 -3
- package/es/polygon/models/ocean.js +76 -42
- package/es/polygon/models/water.js +71 -37
- package/es/raster/buffers/triangulation.js +4 -2
- package/es/raster/index.js +32 -9
- package/es/raster/models/raster.js +116 -80
- package/es/raster/models/rasterRgb.js +127 -84
- package/es/raster/models/rasterTerrainRgb.js +84 -56
- package/es/tile/interaction/getRasterData.js +20 -14
- package/es/tile/interaction/utils.js +9 -7
- package/es/tile/manager/base.js +96 -63
- package/es/tile/service/TileLayerService.js +55 -33
- package/es/tile/service/TilePickService.js +40 -26
- package/es/tile/service/TileSourceService.js +7 -3
- package/es/tile/tileFactory/DebugTile.js +46 -29
- package/es/tile/tileFactory/ImageTile.js +38 -20
- package/es/tile/tileFactory/MaskTile.js +43 -22
- package/es/tile/tileFactory/RasterRGBTile.js +42 -22
- package/es/tile/tileFactory/RasterTerrainRGBTile.js +38 -20
- package/es/tile/tileFactory/RasterTile.js +53 -30
- package/es/tile/tileFactory/Tile.js +97 -63
- package/es/tile/tileFactory/VectorTile.js +68 -41
- package/es/tile/tileFactory/index.js +11 -0
- package/es/tile/tileFactory/layers/TileDebugLayer.js +27 -6
- package/es/tile/tileFactory/util.js +3 -0
- package/es/tile/tileLayer/BaseLayer.js +146 -105
- package/es/tile/utils.js +1 -1
- package/es/utils/blend.js +2 -0
- package/es/utils/collision-index.js +16 -9
- package/es/utils/extrude_polyline.js +149 -101
- package/es/utils/grid-index.js +27 -2
- package/es/utils/identityScale.js +8 -0
- package/es/utils/layerData.js +44 -30
- package/es/utils/multiPassRender.js +13 -11
- package/es/utils/polylineNormal.js +37 -31
- package/es/utils/simpleLine.js +16 -2
- package/es/utils/stencil.js +3 -2
- package/es/utils/symbol-layout.js +53 -27
- package/es/wind/index.js +29 -9
- package/es/wind/models/utils.js +51 -26
- package/es/wind/models/wind.js +147 -101
- package/es/wind/models/windRender.js +66 -53
- package/lib/Geometry/index.js +38 -9
- package/lib/Geometry/models/billboard.js +97 -51
- package/lib/Geometry/models/index.js +5 -0
- package/lib/Geometry/models/plane.js +151 -79
- package/lib/Geometry/models/sprite.js +127 -60
- package/lib/canvas/index.js +40 -10
- package/lib/canvas/models/canvas.js +101 -41
- package/lib/canvas/models/index.js +3 -0
- package/lib/citybuliding/building.js +35 -8
- package/lib/citybuliding/models/build.js +92 -57
- package/lib/core/BaseLayer.js +469 -313
- package/lib/core/BaseModel.js +90 -51
- package/lib/core/CommonStyleAttribute.js +7 -2
- package/lib/core/LayerPickService.js +37 -21
- package/lib/core/TextureService.js +16 -0
- package/lib/core/interface.js +31 -21
- package/lib/core/schema.js +1 -0
- package/lib/core/shape/Path.js +31 -14
- package/lib/core/shape/extrude.js +62 -27
- package/lib/core/triangulation.js +177 -98
- package/lib/earth/index.js +43 -9
- package/lib/earth/models/atmosphere.js +63 -30
- package/lib/earth/models/base.js +90 -47
- package/lib/earth/models/bloomsphere.js +63 -30
- package/lib/earth/utils.js +31 -7
- package/lib/heatmap/index.js +48 -10
- package/lib/heatmap/models/grid.js +60 -28
- package/lib/heatmap/models/grid3d.js +60 -28
- package/lib/heatmap/models/heatmap.js +166 -92
- package/lib/heatmap/models/hexagon.js +60 -28
- package/lib/heatmap/models/index.js +6 -0
- package/lib/heatmap/triangulation.js +5 -0
- package/lib/image/index.js +36 -9
- package/lib/image/models/image.js +109 -66
- package/lib/image/models/index.js +3 -0
- package/lib/index.js +61 -7
- package/lib/line/index.js +40 -9
- package/lib/line/models/arc.js +122 -61
- package/lib/line/models/arc_3d.js +113 -56
- package/lib/line/models/earthArc_3d.js +115 -58
- package/lib/line/models/flow.js +70 -36
- package/lib/line/models/great_circle.js +104 -53
- package/lib/line/models/index.js +11 -0
- package/lib/line/models/line.js +144 -83
- package/lib/line/models/linearline.js +86 -42
- package/lib/line/models/simpleLine.js +77 -38
- package/lib/line/models/wall.js +103 -52
- package/lib/mask/index.js +36 -9
- package/lib/mask/models/fill.js +63 -29
- package/lib/mask/models/index.js +3 -0
- package/lib/plugins/DataMappingPlugin.js +125 -78
- package/lib/plugins/DataSourcePlugin.js +76 -45
- package/lib/plugins/FeatureScalePlugin.js +138 -67
- package/lib/plugins/LayerAnimateStylePlugin.js +10 -0
- package/lib/plugins/LayerMaskPlugin.js +17 -4
- package/lib/plugins/LayerModelPlugin.js +117 -70
- package/lib/plugins/LayerStylePlugin.js +14 -4
- package/lib/plugins/LightingPlugin.js +25 -12
- package/lib/plugins/MultiPassRendererPlugin.js +22 -11
- package/lib/plugins/PixelPickingPlugin.js +27 -12
- package/lib/plugins/RegisterStyleAttributePlugin.js +19 -5
- package/lib/plugins/ShaderUniformPlugin.js +34 -13
- package/lib/plugins/UpdateModelPlugin.js +10 -1
- package/lib/plugins/UpdateStyleAttributePlugin.js +16 -5
- package/lib/point/index.js +83 -26
- package/lib/point/models/earthExtrude.js +106 -58
- package/lib/point/models/earthFill.js +110 -52
- package/lib/point/models/extrude.js +103 -57
- package/lib/point/models/fill.js +90 -54
- package/lib/point/models/fillmage.js +107 -58
- package/lib/point/models/image.js +92 -47
- package/lib/point/models/index.js +12 -1
- package/lib/point/models/normal.js +64 -30
- package/lib/point/models/radar.js +72 -38
- package/lib/point/models/simplePoint.js +72 -38
- package/lib/point/models/text.js +305 -199
- package/lib/point/shape/extrude.js +20 -4
- package/lib/polygon/index.js +48 -11
- package/lib/polygon/models/extrude.js +146 -87
- package/lib/polygon/models/fill.js +89 -50
- package/lib/polygon/models/index.js +14 -2
- package/lib/polygon/models/ocean.js +88 -42
- package/lib/polygon/models/water.js +82 -37
- package/lib/raster/buffers/triangulation.js +7 -3
- package/lib/raster/index.js +40 -9
- package/lib/raster/models/index.js +5 -0
- package/lib/raster/models/raster.js +125 -80
- package/lib/raster/models/rasterRgb.js +139 -84
- package/lib/raster/models/rasterTerrainRgb.js +93 -56
- package/lib/tile/interaction/getRasterData.js +25 -14
- package/lib/tile/interaction/utils.js +19 -7
- package/lib/tile/manager/base.js +104 -63
- package/lib/tile/service/TileLayerService.js +60 -33
- package/lib/tile/service/TilePickService.js +48 -26
- package/lib/tile/service/TileSourceService.js +16 -2
- package/lib/tile/style/utils.js +3 -0
- package/lib/tile/tileFactory/DebugTile.js +54 -29
- package/lib/tile/tileFactory/ImageTile.js +46 -20
- package/lib/tile/tileFactory/MaskTile.js +51 -22
- package/lib/tile/tileFactory/RasterRGBTile.js +50 -22
- package/lib/tile/tileFactory/RasterTerrainRGBTile.js +46 -20
- package/lib/tile/tileFactory/RasterTile.js +63 -30
- package/lib/tile/tileFactory/Tile.js +102 -63
- package/lib/tile/tileFactory/VectorTile.js +76 -41
- package/lib/tile/tileFactory/index.js +25 -0
- package/lib/tile/tileFactory/layers/TileDebugLayer.js +32 -6
- package/lib/tile/tileFactory/util.js +9 -0
- package/lib/tile/tileLayer/BaseLayer.js +153 -105
- package/lib/tile/utils.js +5 -1
- package/lib/utils/blend.js +5 -0
- package/lib/utils/collision-index.js +25 -9
- package/lib/utils/extrude_polyline.js +181 -101
- package/lib/utils/grid-index.js +28 -2
- package/lib/utils/identityScale.js +9 -0
- package/lib/utils/layerData.js +49 -30
- package/lib/utils/multiPassRender.js +16 -11
- package/lib/utils/polylineNormal.js +66 -31
- package/lib/utils/simpleLine.js +21 -2
- package/lib/utils/stencil.js +4 -0
- package/lib/utils/symbol-layout.js +55 -27
- package/lib/wind/index.js +37 -9
- package/lib/wind/models/index.js +3 -0
- package/lib/wind/models/utils.js +62 -26
- package/lib/wind/models/wind.js +157 -101
- package/lib/wind/models/windRender.js +71 -53
- package/lib/wind/models/windShader.js +1 -0
- package/package.json +7 -7
package/es/Geometry/index.js
CHANGED
|
@@ -7,21 +7,32 @@ 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
|
+
|
|
10
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); }; }
|
|
12
|
+
|
|
11
13
|
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
|
+
|
|
12
15
|
import BaseLayer from "../core/BaseLayer";
|
|
13
16
|
import GeometryModels from "./models";
|
|
17
|
+
|
|
14
18
|
var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
15
19
|
_inherits(GeometryLayer, _BaseLayer);
|
|
20
|
+
|
|
16
21
|
var _super = _createSuper(GeometryLayer);
|
|
22
|
+
|
|
17
23
|
function GeometryLayer() {
|
|
18
24
|
var _this;
|
|
25
|
+
|
|
19
26
|
_classCallCheck(this, GeometryLayer);
|
|
27
|
+
|
|
20
28
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
21
29
|
args[_key] = arguments[_key];
|
|
22
30
|
}
|
|
31
|
+
|
|
23
32
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
33
|
+
|
|
24
34
|
_defineProperty(_assertThisInitialized(_this), "type", 'GeometryLayer');
|
|
35
|
+
|
|
25
36
|
_defineProperty(_assertThisInitialized(_this), "defaultSourceConfig", {
|
|
26
37
|
data: [{
|
|
27
38
|
x: 0,
|
|
@@ -35,29 +46,36 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
});
|
|
49
|
+
|
|
38
50
|
return _this;
|
|
39
51
|
}
|
|
52
|
+
|
|
40
53
|
_createClass(GeometryLayer, [{
|
|
41
54
|
key: "buildModels",
|
|
42
55
|
value: function () {
|
|
43
56
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
44
57
|
var modelType;
|
|
45
58
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
46
|
-
while (1)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
59
|
+
while (1) {
|
|
60
|
+
switch (_context.prev = _context.next) {
|
|
61
|
+
case 0:
|
|
62
|
+
modelType = this.getModelType();
|
|
63
|
+
this.layerModel = new GeometryModels[modelType](this);
|
|
64
|
+
_context.next = 4;
|
|
65
|
+
return this.initLayerModels();
|
|
66
|
+
|
|
67
|
+
case 4:
|
|
68
|
+
case "end":
|
|
69
|
+
return _context.stop();
|
|
70
|
+
}
|
|
55
71
|
}
|
|
56
72
|
}, _callee, this);
|
|
57
73
|
}));
|
|
74
|
+
|
|
58
75
|
function buildModels() {
|
|
59
76
|
return _buildModels.apply(this, arguments);
|
|
60
77
|
}
|
|
78
|
+
|
|
61
79
|
return buildModels;
|
|
62
80
|
}()
|
|
63
81
|
}, {
|
|
@@ -75,8 +93,10 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
75
93
|
key: "getModelType",
|
|
76
94
|
value: function getModelType() {
|
|
77
95
|
var _shapeAttribute$scale;
|
|
96
|
+
|
|
78
97
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
79
98
|
var shape = shapeAttribute === null || shapeAttribute === void 0 ? void 0 : (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
99
|
+
|
|
80
100
|
if (shape === 'plane') {
|
|
81
101
|
return 'plane';
|
|
82
102
|
} else if (shape === 'sprite') {
|
|
@@ -88,6 +108,8 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
88
108
|
}
|
|
89
109
|
}
|
|
90
110
|
}]);
|
|
111
|
+
|
|
91
112
|
return GeometryLayer;
|
|
92
113
|
}(BaseLayer);
|
|
114
|
+
|
|
93
115
|
export { GeometryLayer as default };
|
|
@@ -8,49 +8,64 @@ 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
|
+
|
|
11
12
|
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
|
+
|
|
12
14
|
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
|
+
|
|
13
16
|
import { AttributeType, gl } from '@antv/l7-core';
|
|
14
17
|
import BaseModel from "../../core/BaseModel";
|
|
18
|
+
|
|
15
19
|
/* babel-plugin-inline-import '../shaders/billboard_frag.glsl' */
|
|
16
20
|
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
|
+
|
|
17
22
|
/* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
|
|
18
23
|
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
|
+
|
|
19
25
|
var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
20
26
|
_inherits(BillBoardModel, _BaseModel);
|
|
27
|
+
|
|
21
28
|
var _super = _createSuper(BillBoardModel);
|
|
29
|
+
|
|
22
30
|
function BillBoardModel() {
|
|
23
31
|
var _this;
|
|
32
|
+
|
|
24
33
|
_classCallCheck(this, BillBoardModel);
|
|
34
|
+
|
|
25
35
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
26
36
|
args[_key] = arguments[_key];
|
|
27
37
|
}
|
|
38
|
+
|
|
28
39
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
40
|
+
|
|
29
41
|
_defineProperty(_assertThisInitialized(_this), "radian", 0);
|
|
42
|
+
|
|
30
43
|
_defineProperty(_assertThisInitialized(_this), "planeGeometryTriangulation", function () {
|
|
31
44
|
var _ref = _this.layer.getLayerConfig(),
|
|
32
|
-
|
|
33
|
-
|
|
45
|
+
_ref$center = _ref.center,
|
|
46
|
+
center = _ref$center === void 0 ? [120, 30] : _ref$center;
|
|
47
|
+
|
|
34
48
|
return {
|
|
35
49
|
size: 4,
|
|
36
50
|
indices: [0, 1, 2, 2, 3, 0],
|
|
37
51
|
vertices: [].concat(_toConsumableArray(center), [1, 1], _toConsumableArray(center), [0, 1], _toConsumableArray(center), [0, 0], _toConsumableArray(center), [1, 0])
|
|
38
52
|
};
|
|
39
53
|
});
|
|
54
|
+
|
|
40
55
|
return _this;
|
|
41
56
|
}
|
|
57
|
+
|
|
42
58
|
_createClass(BillBoardModel, [{
|
|
43
59
|
key: "getUninforms",
|
|
44
60
|
value: function getUninforms() {
|
|
45
61
|
var _ref2 = this.layer.getLayerConfig(),
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
62
|
+
opacity = _ref2.opacity,
|
|
63
|
+
_ref2$width = _ref2.width,
|
|
64
|
+
width = _ref2$width === void 0 ? 1 : _ref2$width,
|
|
65
|
+
_ref2$height = _ref2.height,
|
|
66
|
+
height = _ref2$height === void 0 ? 1 : _ref2$height,
|
|
67
|
+
_ref2$raisingHeight = _ref2.raisingHeight,
|
|
68
|
+
raisingHeight = _ref2$raisingHeight === void 0 ? 0 : _ref2$raisingHeight;
|
|
54
69
|
/**
|
|
55
70
|
* rotateFlag
|
|
56
71
|
* DEFAULT 1
|
|
@@ -58,16 +73,19 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
58
73
|
* GAODE2.x -1
|
|
59
74
|
* GAODE1.x -1
|
|
60
75
|
*/
|
|
76
|
+
|
|
77
|
+
|
|
61
78
|
var rotateFlag = 1;
|
|
79
|
+
|
|
62
80
|
if (this.mapService.version === 'GAODE2.x' || this.mapService.version === 'GAODE1.x') {
|
|
63
81
|
rotateFlag = -1;
|
|
64
|
-
}
|
|
65
|
-
|
|
82
|
+
} // 控制图标的旋转角度(绕 Z 轴旋转)
|
|
83
|
+
|
|
84
|
+
|
|
66
85
|
this.radian = rotateFlag * Math.PI * (this.mapService.getRotation() % 360) / 180;
|
|
67
86
|
return {
|
|
68
87
|
u_raisingHeight: Number(raisingHeight),
|
|
69
|
-
u_RotateMatrix: new Float32Array([
|
|
70
|
-
// z
|
|
88
|
+
u_RotateMatrix: new Float32Array([// z
|
|
71
89
|
Math.cos(this.radian), Math.sin(this.radian), -Math.sin(this.radian), Math.cos(this.radian)]),
|
|
72
90
|
u_opacity: opacity || 1,
|
|
73
91
|
u_texture: this.texture,
|
|
@@ -78,6 +96,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
78
96
|
key: "clearModels",
|
|
79
97
|
value: function clearModels() {
|
|
80
98
|
var _this$texture;
|
|
99
|
+
|
|
81
100
|
(_this$texture = this.texture) === null || _this$texture === void 0 ? void 0 : _this$texture.destroy();
|
|
82
101
|
}
|
|
83
102
|
}, {
|
|
@@ -85,41 +104,50 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
85
104
|
value: function () {
|
|
86
105
|
var _initModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
87
106
|
var _ref3, drawCanvas, createTexture2D, model;
|
|
107
|
+
|
|
88
108
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
89
|
-
while (1)
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
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
|
|
109
|
+
while (1) {
|
|
110
|
+
switch (_context.prev = _context.next) {
|
|
111
|
+
case 0:
|
|
112
|
+
_ref3 = this.layer.getLayerConfig(), drawCanvas = _ref3.drawCanvas;
|
|
113
|
+
createTexture2D = this.rendererService.createTexture2D;
|
|
114
|
+
this.texture = createTexture2D({
|
|
115
|
+
height: 0,
|
|
116
|
+
width: 0
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
if (drawCanvas) {
|
|
120
|
+
this.updateTexture(drawCanvas);
|
|
109
121
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
122
|
+
|
|
123
|
+
_context.next = 6;
|
|
124
|
+
return this.layer.buildLayerModel({
|
|
125
|
+
moduleName: 'geometryBillboard',
|
|
126
|
+
vertexShader: planeVert,
|
|
127
|
+
fragmentShader: planeFrag,
|
|
128
|
+
triangulation: this.planeGeometryTriangulation,
|
|
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
|
+
}
|
|
117
143
|
}
|
|
118
144
|
}, _callee, this);
|
|
119
145
|
}));
|
|
146
|
+
|
|
120
147
|
function initModels() {
|
|
121
148
|
return _initModels.apply(this, arguments);
|
|
122
149
|
}
|
|
150
|
+
|
|
123
151
|
return initModels;
|
|
124
152
|
}()
|
|
125
153
|
}, {
|
|
@@ -127,33 +155,41 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
127
155
|
value: function () {
|
|
128
156
|
var _buildModels = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
129
157
|
return _regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
130
|
-
while (1)
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
158
|
+
while (1) {
|
|
159
|
+
switch (_context2.prev = _context2.next) {
|
|
160
|
+
case 0:
|
|
161
|
+
return _context2.abrupt("return", this.initModels());
|
|
162
|
+
|
|
163
|
+
case 1:
|
|
164
|
+
case "end":
|
|
165
|
+
return _context2.stop();
|
|
166
|
+
}
|
|
136
167
|
}
|
|
137
168
|
}, _callee2, this);
|
|
138
169
|
}));
|
|
170
|
+
|
|
139
171
|
function buildModels() {
|
|
140
172
|
return _buildModels.apply(this, arguments);
|
|
141
173
|
}
|
|
174
|
+
|
|
142
175
|
return buildModels;
|
|
143
176
|
}()
|
|
144
177
|
}, {
|
|
145
178
|
key: "updateTexture",
|
|
146
179
|
value: function updateTexture(drawCanvas) {
|
|
147
180
|
var createTexture2D = this.rendererService.createTexture2D;
|
|
181
|
+
|
|
148
182
|
var _ref4 = this.layer.getLayerConfig(),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
183
|
+
_ref4$canvasWidth = _ref4.canvasWidth,
|
|
184
|
+
canvasWidth = _ref4$canvasWidth === void 0 ? 1 : _ref4$canvasWidth,
|
|
185
|
+
_ref4$canvasHeight = _ref4.canvasHeight,
|
|
186
|
+
canvasHeight = _ref4$canvasHeight === void 0 ? 1 : _ref4$canvasHeight;
|
|
187
|
+
|
|
153
188
|
var canvas = document.createElement('canvas');
|
|
154
189
|
canvas.width = canvasWidth;
|
|
155
190
|
canvas.height = canvasHeight;
|
|
156
191
|
var ctx = canvas.getContext('2d');
|
|
192
|
+
|
|
157
193
|
if (ctx) {
|
|
158
194
|
drawCanvas(canvas);
|
|
159
195
|
this.texture = createTexture2D({
|
|
@@ -205,6 +241,8 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
205
241
|
});
|
|
206
242
|
}
|
|
207
243
|
}]);
|
|
244
|
+
|
|
208
245
|
return BillBoardModel;
|
|
209
246
|
}(BaseModel);
|
|
247
|
+
|
|
210
248
|
export { BillBoardModel as default };
|