@antv/l7-layers 2.17.2 → 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 +114 -64
- 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 +138 -86
- package/es/line/models/linearline.js +76 -43
- package/es/line/models/simpleLine.js +69 -39
- 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 +124 -62
- 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 +146 -84
- package/lib/line/models/linearline.js +88 -43
- package/lib/line/models/simpleLine.js +79 -39
- 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
|
@@ -1,85 +1,116 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
+
|
|
10
14
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
15
|
+
|
|
11
16
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
17
|
+
|
|
12
18
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
19
|
+
|
|
13
20
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
21
|
+
|
|
14
22
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
23
|
+
|
|
15
24
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
25
|
+
|
|
16
26
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
27
|
+
|
|
17
28
|
var _l7Core = require("@antv/l7-core");
|
|
29
|
+
|
|
18
30
|
var _l7Utils = require("@antv/l7-utils");
|
|
31
|
+
|
|
19
32
|
var _lodash = require("lodash");
|
|
33
|
+
|
|
20
34
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
35
|
+
|
|
21
36
|
var _triangulation = require("../../core/triangulation");
|
|
37
|
+
|
|
22
38
|
var _utils = require("../../earth/utils");
|
|
39
|
+
|
|
23
40
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
41
|
+
|
|
24
42
|
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; } }
|
|
43
|
+
|
|
25
44
|
/* babel-plugin-inline-import '../shaders/earth/extrude_frag.glsl' */
|
|
26
45
|
var pointExtrudeFrag = "varying vec4 v_color;\nuniform float u_opacity: 1.0;\n\nuniform float u_pickLight: 0.0;\n\n#pragma include \"picking\"\n\n\nuniform float u_linearColor: 0;\nuniform vec4 u_sourceColor;\nuniform vec4 u_targetColor;\n\nuniform float u_opacitylinear: 0.0;\nuniform float u_opacitylinear_dir: 1.0;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\nvoid main() {\n\n gl_FragColor = v_color;\n\n // \u5F00\u542F\u900F\u660E\u5EA6\u6E10\u53D8\n if(u_opacitylinear > 0.0) {\n gl_FragColor.a *= u_opacitylinear_dir > 0.0 ? (1.0 - v_barLinearZ): v_barLinearZ;\n }\n\n // picking\n if(u_pickLight > 0.0) {\n gl_FragColor = filterColorAlpha(gl_FragColor, v_lightWeight);\n } else {\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
46
|
+
|
|
27
47
|
/* babel-plugin-inline-import '../shaders/earth/extrude_vert.glsl' */
|
|
28
48
|
var pointExtrudeVert = "precision highp float;\n\n#define pi 3.1415926535\n#define ambientRatio 0.5\n#define diffuseRatio 0.3\n#define specularRatio 0.2\n\nattribute vec3 a_Position;\nattribute vec3 a_Pos;\nattribute vec4 a_Color;\nattribute vec3 a_Size;\nattribute vec3 a_Normal;\n\nuniform float u_heightfixed: 0.0; // \u9ED8\u8BA4\u4E0D\u56FA\u5B9A\nuniform float u_globel;\nuniform float u_r;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\nvarying vec4 v_color;\n\nuniform float u_opacity : 1;\nuniform float u_lightEnable: 1;\nvarying float v_lightWeight;\nvarying float v_barLinearZ;\n// \u7528\u4E8E\u5C06\u5728\u9876\u70B9\u7740\u8272\u5668\u4E2D\u8BA1\u7B97\u597D\u7684\u6837\u5F0F\u503C\u4F20\u9012\u7ED9\u7247\u5143\n\n\n#pragma include \"projection\"\n#pragma include \"light\"\n#pragma include \"picking\"\n\nfloat getYRadian(float x, float z) {\n if(x > 0.0 && z > 0.0) {\n return atan(x/z);\n } else if(x > 0.0 && z <= 0.0){\n return atan(-z/x) + pi/2.0;\n } else if(x <= 0.0 && z <= 0.0) {\n return pi + atan(x/z); //atan(x/z) + \n } else {\n return atan(z/-x) + pi*3.0/2.0;\n }\n}\n\nfloat getXRadian(float y, float r) {\n return atan(y/r);\n}\n\nvoid main() {\n\n \n float textureOffset = 0.0; // \u5728 cell \u4E2D\u53D6\u503C\u7684\u504F\u79FB\u91CF\n\n textureOffset = opacityAndOffset.g;\n // cal style mapping - \u6570\u636E\u7EB9\u7406\u6620\u5C04\u90E8\u5206\u7684\u8BA1\u7B97\n vec3 size = a_Size * a_Position;\n\n // a_Position.z \u662F\u5728\u6784\u5EFA\u7F51\u683C\u7684\u65F6\u5019\u4F20\u5165\u7684\u6807\u51C6\u503C 0 - 1\uFF0C\u5728\u63D2\u503C\u5668\u63D2\u503C\u53EF\u4EE5\u83B7\u53D6 0\uFF5E1 \u7EBF\u6027\u6E10\u53D8\u7684\u503C\n v_barLinearZ = a_Position.z;\n\n vec3 offset = size; // \u63A7\u5236\u5706\u67F1\u4F53\u7684\u5927\u5C0F - \u4ECE\u6807\u51C6\u5355\u4F4D\u5706\u67F1\u4F53\u8FDB\u884C\u504F\u79FB\n if(u_heightfixed < 1.0) { // \u5706\u67F1\u4F53\u4E0D\u56FA\u5B9A\u9AD8\u5EA6\n \n if (u_CoordinateSystem == COORDINATE_SYSTEM_P20 || u_CoordinateSystem == COORDINATE_SYSTEM_P20_OFFSET) {\n // P20 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF1\n offset = offset * pow(2.0, (19.0 - u_Zoom));\n }\n if(u_CoordinateSystem == COORDINATE_SYSTEM_P20_2) {\n // P20_2 \u5750\u6807\u7CFB\u4E0B\uFF0C\u4E3A\u4E86\u548C Web \u58A8\u5361\u6258\u5750\u6807\u7CFB\u7EDF\u4E00\uFF0Czoom \u9ED8\u8BA4\u51CF3\n offset = offset * pow(2.0, (19.0 - 3.0 - u_Zoom));\n }\n } else {// \u5706\u67F1\u4F53\u56FA\u5B9A\u9AD8\u5EA6 \uFF08 \u5904\u7406 mapbox \uFF09\n if(u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT || u_CoordinateSystem == COORDINATE_SYSTEM_LNGLAT_OFFSET) {\n offset *= 4.0/pow(2.0, 21.0 - u_Zoom);\n }\n }\n\n\n vec4 project_pos = project_position(vec4(a_Pos.xy, 0., 1.0));\n\n // u_r \u63A7\u5236\u5706\u67F1\u7684\u751F\u957F\n vec4 pos = vec4(project_pos.xy + offset.xy, offset.z * u_r, 1.0);\n\n // \u5706\u67F1\u5149\u7167\u6548\u679C\n float lightWeight = 1.0;\n if(u_lightEnable > 0.0) { // \u53D6\u6D88\u4E09\u5143\u8868\u8FBE\u5F0F\uFF0C\u589E\u5F3A\u5065\u58EE\u6027\n lightWeight = calc_lighting(pos);\n }\n v_lightWeight = lightWeight;\n // \u8BBE\u7F6E\u5706\u67F1\u7684\u5E95\u8272\n if(u_linearColor == 1.0) { // \u4F7F\u7528\u6E10\u53D8\u989C\u8272\n v_color = mix(u_sourceColor, u_targetColor, barLinearZ);\n v_color.rgb *= lightWeight;\n } else { // \u4F7F\u7528 color \u65B9\u6CD5\u4F20\u5165\u7684\u989C\u8272\n v_color = a_Color;\n }\n v_color.a *= u_opacity;\n\n \n // \u5728\u5730\u7403\u6A21\u5F0F\u4E0B\uFF0C\u5C06\u539F\u672C\u5782\u76F4\u4E8E xy \u5E73\u9762\u7684\u5706\u67F1\u8C03\u6574\u59FF\u6001\u5230\u9002\u5E94\u5706\u7684\u89D2\u5EA6\n //\u65CB\u8F6C\u77E9\u9635mx\uFF0C\u521B\u5EFA\u7ED5x\u8F74\u65CB\u8F6C\u77E9\u9635\n float r = sqrt(a_Pos.z*a_Pos.z + a_Pos.x*a_Pos.x);\n float xRadian = getXRadian(a_Pos.y, r);\n float xcos = cos(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float xsin = sin(xRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 mx = mat4(\n 1,0,0,0, \n 0,xcos,-xsin,0, \n 0,xsin,xcos,0, \n 0,0,0,1);\n\n //\u65CB\u8F6C\u77E9\u9635my\uFF0C\u521B\u5EFA\u7ED5y\u8F74\u65CB\u8F6C\u77E9\u9635\n float yRadian = getYRadian(a_Pos.x, a_Pos.z);\n float ycos = cos(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u4F59\u5F26\u503C\n float ysin = sin(yRadian);//\u6C42\u89E3\u65CB\u8F6C\u89D2\u5EA6\u6B63\u5F26\u503C\n mat4 my = mat4(\n ycos,0,-ysin,0, \n 0,1,0,0, \n ysin,0,ycos,0, \n 0,0,0,1);\n\n gl_Position = u_ViewProjectionMatrix * vec4(( my * mx * vec4(a_Position * a_Size, 1.0)).xyz + a_Pos, 1.0);\n \n\n setPickingColor(a_PickingColor);\n}\n";
|
|
49
|
+
|
|
29
50
|
var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
30
51
|
(0, _inherits2.default)(ExtrudeModel, _BaseModel);
|
|
52
|
+
|
|
31
53
|
var _super = _createSuper(ExtrudeModel);
|
|
54
|
+
|
|
32
55
|
function ExtrudeModel() {
|
|
33
56
|
var _this;
|
|
57
|
+
|
|
34
58
|
(0, _classCallCheck2.default)(this, ExtrudeModel);
|
|
59
|
+
|
|
35
60
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36
61
|
args[_key] = arguments[_key];
|
|
37
62
|
}
|
|
63
|
+
|
|
38
64
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
39
65
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "raiseCount", 0);
|
|
40
66
|
(0, _defineProperty2.default)((0, _assertThisInitialized2.default)(_this), "raiseRepeat", 0);
|
|
41
67
|
return _this;
|
|
42
68
|
}
|
|
69
|
+
|
|
43
70
|
(0, _createClass2.default)(ExtrudeModel, [{
|
|
44
71
|
key: "getUninforms",
|
|
45
72
|
value: function getUninforms() {
|
|
46
73
|
var _ref = this.layer.getLayerConfig(),
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
74
|
+
_ref$animateOption = _ref.animateOption,
|
|
75
|
+
animateOption = _ref$animateOption === void 0 ? {
|
|
76
|
+
enable: false,
|
|
77
|
+
speed: 0.01,
|
|
78
|
+
repeat: false
|
|
79
|
+
} : _ref$animateOption,
|
|
80
|
+
_ref$opacity = _ref.opacity,
|
|
81
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
82
|
+
sourceColor = _ref.sourceColor,
|
|
83
|
+
targetColor = _ref.targetColor,
|
|
84
|
+
_ref$pickLight = _ref.pickLight,
|
|
85
|
+
pickLight = _ref$pickLight === void 0 ? false : _ref$pickLight,
|
|
86
|
+
_ref$heightfixed = _ref.heightfixed,
|
|
87
|
+
heightfixed = _ref$heightfixed === void 0 ? false : _ref$heightfixed,
|
|
88
|
+
_ref$opacityLinear = _ref.opacityLinear,
|
|
89
|
+
opacityLinear = _ref$opacityLinear === void 0 ? {
|
|
90
|
+
enable: false,
|
|
91
|
+
dir: 'up'
|
|
92
|
+
} : _ref$opacityLinear,
|
|
93
|
+
_ref$lightEnable = _ref.lightEnable,
|
|
94
|
+
lightEnable = _ref$lightEnable === void 0 ? true : _ref$lightEnable; // 转化渐变色
|
|
95
|
+
|
|
96
|
+
|
|
70
97
|
var useLinearColor = 0; // 默认不生效
|
|
98
|
+
|
|
71
99
|
var sourceColorArr = [0, 0, 0, 0];
|
|
72
100
|
var targetColorArr = [0, 0, 0, 0];
|
|
101
|
+
|
|
73
102
|
if (sourceColor && targetColor) {
|
|
74
103
|
sourceColorArr = (0, _l7Utils.rgb2arr)(sourceColor);
|
|
75
104
|
targetColorArr = (0, _l7Utils.rgb2arr)(targetColor);
|
|
76
105
|
useLinearColor = 1;
|
|
77
106
|
}
|
|
107
|
+
|
|
78
108
|
if (this.raiseCount < 1 && this.raiseRepeat > 0) {
|
|
79
109
|
if (animateOption.enable) {
|
|
80
110
|
var _animateOption$speed = animateOption.speed,
|
|
81
|
-
|
|
111
|
+
speed = _animateOption$speed === void 0 ? 0.01 : _animateOption$speed;
|
|
82
112
|
this.raiseCount += speed;
|
|
113
|
+
|
|
83
114
|
if (this.raiseCount >= 1) {
|
|
84
115
|
if (this.raiseRepeat > 1) {
|
|
85
116
|
this.raiseCount = 0;
|
|
@@ -90,6 +121,7 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
90
121
|
}
|
|
91
122
|
}
|
|
92
123
|
}
|
|
124
|
+
|
|
93
125
|
return {
|
|
94
126
|
// 圆柱体的拾取高亮是否要计算光照
|
|
95
127
|
u_pickLight: Number(pickLight),
|
|
@@ -113,18 +145,23 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
113
145
|
value: function () {
|
|
114
146
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
115
147
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
116
|
-
while (1)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
148
|
+
while (1) {
|
|
149
|
+
switch (_context.prev = _context.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
return _context.abrupt("return", this.buildModels());
|
|
152
|
+
|
|
153
|
+
case 1:
|
|
154
|
+
case "end":
|
|
155
|
+
return _context.stop();
|
|
156
|
+
}
|
|
122
157
|
}
|
|
123
158
|
}, _callee, this);
|
|
124
159
|
}));
|
|
160
|
+
|
|
125
161
|
function initModels() {
|
|
126
162
|
return _initModels.apply(this, arguments);
|
|
127
163
|
}
|
|
164
|
+
|
|
128
165
|
return initModels;
|
|
129
166
|
}()
|
|
130
167
|
}, {
|
|
@@ -132,39 +169,46 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
132
169
|
value: function () {
|
|
133
170
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
134
171
|
var _ref2, _ref2$animateOption$r, repeat, model;
|
|
172
|
+
|
|
135
173
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
136
|
-
while (1)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
174
|
+
while (1) {
|
|
175
|
+
switch (_context2.prev = _context2.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
// GAODE1.x GAODE2.x MAPBOX
|
|
178
|
+
_ref2 = this.layer.getLayerConfig(), _ref2$animateOption$r = _ref2.animateOption.repeat, repeat = _ref2$animateOption$r === void 0 ? 1 : _ref2$animateOption$r;
|
|
179
|
+
this.raiseRepeat = repeat;
|
|
180
|
+
_context2.next = 4;
|
|
181
|
+
return this.layer.buildLayerModel({
|
|
182
|
+
moduleName: 'pointEarthExtrude',
|
|
183
|
+
vertexShader: pointExtrudeVert,
|
|
184
|
+
fragmentShader: pointExtrudeFrag,
|
|
185
|
+
triangulation: _triangulation.PointExtrudeTriangulation,
|
|
186
|
+
depth: {
|
|
187
|
+
enable: true
|
|
188
|
+
},
|
|
189
|
+
cull: {
|
|
190
|
+
enable: true,
|
|
191
|
+
face: (0, _l7Utils.getCullFace)(this.mapService.version)
|
|
192
|
+
},
|
|
193
|
+
blend: this.getBlend()
|
|
194
|
+
});
|
|
195
|
+
|
|
196
|
+
case 4:
|
|
197
|
+
model = _context2.sent;
|
|
198
|
+
return _context2.abrupt("return", [model]);
|
|
199
|
+
|
|
200
|
+
case 6:
|
|
201
|
+
case "end":
|
|
202
|
+
return _context2.stop();
|
|
203
|
+
}
|
|
162
204
|
}
|
|
163
205
|
}, _callee2, this);
|
|
164
206
|
}));
|
|
207
|
+
|
|
165
208
|
function buildModels() {
|
|
166
209
|
return _buildModels.apply(this, arguments);
|
|
167
210
|
}
|
|
211
|
+
|
|
168
212
|
return buildModels;
|
|
169
213
|
}()
|
|
170
214
|
}, {
|
|
@@ -183,23 +227,26 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
183
227
|
size: 3,
|
|
184
228
|
update: function update(feature) {
|
|
185
229
|
var size = feature.size;
|
|
230
|
+
|
|
186
231
|
if (size) {
|
|
187
232
|
var buffersize = [];
|
|
233
|
+
|
|
188
234
|
if (Array.isArray(size)) {
|
|
189
235
|
buffersize = size.length === 2 ? [size[0], size[0], size[1]] : size;
|
|
190
236
|
}
|
|
237
|
+
|
|
191
238
|
if (!Array.isArray(size)) {
|
|
192
239
|
buffersize = [size, size, size];
|
|
193
240
|
}
|
|
241
|
+
|
|
194
242
|
return buffersize;
|
|
195
243
|
} else {
|
|
196
244
|
return [2, 2, 2];
|
|
197
245
|
}
|
|
198
246
|
}
|
|
199
247
|
}
|
|
200
|
-
});
|
|
248
|
+
}); // point layer size;
|
|
201
249
|
|
|
202
|
-
// point layer size;
|
|
203
250
|
this.styleAttributeService.registerStyleAttribute({
|
|
204
251
|
name: 'normal',
|
|
205
252
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -238,4 +285,5 @@ var ExtrudeModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
238
285
|
}]);
|
|
239
286
|
return ExtrudeModel;
|
|
240
287
|
}(_BaseModel2.default);
|
|
288
|
+
|
|
241
289
|
exports.default = ExtrudeModel;
|
|
@@ -1,70 +1,95 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
4
5
|
Object.defineProperty(exports, "__esModule", {
|
|
5
6
|
value: true
|
|
6
7
|
});
|
|
7
8
|
exports.default = void 0;
|
|
9
|
+
|
|
8
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
9
12
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
13
|
+
|
|
10
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
+
|
|
11
16
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
17
|
+
|
|
12
18
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
19
|
+
|
|
13
20
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
21
|
+
|
|
14
22
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
23
|
+
|
|
15
24
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
25
|
+
|
|
16
26
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
27
|
+
|
|
17
28
|
var _l7Core = require("@antv/l7-core");
|
|
29
|
+
|
|
18
30
|
var _BaseModel2 = _interopRequireDefault(require("../../core/BaseModel"));
|
|
31
|
+
|
|
19
32
|
var _triangulation = require("../../core/triangulation");
|
|
33
|
+
|
|
20
34
|
var _l7Utils = require("@antv/l7-utils");
|
|
35
|
+
|
|
21
36
|
var _glMatrix = require("gl-matrix");
|
|
37
|
+
|
|
22
38
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; }
|
|
39
|
+
|
|
23
40
|
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; } }
|
|
41
|
+
|
|
24
42
|
/* babel-plugin-inline-import '../shaders/earth/fill_frag.glsl' */
|
|
25
43
|
var pointFillFrag = "uniform float u_additive;\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\n#pragma include \"sdf_2d\"\n#pragma include \"picking\"\n\n\nvoid main() {\n int shape = int(floor(v_data.w + 0.5));\n\n vec4 strokeColor = textrueStroke == vec4(0) ? v_color : textrueStroke;\n\n lowp float antialiasblur = v_data.z;\n float r = v_radius / (v_radius + strokeWidth);\n\n float outer_df;\n float inner_df;\n // 'circle', 'triangle', 'square', 'pentagon', 'hexagon', 'octogon', 'hexagram', 'rhombus', 'vesica'\n if (shape == 0) {\n outer_df = sdCircle(v_data.xy, 1.0);\n inner_df = sdCircle(v_data.xy, r);\n } else if (shape == 1) {\n outer_df = sdEquilateralTriangle(1.1 * v_data.xy);\n inner_df = sdEquilateralTriangle(1.1 / r * v_data.xy);\n } else if (shape == 2) {\n outer_df = sdBox(v_data.xy, vec2(1.));\n inner_df = sdBox(v_data.xy, vec2(r));\n } else if (shape == 3) {\n outer_df = sdPentagon(v_data.xy, 0.8);\n inner_df = sdPentagon(v_data.xy, r * 0.8);\n } else if (shape == 4) {\n outer_df = sdHexagon(v_data.xy, 0.8);\n inner_df = sdHexagon(v_data.xy, r * 0.8);\n } else if (shape == 5) {\n outer_df = sdOctogon(v_data.xy, 1.0);\n inner_df = sdOctogon(v_data.xy, r);\n } else if (shape == 6) {\n outer_df = sdHexagram(v_data.xy, 0.52);\n inner_df = sdHexagram(v_data.xy, r * 0.52);\n } else if (shape == 7) {\n outer_df = sdRhombus(v_data.xy, vec2(1.0));\n inner_df = sdRhombus(v_data.xy, vec2(r));\n } else if (shape == 8) {\n outer_df = sdVesica(v_data.xy, 1.1, 0.8);\n inner_df = sdVesica(v_data.xy, r * 1.1, r * 0.8);\n }\n\n if(outer_df > antialiasblur + 0.018) discard;\n\n float opacity_t = smoothstep(0.0, antialiasblur, outer_df);\n\n float color_t = strokeWidth < 0.01 ? 0.0 : smoothstep(\n antialiasblur,\n 0.0,\n inner_df\n );\n\n if(strokeWidth < 0.01) {\n gl_FragColor = vec4(v_color.rgb, v_color.a * u_opacity);\n } else {\n gl_FragColor = mix(vec4(v_color.rgb, v_color.a * u_opacity), u_stroke_color * u_stroke_opacity, color_t);\n }\n\n if(u_additive > 0.0) {\n gl_FragColor *= opacity_t;\n gl_FragColor = filterColorAlpha(gl_FragColor, gl_FragColor.a);\n } else {\n gl_FragColor.a *= opacity_t;\n gl_FragColor = filterColor(gl_FragColor);\n }\n}\n";
|
|
44
|
+
|
|
26
45
|
/* babel-plugin-inline-import '../shaders/earth/fill_vert.glsl' */
|
|
27
46
|
var pointFillVert = "attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Extrude;\nattribute float a_Size;\nattribute float a_Shape;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_Mvp;\n\nvarying vec4 v_data;\nvarying vec4 v_color;\nvarying float v_radius;\n\nuniform float u_opacity : 1;\nuniform float u_stroke_opacity : 1;\nuniform float u_stroke_width : 2;\nuniform vec4 u_stroke_color : [0.0, 0.0, 0.0, 0.0];\nuniform vec2 u_offsets;\n\nuniform float u_blur : 0.0;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\n\n\nvoid main() {\n vec3 extrude = a_Extrude;\n float shape_type = a_Shape;\n /*\n * setPickingSize \u8BBE\u7F6E\u62FE\u53D6\u5927\u5C0F\n */\n float newSize = setPickingSize(a_Size);\n // float newSize = setPickingSize(a_Size) * 0.00001038445708445579;\n\n // unpack color(vec2)\n v_color = a_Color;\n\n // radius(16-bit)\n v_radius = newSize;\n\n // anti-alias\n // float antialiased_blur = -max(u_blur, antialiasblur);\n float antialiasblur = -max(2.0 / u_DevicePixelRatio / newSize, u_blur);\n\n // TODP: /abs(extrude.x) \u662F\u4E3A\u4E86\u517C\u5BB9\u5730\u7403\u6A21\u5F0F\n v_data = vec4(extrude.x/abs(extrude.x), extrude.y/abs(extrude.y), antialiasblur,shape_type);\n\n\n gl_Position = u_ViewProjectionMatrix * vec4(a_Position + extrude * newSize * 0.1 + u_offsets, 1.0);\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
47
|
+
|
|
28
48
|
var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
29
49
|
(0, _inherits2.default)(FillModel, _BaseModel);
|
|
50
|
+
|
|
30
51
|
var _super = _createSuper(FillModel);
|
|
52
|
+
|
|
31
53
|
function FillModel() {
|
|
32
54
|
(0, _classCallCheck2.default)(this, FillModel);
|
|
33
55
|
return _super.apply(this, arguments);
|
|
34
56
|
}
|
|
57
|
+
|
|
35
58
|
(0, _createClass2.default)(FillModel, [{
|
|
36
59
|
key: "getUninforms",
|
|
37
60
|
value: function getUninforms() {
|
|
38
61
|
var _ref = this.layer.getLayerConfig(),
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
62
|
+
_ref$opacity = _ref.opacity,
|
|
63
|
+
opacity = _ref$opacity === void 0 ? 1 : _ref$opacity,
|
|
64
|
+
_ref$strokeOpacity = _ref.strokeOpacity,
|
|
65
|
+
strokeOpacity = _ref$strokeOpacity === void 0 ? 1 : _ref$strokeOpacity,
|
|
66
|
+
_ref$strokeWidth = _ref.strokeWidth,
|
|
67
|
+
strokeWidth = _ref$strokeWidth === void 0 ? 0 : _ref$strokeWidth,
|
|
68
|
+
_ref$stroke = _ref.stroke,
|
|
69
|
+
stroke = _ref$stroke === void 0 ? 'rgba(0,0,0,0)' : _ref$stroke,
|
|
70
|
+
blend = _ref.blend,
|
|
71
|
+
_ref$blur = _ref.blur,
|
|
72
|
+
blur = _ref$blur === void 0 ? 0 : _ref$blur;
|
|
73
|
+
|
|
50
74
|
return {
|
|
51
75
|
u_blur: blur,
|
|
52
76
|
u_additive: blend === 'additive' ? 1.0 : 0.0,
|
|
53
77
|
u_opacity: opacity,
|
|
54
78
|
u_stroke_opacity: strokeOpacity,
|
|
55
79
|
u_stroke_width: strokeWidth,
|
|
56
|
-
u_stroke_color: (0, _l7Utils.rgb2arr)(stroke)
|
|
57
|
-
|
|
80
|
+
u_stroke_color: (0, _l7Utils.rgb2arr)(stroke) // u_offsets: offsets,
|
|
81
|
+
|
|
58
82
|
};
|
|
59
83
|
}
|
|
60
84
|
}, {
|
|
61
85
|
key: "getAnimateUniforms",
|
|
62
86
|
value: function getAnimateUniforms() {
|
|
63
87
|
var _ref2 = this.layer.getLayerConfig(),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
88
|
+
_ref2$animateOption = _ref2.animateOption,
|
|
89
|
+
animateOption = _ref2$animateOption === void 0 ? {
|
|
90
|
+
enable: false
|
|
91
|
+
} : _ref2$animateOption;
|
|
92
|
+
|
|
68
93
|
return {
|
|
69
94
|
u_animate: this.animateOption2Array(animateOption),
|
|
70
95
|
u_time: this.layer.getLayerAnimateTime()
|
|
@@ -75,18 +100,23 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
75
100
|
value: function () {
|
|
76
101
|
var _initModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
77
102
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
78
|
-
while (1)
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
103
|
+
while (1) {
|
|
104
|
+
switch (_context.prev = _context.next) {
|
|
105
|
+
case 0:
|
|
106
|
+
return _context.abrupt("return", this.buildModels());
|
|
107
|
+
|
|
108
|
+
case 1:
|
|
109
|
+
case "end":
|
|
110
|
+
return _context.stop();
|
|
111
|
+
}
|
|
84
112
|
}
|
|
85
113
|
}, _callee, this);
|
|
86
114
|
}));
|
|
115
|
+
|
|
87
116
|
function initModels() {
|
|
88
117
|
return _initModels.apply(this, arguments);
|
|
89
118
|
}
|
|
119
|
+
|
|
90
120
|
return initModels;
|
|
91
121
|
}()
|
|
92
122
|
}, {
|
|
@@ -95,34 +125,41 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
95
125
|
var _buildModels = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
96
126
|
var model;
|
|
97
127
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
98
|
-
while (1)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
128
|
+
while (1) {
|
|
129
|
+
switch (_context2.prev = _context2.next) {
|
|
130
|
+
case 0:
|
|
131
|
+
this.layer.triangulation = _triangulation.GlobelPointFillTriangulation;
|
|
132
|
+
_context2.next = 3;
|
|
133
|
+
return this.layer.buildLayerModel({
|
|
134
|
+
moduleName: 'pointEarthFill',
|
|
135
|
+
vertexShader: pointFillVert,
|
|
136
|
+
fragmentShader: pointFillFrag,
|
|
137
|
+
triangulation: _triangulation.GlobelPointFillTriangulation,
|
|
138
|
+
depth: {
|
|
139
|
+
enable: true
|
|
140
|
+
},
|
|
141
|
+
blend: this.getBlend()
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
case 3:
|
|
145
|
+
model = _context2.sent;
|
|
146
|
+
return _context2.abrupt("return", [model]);
|
|
147
|
+
|
|
148
|
+
case 5:
|
|
149
|
+
case "end":
|
|
150
|
+
return _context2.stop();
|
|
151
|
+
}
|
|
118
152
|
}
|
|
119
153
|
}, _callee2, this);
|
|
120
154
|
}));
|
|
155
|
+
|
|
121
156
|
function buildModels() {
|
|
122
157
|
return _buildModels.apply(this, arguments);
|
|
123
158
|
}
|
|
159
|
+
|
|
124
160
|
return buildModels;
|
|
125
161
|
}() // overwrite baseModel func
|
|
162
|
+
|
|
126
163
|
}, {
|
|
127
164
|
key: "animateOption2Array",
|
|
128
165
|
value: function animateOption2Array(option) {
|
|
@@ -132,6 +169,7 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
132
169
|
key: "registerBuiltinAttributes",
|
|
133
170
|
value: function registerBuiltinAttributes() {
|
|
134
171
|
var _this = this;
|
|
172
|
+
|
|
135
173
|
this.styleAttributeService.registerStyleAttribute({
|
|
136
174
|
name: 'extrude',
|
|
137
175
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -146,36 +184,54 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
146
184
|
size: 3,
|
|
147
185
|
update: function update(feature, featureIdx, vertex, attributeIdx) {
|
|
148
186
|
var _vertex = (0, _slicedToArray2.default)(vertex, 3),
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
187
|
+
x = _vertex[0],
|
|
188
|
+
y = _vertex[1],
|
|
189
|
+
z = _vertex[2];
|
|
190
|
+
|
|
152
191
|
var n1 = _glMatrix.vec3.fromValues(0, 0, 1);
|
|
192
|
+
|
|
153
193
|
var n2 = _glMatrix.vec3.fromValues(x, 0, z);
|
|
194
|
+
|
|
154
195
|
var xzReg = x >= 0 ? _glMatrix.vec3.angle(n1, n2) : Math.PI * 2 - _glMatrix.vec3.angle(n1, n2);
|
|
155
196
|
var yReg = Math.PI * 2 - Math.asin(y / 100);
|
|
197
|
+
|
|
156
198
|
var m = _glMatrix.mat4.create();
|
|
199
|
+
|
|
157
200
|
_glMatrix.mat4.rotateY(m, m, xzReg);
|
|
201
|
+
|
|
158
202
|
_glMatrix.mat4.rotateX(m, m, yReg);
|
|
203
|
+
|
|
159
204
|
var v1 = _glMatrix.vec3.fromValues(1, 1, 0);
|
|
205
|
+
|
|
160
206
|
_glMatrix.vec3.transformMat4(v1, v1, m);
|
|
207
|
+
|
|
161
208
|
_glMatrix.vec3.normalize(v1, v1);
|
|
209
|
+
|
|
162
210
|
var v2 = _glMatrix.vec3.fromValues(-1, 1, 0);
|
|
211
|
+
|
|
163
212
|
_glMatrix.vec3.transformMat4(v2, v2, m);
|
|
213
|
+
|
|
164
214
|
_glMatrix.vec3.normalize(v2, v2);
|
|
215
|
+
|
|
165
216
|
var v3 = _glMatrix.vec3.fromValues(-1, -1, 0);
|
|
217
|
+
|
|
166
218
|
_glMatrix.vec3.transformMat4(v3, v3, m);
|
|
219
|
+
|
|
167
220
|
_glMatrix.vec3.normalize(v3, v3);
|
|
221
|
+
|
|
168
222
|
var v4 = _glMatrix.vec3.fromValues(1, -1, 0);
|
|
223
|
+
|
|
169
224
|
_glMatrix.vec3.transformMat4(v4, v4, m);
|
|
225
|
+
|
|
170
226
|
_glMatrix.vec3.normalize(v4, v4);
|
|
227
|
+
|
|
171
228
|
var extrude = [].concat((0, _toConsumableArray2.default)(v1), (0, _toConsumableArray2.default)(v2), (0, _toConsumableArray2.default)(v3), (0, _toConsumableArray2.default)(v4));
|
|
172
229
|
var extrudeIndex = attributeIdx % 4 * 3;
|
|
173
230
|
return [extrude[extrudeIndex], extrude[extrudeIndex + 1], extrude[extrudeIndex + 2]];
|
|
174
231
|
}
|
|
175
232
|
}
|
|
176
|
-
});
|
|
233
|
+
}); // point layer size;
|
|
177
234
|
|
|
178
|
-
// point layer size;
|
|
179
235
|
this.styleAttributeService.registerStyleAttribute({
|
|
180
236
|
name: 'size',
|
|
181
237
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -190,13 +246,12 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
190
246
|
size: 1,
|
|
191
247
|
update: function update(feature) {
|
|
192
248
|
var _feature$size = feature.size,
|
|
193
|
-
|
|
249
|
+
size = _feature$size === void 0 ? 5 : _feature$size;
|
|
194
250
|
return Array.isArray(size) ? [size[0]] : [size];
|
|
195
251
|
}
|
|
196
252
|
}
|
|
197
|
-
});
|
|
253
|
+
}); // point layer size;
|
|
198
254
|
|
|
199
|
-
// point layer size;
|
|
200
255
|
this.styleAttributeService.registerStyleAttribute({
|
|
201
256
|
name: 'shape',
|
|
202
257
|
type: _l7Core.AttributeType.Attribute,
|
|
@@ -211,8 +266,10 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
211
266
|
size: 1,
|
|
212
267
|
update: function update(feature) {
|
|
213
268
|
var _feature$shape = feature.shape,
|
|
214
|
-
|
|
269
|
+
shape = _feature$shape === void 0 ? 2 : _feature$shape;
|
|
270
|
+
|
|
215
271
|
var shape2d = _this.layer.getLayerConfig().shape2d;
|
|
272
|
+
|
|
216
273
|
var shapeIndex = shape2d.indexOf(shape);
|
|
217
274
|
return [shapeIndex];
|
|
218
275
|
}
|
|
@@ -222,4 +279,5 @@ var FillModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
222
279
|
}]);
|
|
223
280
|
return FillModel;
|
|
224
281
|
}(_BaseModel2.default);
|
|
282
|
+
|
|
225
283
|
exports.default = FillModel;
|