@antv/l7-layers 2.19.10 → 2.20.0
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/canvas/models/canvas.js +2 -2
- package/es/core/BaseLayer.d.ts +1 -1
- package/es/core/BaseLayer.js +22 -15
- package/es/core/BaseModel.d.ts +3 -1
- package/es/core/BaseModel.js +28 -4
- package/es/core/CommonStyleAttribute.d.ts +15 -0
- package/es/core/CommonStyleAttribute.js +21 -0
- package/es/core/TextureService.js +2 -2
- package/es/core/interface.d.ts +13 -9
- package/es/core/line_trangluation.d.ts +19 -0
- package/es/core/line_trangluation.js +91 -0
- package/es/core/shape/arrow.d.ts +25 -0
- package/es/core/shape/arrow.js +160 -0
- package/es/core/triangulation.d.ts +2 -8
- package/es/core/triangulation.js +6 -34
- package/es/earth/index.js +1 -1
- package/es/geometry/index.js +1 -1
- package/es/geometry/models/billboard.js +1 -1
- package/es/geometry/models/plane.js +2 -2
- package/es/geometry/models/sprite.js +2 -2
- package/es/heatmap/index.js +1 -1
- package/es/heatmap/models/heatmap.js +4 -4
- package/es/image/models/image.js +1 -1
- package/es/line/index.js +3 -2
- package/es/line/models/arc.js +6 -4
- package/es/line/models/arc_3d.js +4 -2
- package/es/line/models/earthArc_3d.js +4 -2
- package/es/line/models/flow.js +4 -5
- package/es/line/models/great_circle.js +1 -1
- package/es/line/models/line.js +3 -15
- package/es/line/models/linearline.js +1 -1
- package/es/line/models/wall.js +1 -1
- package/es/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/es/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/es/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/es/plugins/DataMappingPlugin.js +3 -20
- package/es/plugins/PixelPickingPlugin.d.ts +4 -1
- package/es/plugins/PixelPickingPlugin.js +91 -22
- package/es/plugins/RegisterStyleAttributePlugin.d.ts +0 -1
- package/es/plugins/RegisterStyleAttributePlugin.js +4 -22
- package/es/plugins/ShaderUniformPlugin.d.ts +2 -0
- package/es/plugins/ShaderUniformPlugin.js +74 -6
- package/es/point/index.js +1 -1
- package/es/point/models/fill.js +31 -7
- package/es/point/models/fillmage.js +1 -1
- package/es/point/models/image.js +1 -1
- package/es/point/models/normal.js +30 -12
- package/es/point/models/text.js +1 -1
- package/es/point/shaders/fill_frag.glsl +20 -14
- package/es/point/shaders/fill_vert.glsl +19 -18
- package/es/point/shaders/normal_frag.glsl +4 -3
- package/es/point/shaders/normal_vert.glsl +12 -11
- package/es/polygon/index.js +1 -1
- package/es/polygon/models/extrude.js +1 -1
- package/es/polygon/models/extrusion.js +1 -1
- package/es/polygon/models/ocean.js +3 -3
- package/es/polygon/models/water.js +1 -1
- package/es/raster/models/raster.js +2 -2
- package/es/raster/models/rasterRgb.js +1 -1
- package/es/raster/models/rasterTerrainRgb.js +1 -1
- package/es/tile/core/BaseLayer.js +4 -4
- package/es/tile/interaction/getRasterData.js +4 -4
- package/es/tile/service/TileLayerService.js +4 -4
- package/es/tile/service/TilePickService.js +3 -3
- package/es/tile/tile/Tile.d.ts +3 -1
- package/es/tile/tile/Tile.js +2 -2
- package/es/wind/models/wind.js +5 -6
- package/lib/canvas/index.js +2 -3
- package/lib/canvas/models/canvas.js +4 -5
- package/lib/canvas/models/index.js +1 -2
- package/lib/citybuliding/building.js +2 -3
- package/lib/citybuliding/models/build.js +2 -3
- package/lib/core/BaseLayer.js +23 -17
- package/lib/core/BaseModel.js +30 -7
- package/lib/core/CommonStyleAttribute.js +22 -0
- package/lib/core/LayerPickService.js +2 -3
- package/lib/core/TextureService.js +4 -5
- package/lib/core/constant.js +3 -5
- package/lib/core/interface.js +6 -11
- package/lib/core/line_trangluation.js +99 -0
- package/lib/core/schema.js +2 -3
- package/lib/core/shape/Path.js +3 -6
- package/lib/core/shape/arrow.js +174 -0
- package/lib/core/triangulation.js +8 -37
- package/lib/earth/index.js +3 -4
- package/lib/earth/models/atmosphere.js +2 -3
- package/lib/earth/models/base.js +2 -3
- package/lib/earth/models/bloomsphere.js +2 -3
- package/lib/earth/utils.js +3 -6
- package/lib/geometry/index.js +3 -4
- package/lib/geometry/models/billboard.js +3 -4
- package/lib/geometry/models/index.js +1 -2
- package/lib/geometry/models/plane.js +4 -5
- package/lib/geometry/models/sprite.js +4 -5
- package/lib/heatmap/index.js +3 -4
- package/lib/heatmap/models/grid.js +2 -3
- package/lib/heatmap/models/grid3d.js +2 -3
- package/lib/heatmap/models/heatmap.js +6 -7
- package/lib/heatmap/models/hexagon.js +2 -3
- package/lib/heatmap/models/index.js +1 -2
- package/lib/image/index.js +2 -3
- package/lib/image/models/image.js +3 -4
- package/lib/image/models/index.js +1 -2
- package/lib/line/index.js +5 -5
- package/lib/line/models/arc.js +8 -7
- package/lib/line/models/arc_3d.js +6 -5
- package/lib/line/models/earthArc_3d.js +6 -5
- package/lib/line/models/flow.js +6 -8
- package/lib/line/models/great_circle.js +3 -4
- package/lib/line/models/index.js +1 -2
- package/lib/line/models/line.js +5 -18
- package/lib/line/models/linearline.js +3 -4
- package/lib/line/models/simpleLine.js +2 -3
- package/lib/line/models/wall.js +3 -4
- package/lib/line/shaders/dash/arc_dash_vert.glsl +2 -5
- package/lib/line/shaders/flow/flow_line_vert.glsl +36 -6
- package/lib/line/shaders/linear/arc_linear_vert.glsl +2 -3
- package/lib/mask/index.js +2 -3
- package/lib/mask/models/fill.js +2 -3
- package/lib/mask/models/index.js +1 -2
- package/lib/plugins/DataMappingPlugin.js +5 -23
- package/lib/plugins/DataSourcePlugin.js +2 -3
- package/lib/plugins/FeatureScalePlugin.js +4 -5
- package/lib/plugins/LayerAnimateStylePlugin.js +2 -3
- package/lib/plugins/LayerMaskPlugin.js +2 -3
- package/lib/plugins/LayerModelPlugin.js +2 -3
- package/lib/plugins/LayerStylePlugin.js +2 -3
- package/lib/plugins/LightingPlugin.js +2 -3
- package/lib/plugins/MultiPassRendererPlugin.js +2 -3
- package/lib/plugins/PixelPickingPlugin.js +93 -25
- package/lib/plugins/RegisterStyleAttributePlugin.js +6 -25
- package/lib/plugins/ShaderUniformPlugin.js +75 -8
- package/lib/plugins/UpdateModelPlugin.js +2 -3
- package/lib/plugins/UpdateStyleAttributePlugin.js +2 -3
- package/lib/point/index.js +3 -4
- package/lib/point/models/billboard_point.js +2 -3
- package/lib/point/models/earthExtrude.js +2 -3
- package/lib/point/models/earthFill.js +2 -3
- package/lib/point/models/extrude.js +2 -3
- package/lib/point/models/fill.js +33 -10
- package/lib/point/models/fillmage.js +3 -4
- package/lib/point/models/image.js +3 -4
- package/lib/point/models/index.js +1 -2
- package/lib/point/models/normal.js +32 -15
- package/lib/point/models/radar.js +2 -3
- package/lib/point/models/text.js +3 -4
- package/lib/point/shaders/fill_frag.glsl +20 -14
- package/lib/point/shaders/fill_vert.glsl +19 -18
- package/lib/point/shaders/normal_frag.glsl +4 -3
- package/lib/point/shaders/normal_vert.glsl +12 -11
- package/lib/polygon/index.js +3 -4
- package/lib/polygon/models/extrude.js +3 -4
- package/lib/polygon/models/extrusion.js +3 -4
- package/lib/polygon/models/fill.js +2 -3
- package/lib/polygon/models/index.js +1 -2
- package/lib/polygon/models/ocean.js +5 -6
- package/lib/polygon/models/water.js +3 -4
- package/lib/raster/index.js +2 -3
- package/lib/raster/models/index.js +1 -2
- package/lib/raster/models/raster.js +4 -5
- package/lib/raster/models/rasterRgb.js +3 -4
- package/lib/raster/models/rasterTerrainRgb.js +3 -4
- package/lib/tile/core/BaseLayer.js +6 -7
- package/lib/tile/core/TileDebugLayer.js +2 -3
- package/lib/tile/interaction/getRasterData.js +4 -4
- package/lib/tile/service/TileLayerService.js +6 -7
- package/lib/tile/service/TilePickService.js +5 -6
- package/lib/tile/service/TileSourceService.js +4 -5
- package/lib/tile/tile/DebugTile.js +2 -3
- package/lib/tile/tile/ImageTile.js +2 -3
- package/lib/tile/tile/MaskTile.js +2 -3
- package/lib/tile/tile/RasterRGBTile.js +2 -3
- package/lib/tile/tile/RasterTerrainRGBTile.js +2 -3
- package/lib/tile/tile/RasterTile.js +2 -3
- package/lib/tile/tile/Tile.js +4 -5
- package/lib/tile/tile/VectorTile.js +2 -3
- package/lib/tile/utils/constants.js +2 -3
- package/lib/tile/utils/utils.js +1 -2
- package/lib/utils/blend.js +2 -3
- package/lib/utils/collision-index.js +2 -3
- package/lib/utils/extrude_polyline.js +2 -3
- package/lib/utils/grid-index.js +1 -2
- package/lib/utils/simpleLine.js +2 -3
- package/lib/wind/index.js +2 -3
- package/lib/wind/models/index.js +1 -2
- package/lib/wind/models/wind.js +7 -9
- package/lib/wind/models/windRender.js +4 -5
- package/lib/wind/models/windShader.js +6 -12
- package/package.json +7 -7
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.ArrowLineTriangulation = ArrowLineTriangulation;
|
|
8
|
+
exports.FlowHalfArrowFillTriangulation = FlowHalfArrowFillTriangulation;
|
|
9
|
+
exports.FlowLineTriangulation = FlowLineTriangulation;
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
+
var _arrow = require("./shape/arrow");
|
|
13
|
+
// list all arrow shape
|
|
14
|
+
|
|
15
|
+
// Half Edge
|
|
16
|
+
function FlowHalfArrowFillTriangulation(feature) {
|
|
17
|
+
// @ts-ignore
|
|
18
|
+
var coord = feature.coordinates.flat();
|
|
19
|
+
var tin = 1;
|
|
20
|
+
var tout = 1.0;
|
|
21
|
+
return {
|
|
22
|
+
vertices: [1, 0, 0].concat((0, _toConsumableArray2.default)(coord), [
|
|
23
|
+
// 0
|
|
24
|
+
1, 2, -3], (0, _toConsumableArray2.default)(coord), [
|
|
25
|
+
// 1
|
|
26
|
+
1, 1, -3], (0, _toConsumableArray2.default)(coord), [
|
|
27
|
+
// 2
|
|
28
|
+
0, 1, 0], (0, _toConsumableArray2.default)(coord), [
|
|
29
|
+
// 3
|
|
30
|
+
0, 0, 0], (0, _toConsumableArray2.default)(coord), [
|
|
31
|
+
// 4
|
|
32
|
+
1, 0, 0], (0, _toConsumableArray2.default)(coord), [
|
|
33
|
+
// 0
|
|
34
|
+
1, 2, -3], (0, _toConsumableArray2.default)(coord), [
|
|
35
|
+
// 1
|
|
36
|
+
1, 1, -3], (0, _toConsumableArray2.default)(coord), [
|
|
37
|
+
// 2
|
|
38
|
+
0, 1, 0], (0, _toConsumableArray2.default)(coord), [
|
|
39
|
+
// 3
|
|
40
|
+
0, 0, 0], (0, _toConsumableArray2.default)(coord)),
|
|
41
|
+
normals: [-tin, 2 * tout, 1,
|
|
42
|
+
// 0
|
|
43
|
+
2 * tout, -tout, 1,
|
|
44
|
+
// 1
|
|
45
|
+
tout, -tout, 1,
|
|
46
|
+
// 2
|
|
47
|
+
tout, -tout, 1,
|
|
48
|
+
// 3
|
|
49
|
+
-tin, -tout, 1,
|
|
50
|
+
// 4
|
|
51
|
+
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
52
|
+
indices: [0, 1, 2, 0, 2, 3, 0, 3, 4, 5, 6, 7, 5, 7, 8, 5, 8, 9],
|
|
53
|
+
size: 7
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function FlowLineTriangulation(feature, symbolOption) {
|
|
57
|
+
return symbolOption ? ArrowLineTriangulation(feature, symbolOption) : FlowHalfArrowFillTriangulation(feature);
|
|
58
|
+
}
|
|
59
|
+
function ArrowLineTriangulation(feature, symbolOption) {
|
|
60
|
+
// @ts-ignore
|
|
61
|
+
var coord = feature.coordinates.flat();
|
|
62
|
+
var _ref = symbolOption,
|
|
63
|
+
_ref$target = _ref.target,
|
|
64
|
+
target = _ref$target === void 0 ? 'classic' : _ref$target,
|
|
65
|
+
_ref$source = _ref.source,
|
|
66
|
+
source = _ref$source === void 0 ? 'circle' : _ref$source;
|
|
67
|
+
var startSymbol = shape2Vertices((0, _arrow.getSymbol)(source, 'source'), coord, 0, 0);
|
|
68
|
+
var linePath = (0, _arrow.lineArrowPath)(coord, startSymbol.vertices.length / 7, symbolOption);
|
|
69
|
+
var endSymbol = shape2Vertices((0, _arrow.getSymbol)(target, 'target'), coord, 1, startSymbol.vertices.length / 7 + linePath.vertices.length / 7);
|
|
70
|
+
var data = {
|
|
71
|
+
vertices: [].concat((0, _toConsumableArray2.default)(startSymbol.vertices), (0, _toConsumableArray2.default)(linePath.vertices), (0, _toConsumableArray2.default)(endSymbol.vertices)),
|
|
72
|
+
indices: [].concat((0, _toConsumableArray2.default)(startSymbol.outLineIndices), (0, _toConsumableArray2.default)(linePath.outLineIndices), (0, _toConsumableArray2.default)(endSymbol.outLineIndices), (0, _toConsumableArray2.default)(startSymbol.indices), (0, _toConsumableArray2.default)(linePath.indices), (0, _toConsumableArray2.default)(endSymbol.indices)),
|
|
73
|
+
normals: [].concat((0, _toConsumableArray2.default)(startSymbol.normals), (0, _toConsumableArray2.default)(linePath.normals), (0, _toConsumableArray2.default)(endSymbol.normals)),
|
|
74
|
+
size: 7
|
|
75
|
+
};
|
|
76
|
+
return data;
|
|
77
|
+
}
|
|
78
|
+
// start 0,end 1;
|
|
79
|
+
function shape2Vertices(shape, coord) {
|
|
80
|
+
var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
|
|
81
|
+
var indexOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
82
|
+
var shapeVertices = [];
|
|
83
|
+
var vertices = shape.vertices,
|
|
84
|
+
indices = shape.indices,
|
|
85
|
+
dimensions = shape.dimensions,
|
|
86
|
+
outLineIndices = shape.outLineIndices;
|
|
87
|
+
for (var i = 0; i < vertices.length; i += dimensions) {
|
|
88
|
+
shapeVertices.push.apply(shapeVertices, [type, vertices[i + 1], vertices[i]].concat((0, _toConsumableArray2.default)(coord)));
|
|
89
|
+
}
|
|
90
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, shape), {}, {
|
|
91
|
+
vertices: shapeVertices,
|
|
92
|
+
indices: indices.map(function (i) {
|
|
93
|
+
return i + indexOffset;
|
|
94
|
+
}),
|
|
95
|
+
outLineIndices: outLineIndices.map(function (i) {
|
|
96
|
+
return i + indexOffset;
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
}
|
package/lib/core/schema.js
CHANGED
|
@@ -7,7 +7,7 @@ exports.default = void 0;
|
|
|
7
7
|
/**
|
|
8
8
|
* BaseLayer Schema
|
|
9
9
|
*/
|
|
10
|
-
var _default = {
|
|
10
|
+
var _default = exports.default = {
|
|
11
11
|
properties: {
|
|
12
12
|
enablePicking: {
|
|
13
13
|
type: 'boolean'
|
|
@@ -28,5 +28,4 @@ var _default = {
|
|
|
28
28
|
}]
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
-
};
|
|
32
|
-
exports.default = _default;
|
|
31
|
+
};
|
package/lib/core/shape/Path.js
CHANGED
|
@@ -14,7 +14,7 @@ exports.square = square;
|
|
|
14
14
|
exports.triangle = triangle;
|
|
15
15
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
16
16
|
var _geometryShape;
|
|
17
|
-
var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
|
|
17
|
+
var ShapeType3D = exports.ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
|
|
18
18
|
ShapeType3D["CYLINDER"] = "cylinder";
|
|
19
19
|
ShapeType3D["SQUARECOLUMN"] = "squareColumn";
|
|
20
20
|
ShapeType3D["TRIANGLECOLUMN"] = "triangleColumn";
|
|
@@ -22,8 +22,7 @@ var ShapeType3D = /*#__PURE__*/function (ShapeType3D) {
|
|
|
22
22
|
ShapeType3D["PENTAGONCOLUMN"] = "pentagonColumn";
|
|
23
23
|
return ShapeType3D;
|
|
24
24
|
}({});
|
|
25
|
-
exports.
|
|
26
|
-
var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
|
|
25
|
+
var ShapeType2D = exports.ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
|
|
27
26
|
ShapeType2D["CIRCLE"] = "circle";
|
|
28
27
|
ShapeType2D["SQUARE"] = "square";
|
|
29
28
|
ShapeType2D["TRIANGLE"] = "triangle";
|
|
@@ -36,7 +35,6 @@ var ShapeType2D = /*#__PURE__*/function (ShapeType2D) {
|
|
|
36
35
|
* @param pointCount 顶点个数 3 => 三角形
|
|
37
36
|
* @param start 顶点起始角度 调整图形的方向
|
|
38
37
|
*/
|
|
39
|
-
exports.ShapeType2D = ShapeType2D;
|
|
40
38
|
function polygonPath(pointCount) {
|
|
41
39
|
var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
42
40
|
var step = Math.PI * 2 / pointCount;
|
|
@@ -67,5 +65,4 @@ function hexagon() {
|
|
|
67
65
|
function pentagon() {
|
|
68
66
|
return polygonPath(5);
|
|
69
67
|
}
|
|
70
|
-
var geometryShape = (_geometryShape = {}, (0, _defineProperty2.default)(_geometryShape, ShapeType2D.CIRCLE, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.HEXAGON, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.TRIANGLE, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.SQUARE, square), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.PENTAGON, pentagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.CYLINDER, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.HEXAGONCOLUMN, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.TRIANGLECOLUMN, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.SQUARECOLUMN, square), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.PENTAGONCOLUMN, pentagon), _geometryShape);
|
|
71
|
-
exports.geometryShape = geometryShape;
|
|
68
|
+
var geometryShape = exports.geometryShape = (_geometryShape = {}, (0, _defineProperty2.default)(_geometryShape, ShapeType2D.CIRCLE, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.HEXAGON, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.TRIANGLE, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.SQUARE, square), (0, _defineProperty2.default)(_geometryShape, ShapeType2D.PENTAGON, pentagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.CYLINDER, circle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.HEXAGONCOLUMN, hexagon), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.TRIANGLECOLUMN, triangle), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.SQUARECOLUMN, square), (0, _defineProperty2.default)(_geometryShape, ShapeType3D.PENTAGONCOLUMN, pentagon), _geometryShape);
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.circleArraw = circleArraw;
|
|
8
|
+
exports.classicArrow = classicArrow;
|
|
9
|
+
exports.diamondArrow = diamondArrow;
|
|
10
|
+
exports.getSymbol = getSymbol;
|
|
11
|
+
exports.halfTriangleArrow = halfTriangleArrow;
|
|
12
|
+
exports.lineArrowPath = lineArrowPath;
|
|
13
|
+
exports.rectArrow = rectArrow;
|
|
14
|
+
exports.triangleArrow = triangleArrow;
|
|
15
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
16
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
17
|
+
var _Path = require("./Path");
|
|
18
|
+
var _earcut = _interopRequireDefault(require("earcut"));
|
|
19
|
+
var maxArrowWidthMap = {
|
|
20
|
+
circle: 2,
|
|
21
|
+
triangle: 2,
|
|
22
|
+
diamond: 4,
|
|
23
|
+
rect: 2,
|
|
24
|
+
classic: 3,
|
|
25
|
+
halfTriangle: 2,
|
|
26
|
+
'none': 0
|
|
27
|
+
};
|
|
28
|
+
var PathHeight = 1 / 2;
|
|
29
|
+
function halfTriangleArrow(dir, options) {
|
|
30
|
+
var _options$width = options.width,
|
|
31
|
+
width = _options$width === void 0 ? 2 : _options$width,
|
|
32
|
+
_options$height = options.height,
|
|
33
|
+
height = _options$height === void 0 ? 1 : _options$height;
|
|
34
|
+
return {
|
|
35
|
+
vertices: [0, PathHeight * dir, 1 * dir * width, -(height + PathHeight) * dir, 1 * dir * width, (height - PathHeight) * dir, 0, PathHeight * dir, 1 * dir * width, -(height + PathHeight) * dir, 1 * dir * width, (height - PathHeight) * dir],
|
|
36
|
+
indices: [3, 4, 5],
|
|
37
|
+
outLineIndices: [0, 1, 2],
|
|
38
|
+
normals: [1 * dir, -2 * dir, 1,
|
|
39
|
+
// y,x
|
|
40
|
+
-2 * dir, 1.5 * dir, 1, 1 * dir, 1.5 * dir, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
41
|
+
dimensions: 2
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function triangleArrow(dir, options) {
|
|
45
|
+
var _options$width2 = options.width,
|
|
46
|
+
width = _options$width2 === void 0 ? 2 : _options$width2,
|
|
47
|
+
_options$height2 = options.height,
|
|
48
|
+
height = _options$height2 === void 0 ? 3 : _options$height2;
|
|
49
|
+
return {
|
|
50
|
+
vertices: [0, 0, 1 * dir * width, 1 * height, 1 * dir * width, -1 * height, 0, 0, 1 * dir * width, 1 * height, 1 * dir * width, -1 * height],
|
|
51
|
+
outLineIndices: [0, 1, 2],
|
|
52
|
+
indices: [3, 4, 5],
|
|
53
|
+
normals: [0, -1.5 * dir, 1, 2, 1 * dir, 1, -2, 1 * dir, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
54
|
+
dimensions: 2
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
function rectArrow(dir, options) {
|
|
58
|
+
var _options$width3 = options.width,
|
|
59
|
+
width = _options$width3 === void 0 ? 2 : _options$width3,
|
|
60
|
+
_options$height3 = options.height,
|
|
61
|
+
height = _options$height3 === void 0 ? 2 : _options$height3;
|
|
62
|
+
return {
|
|
63
|
+
vertices: [0, height / 2, dir * width * 1, height / 2, dir * width * 1, -height / 2, 0, -height / 2, 0, height / 2, dir * width * 1, height / 2, dir * width * 1, -height / 2, 0, -height / 2],
|
|
64
|
+
dimensions: 2,
|
|
65
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
66
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
67
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function diamondArrow(dir, options) {
|
|
71
|
+
var _options$width4 = options.width,
|
|
72
|
+
width = _options$width4 === void 0 ? 2 : _options$width4,
|
|
73
|
+
_options$height4 = options.height,
|
|
74
|
+
height = _options$height4 === void 0 ? 3 : _options$height4;
|
|
75
|
+
return {
|
|
76
|
+
vertices: [0, 0, 1 * width * dir, 0.5 * height, 2 * width * dir, 0, 1 * width * dir, -0.5 * height, 0, 0, 1 * width * dir, 0.5 * height, 2 * width * dir, 0, 1 * width * dir, -0.5 * height],
|
|
77
|
+
dimensions: 2,
|
|
78
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
79
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
80
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function classicArrow(dir, options) {
|
|
84
|
+
var _options$width5 = options.width,
|
|
85
|
+
width = _options$width5 === void 0 ? 2 : _options$width5,
|
|
86
|
+
_options$height5 = options.height,
|
|
87
|
+
height = _options$height5 === void 0 ? 3 : _options$height5;
|
|
88
|
+
return {
|
|
89
|
+
vertices: [0, 0, 2 * dir * width, 1 * height, 1.5 * dir * width, 0, 2 * dir * width, -1 * height, 0, 0, 2 * dir * width, 1 * height, 1.5 * dir * width, 0, 2 * dir * width, -1 * height],
|
|
90
|
+
dimensions: 2,
|
|
91
|
+
indices: [4, 5, 6, 4, 6, 7],
|
|
92
|
+
outLineIndices: [0, 1, 2, 0, 2, 3],
|
|
93
|
+
normals: [0, -dir, 1, 1, 0, 1, 0, -dir, 1, -1, -0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
function circleArraw(dir, options) {
|
|
97
|
+
var _options$width6 = options.width,
|
|
98
|
+
width = _options$width6 === void 0 ? 2 : _options$width6,
|
|
99
|
+
_options$height6 = options.height,
|
|
100
|
+
height = _options$height6 === void 0 ? 2 : _options$height6;
|
|
101
|
+
var path = (0, _Path.circle)();
|
|
102
|
+
var flattengeo = _earcut.default.flatten([path]);
|
|
103
|
+
var triangles = (0, _earcut.default)(flattengeo.vertices, flattengeo.holes, flattengeo.dimensions);
|
|
104
|
+
// @ts-ignore
|
|
105
|
+
var vertice = path.map(function (t) {
|
|
106
|
+
return [t[0] * width * dir, t[1] * height];
|
|
107
|
+
}).flat();
|
|
108
|
+
return {
|
|
109
|
+
vertices: [].concat((0, _toConsumableArray2.default)(vertice), (0, _toConsumableArray2.default)(vertice)),
|
|
110
|
+
dimensions: 2,
|
|
111
|
+
indices: triangles.map(function (v) {
|
|
112
|
+
return v + path.length;
|
|
113
|
+
}),
|
|
114
|
+
outLineIndices: triangles,
|
|
115
|
+
normals: [].concat((0, _toConsumableArray2.default)(path.map(function (t) {
|
|
116
|
+
return [t[1] * height, t[0] * width * dir, 1];
|
|
117
|
+
}).flat()), (0, _toConsumableArray2.default)(new Array(path.length * 3).fill(0)))
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
function lineArrowPath(coord) {
|
|
121
|
+
var indexOffset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
122
|
+
var symbol = arguments.length > 2 ? arguments[2] : undefined;
|
|
123
|
+
var sourceType = (0, _typeof2.default)(symbol['source']) === 'object' ? symbol['source'].type : symbol['source'];
|
|
124
|
+
var targetType = (0, _typeof2.default)(symbol['target']) === 'object' ? symbol['target'].type : symbol['target'];
|
|
125
|
+
var _ref = (0, _typeof2.default)(symbol['source']) === 'object' ? symbol['source'] : {},
|
|
126
|
+
_ref$width = _ref.width,
|
|
127
|
+
sourceWidth = _ref$width === void 0 ? sourceType ? maxArrowWidthMap[sourceType] : 0 : _ref$width,
|
|
128
|
+
_ref$height = _ref.height,
|
|
129
|
+
sourceHeight = _ref$height === void 0 ? 2 : _ref$height;
|
|
130
|
+
var _ref2 = (0, _typeof2.default)(symbol['target']) === 'object' ? symbol['target'] : {},
|
|
131
|
+
_ref2$width = _ref2.width,
|
|
132
|
+
targetWidth = _ref2$width === void 0 ? targetType ? maxArrowWidthMap[targetType] : 0 : _ref2$width,
|
|
133
|
+
_ref2$height = _ref2.height,
|
|
134
|
+
targetHeight = _ref2$height === void 0 ? 2 : _ref2$height;
|
|
135
|
+
return {
|
|
136
|
+
vertices: [0, PathHeight, 1 * sourceWidth].concat((0, _toConsumableArray2.default)(coord), [1, PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [1, -PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [0, -PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord), [0, PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord), [1, PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [1, -PathHeight, -1 * targetWidth], (0, _toConsumableArray2.default)(coord), [0, -PathHeight, 1 * sourceWidth], (0, _toConsumableArray2.default)(coord)),
|
|
137
|
+
outLineIndices: [0, 1, 2, 0, 2, 3].map(function (t) {
|
|
138
|
+
return t + indexOffset;
|
|
139
|
+
}),
|
|
140
|
+
indices: [4, 5, 6, 4, 6, 7].map(function (t) {
|
|
141
|
+
return t + indexOffset;
|
|
142
|
+
}),
|
|
143
|
+
normals: [1, -1, 1, 1, 1, 1, -1, 0, 1, -1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
|
|
144
|
+
dimensions: 2
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
function getSymbol(type, position) {
|
|
148
|
+
var shape = (0, _typeof2.default)(type) === 'object' ? type.type : type;
|
|
149
|
+
var dir = position === 'source' ? 1 : -1;
|
|
150
|
+
var option = (0, _typeof2.default)(type) === 'object' ? type : {};
|
|
151
|
+
switch (shape) {
|
|
152
|
+
case 'circle':
|
|
153
|
+
return circleArraw(dir, option);
|
|
154
|
+
case 'triangle':
|
|
155
|
+
return triangleArrow(dir, option);
|
|
156
|
+
case 'diamond':
|
|
157
|
+
return diamondArrow(dir, option);
|
|
158
|
+
case 'rect':
|
|
159
|
+
return rectArrow(dir, option);
|
|
160
|
+
case 'classic':
|
|
161
|
+
return classicArrow(dir, option);
|
|
162
|
+
case 'halfTriangle':
|
|
163
|
+
return halfTriangleArrow(dir, option);
|
|
164
|
+
default:
|
|
165
|
+
return {
|
|
166
|
+
vertices: [],
|
|
167
|
+
indices: [],
|
|
168
|
+
normals: [],
|
|
169
|
+
dimensions: 2,
|
|
170
|
+
outLineIndices: [],
|
|
171
|
+
outLineNormals: []
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
}
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.FlowLineFillTriangulation = FlowLineFillTriangulation;
|
|
9
|
-
exports.FlowLineStrokeTriangulation = FlowLineStrokeTriangulation;
|
|
10
9
|
exports.GlobelPointFillTriangulation = GlobelPointFillTriangulation;
|
|
11
10
|
exports.HeatmapGridTriangulation = HeatmapGridTriangulation;
|
|
12
11
|
exports.HeatmapTriangulation = HeatmapTriangulation;
|
|
@@ -34,8 +33,8 @@ var _utils = require("../earth/utils");
|
|
|
34
33
|
var _extrude_polyline = _interopRequireDefault(require("../utils/extrude_polyline"));
|
|
35
34
|
var _extrude = _interopRequireWildcard(require("./shape/extrude"));
|
|
36
35
|
var _Path = require("./shape/Path");
|
|
37
|
-
function _getRequireWildcardCache(
|
|
38
|
-
function _interopRequireWildcard(
|
|
36
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
37
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
39
38
|
// @ts-ignore
|
|
40
39
|
|
|
41
40
|
var GeometryCache = {};
|
|
@@ -191,36 +190,6 @@ function FlowLineFillTriangulation(feature) {
|
|
|
191
190
|
size: 7
|
|
192
191
|
};
|
|
193
192
|
}
|
|
194
|
-
function FlowLineStrokeTriangulation(feature) {
|
|
195
|
-
// @ts-ignore
|
|
196
|
-
var coord = feature.coordinates.flat();
|
|
197
|
-
var tin = 1;
|
|
198
|
-
var tout = 1;
|
|
199
|
-
return {
|
|
200
|
-
vertices: [1, 0, 0].concat((0, _toConsumableArray2.default)(coord), [
|
|
201
|
-
// 0
|
|
202
|
-
1, 2, -3], (0, _toConsumableArray2.default)(coord), [
|
|
203
|
-
// 1
|
|
204
|
-
1, 1, -3], (0, _toConsumableArray2.default)(coord), [
|
|
205
|
-
// 2
|
|
206
|
-
0, 1, 0], (0, _toConsumableArray2.default)(coord), [
|
|
207
|
-
// 3
|
|
208
|
-
0, 0, 0], (0, _toConsumableArray2.default)(coord)),
|
|
209
|
-
normals: [-tin, 2 * tout, 1,
|
|
210
|
-
// 0
|
|
211
|
-
2 * tout, -tout, 1,
|
|
212
|
-
// 1
|
|
213
|
-
tout, -tout, 1,
|
|
214
|
-
// 2
|
|
215
|
-
tout, -tout, 1,
|
|
216
|
-
// 3
|
|
217
|
-
-tin, -tout, 1 // 4
|
|
218
|
-
],
|
|
219
|
-
|
|
220
|
-
indices: [0, 1, 1, 2, 2, 3, 3, 4, 4, 0],
|
|
221
|
-
size: 7
|
|
222
|
-
};
|
|
223
|
-
}
|
|
224
193
|
function SimpleLineTriangulation(feature) {
|
|
225
194
|
var coordinates = feature.coordinates;
|
|
226
195
|
var pos = [];
|
|
@@ -422,8 +391,10 @@ function RasterImageTriangulation(feature) {
|
|
|
422
391
|
* @param feature 映射数据
|
|
423
392
|
* @param segNum 弧线线段数
|
|
424
393
|
*/
|
|
425
|
-
function LineArcTriangulation(feature,
|
|
426
|
-
|
|
394
|
+
function LineArcTriangulation(feature, styleOption) {
|
|
395
|
+
// @ts-ignore
|
|
396
|
+
var _styleOption$segmentN = styleOption.segmentNumber,
|
|
397
|
+
segmentNumber = _styleOption$segmentN === void 0 ? 30 : _styleOption$segmentN;
|
|
427
398
|
var coordinates = feature.coordinates;
|
|
428
399
|
var positions = [];
|
|
429
400
|
var indexArray = [];
|
|
@@ -431,13 +402,13 @@ function LineArcTriangulation(feature, segmentNumber) {
|
|
|
431
402
|
// 上线两个顶点
|
|
432
403
|
// [ x, y, z, sx,sy, tx,ty]
|
|
433
404
|
positions.push(i, 1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1], i, -1, i, coordinates[0][0], coordinates[0][1], coordinates[1][0], coordinates[1][1]);
|
|
434
|
-
if (i !==
|
|
405
|
+
if (i !== segmentNumber - 1) {
|
|
435
406
|
indexArray.push.apply(indexArray, (0, _toConsumableArray2.default)([0, 1, 2, 1, 3, 2].map(function (v) {
|
|
436
407
|
return i * 2 + v;
|
|
437
408
|
})));
|
|
438
409
|
}
|
|
439
410
|
};
|
|
440
|
-
for (var i = 0; i <
|
|
411
|
+
for (var i = 0; i < segmentNumber; i++) {
|
|
441
412
|
_loop(i);
|
|
442
413
|
}
|
|
443
414
|
return {
|
package/lib/earth/index.js
CHANGED
|
@@ -26,7 +26,7 @@ var EarthModels = {
|
|
|
26
26
|
bloomSphere: _bloomsphere.default
|
|
27
27
|
};
|
|
28
28
|
var earthLayerTypes = ['base', 'atomSphere', 'bloomSphere'];
|
|
29
|
-
var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
29
|
+
var EarthLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
30
30
|
(0, _inherits2.default)(EarthLayer, _BaseLayer);
|
|
31
31
|
var _super = _createSuper(EarthLayer);
|
|
32
32
|
function EarthLayer() {
|
|
@@ -88,7 +88,7 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
88
88
|
value: function getModelType() {
|
|
89
89
|
var _shapeAttribute$scale;
|
|
90
90
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
91
|
-
var shape = (shapeAttribute === null || shapeAttribute === void 0
|
|
91
|
+
var shape = (shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field) || 'base';
|
|
92
92
|
if (earthLayerTypes.indexOf(shape) < 0) {
|
|
93
93
|
shape = 'base';
|
|
94
94
|
}
|
|
@@ -96,5 +96,4 @@ var EarthLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
96
96
|
}
|
|
97
97
|
}]);
|
|
98
98
|
return EarthLayer;
|
|
99
|
-
}(_BaseLayer2.default);
|
|
100
|
-
exports.default = EarthLayer;
|
|
99
|
+
}(_BaseLayer2.default);
|
|
@@ -23,7 +23,7 @@ var atmoSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition;
|
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/atmosphere_vert.glsl' */
|
|
24
24
|
var atmoSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nvarying float v_CamreaDistance;\n\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\nvarying float v_offset;\n\nvoid main() {\n float EARTH_RADIUS = 100.0;\n \n v_Color = a_Color;\n\n v_offset = min(((length(u_CameraPosition) - EARTH_RADIUS)/600.0) * 0.5 + 0.4, 1.0);\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
25
25
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
26
|
-
var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
var EarthAtomSphereModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(EarthAtomSphereModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(EarthAtomSphereModel);
|
|
29
29
|
function EarthAtomSphereModel() {
|
|
@@ -156,5 +156,4 @@ var EarthAtomSphereModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
156
156
|
}
|
|
157
157
|
}]);
|
|
158
158
|
return EarthAtomSphereModel;
|
|
159
|
-
}(_BaseModel2.default);
|
|
160
|
-
exports.default = EarthAtomSphereModel;
|
|
159
|
+
}(_BaseModel2.default);
|
package/lib/earth/models/base.js
CHANGED
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
var baseFrag = "\nuniform sampler2D u_texture;\n\nvarying vec2 v_texCoord;\nvarying float v_lightWeight;\n\n\nvoid main() {\n\n vec4 color = texture2D(u_texture,vec2(v_texCoord.x,v_texCoord.y));\n color.xyz = color.xyz * v_lightWeight;\n gl_FragColor = color;\n}\n";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/base_vert.glsl' */
|
|
25
25
|
var baseVert = "// attribute vec4 a_Color;\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nvarying vec2 v_texCoord;\n\n// attribute vec2 a_Extrude;\n// attribute float a_Size;\n// attribute float a_Shape;\n\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform float u_ambientRatio : 0.5;\nuniform float u_diffuseRatio : 0.3;\nuniform float u_specularRatio : 0.2;\nuniform vec3 u_sunLight: [1.0, -10.5, 12.0];\n\n\n\nfloat calc_lighting(vec4 pos) {\n\n vec3 worldPos = vec3(pos * u_ModelMatrix);\n\n vec3 worldNormal = a_Normal;\n\n // cal light weight\n vec3 viewDir = normalize(u_CameraPosition - worldPos);\n\n vec3 lightDir = normalize(u_sunLight);\n\n vec3 halfDir = normalize(viewDir+lightDir);\n // lambert\n float lambert = dot(worldNormal, lightDir);\n // specular\n float specular = pow(max(0.0, dot(worldNormal, halfDir)), 32.0);\n //sum to light weight\n float lightWeight = u_ambientRatio + u_diffuseRatio * lambert + u_specularRatio * specular;\n\n return lightWeight;\n}\n\nvarying float v_lightWeight;\nvoid main() {\n\n v_texCoord = a_Uv;\n\n float lightWeight = calc_lighting(vec4(a_Position, 1.0));\n v_lightWeight = lightWeight;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
26
|
-
var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
var BaseEarthModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(BaseEarthModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(BaseEarthModel);
|
|
29
29
|
function BaseEarthModel() {
|
|
@@ -214,5 +214,4 @@ var BaseEarthModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
214
214
|
}
|
|
215
215
|
}]);
|
|
216
216
|
return BaseEarthModel;
|
|
217
|
-
}(_BaseModel2.default);
|
|
218
|
-
exports.default = BaseEarthModel;
|
|
217
|
+
}(_BaseModel2.default);
|
|
@@ -23,7 +23,7 @@ var bloomSphereFrag = "\nuniform float u_opacity;\nuniform vec3 u_CameraPosition
|
|
|
23
23
|
/* babel-plugin-inline-import '../shaders/bloomsphere_vert.glsl' */
|
|
24
24
|
var bloomSphereVert = "\nattribute vec3 a_Position;\nattribute vec3 a_Normal;\nattribute vec2 a_Uv;\nattribute vec4 a_Color;\nuniform vec3 u_CameraPosition;\nuniform mat4 u_ViewProjectionMatrix;\nuniform mat4 u_ModelMatrix;\nuniform mat4 u_ViewMatrix;\n\nvarying vec3 vVertexNormal;\nvarying vec4 v_Color;\n\nvoid main() {\n v_Color = a_Color;\n\n vVertexNormal = a_Normal;\n\n gl_Position = u_ViewProjectionMatrix * u_ModelMatrix * vec4(a_Position, 1.0);\n}\n";
|
|
25
25
|
var isNumber = _l7Utils.lodashUtil.isNumber;
|
|
26
|
-
var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
var EarthBloomSphereModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(EarthBloomSphereModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(EarthBloomSphereModel);
|
|
29
29
|
function EarthBloomSphereModel() {
|
|
@@ -155,5 +155,4 @@ var EarthBloomSphereModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
155
155
|
}
|
|
156
156
|
}]);
|
|
157
157
|
return EarthBloomSphereModel;
|
|
158
|
-
}(_BaseModel2.default);
|
|
159
|
-
exports.default = EarthBloomSphereModel;
|
|
158
|
+
}(_BaseModel2.default);
|
package/lib/earth/utils.js
CHANGED
|
@@ -12,18 +12,15 @@ var _glMatrix = require("gl-matrix");
|
|
|
12
12
|
// 该文件专门记录地球模式的数值
|
|
13
13
|
|
|
14
14
|
// 地球网格半径
|
|
15
|
-
var EARTH_RADIUS = 100;
|
|
16
|
-
exports.
|
|
17
|
-
var
|
|
18
|
-
exports.EARTH_SEGMENTS = EARTH_SEGMENTS;
|
|
19
|
-
var EARTH_RADIUS_OUTER = 40;
|
|
15
|
+
var EARTH_RADIUS = exports.EARTH_RADIUS = 100;
|
|
16
|
+
var EARTH_SEGMENTS = exports.EARTH_SEGMENTS = 36;
|
|
17
|
+
var EARTH_RADIUS_OUTER = exports.EARTH_RADIUS_OUTER = 40;
|
|
20
18
|
|
|
21
19
|
/**
|
|
22
20
|
* 角度转弧度
|
|
23
21
|
* @param deg
|
|
24
22
|
* @returns
|
|
25
23
|
*/
|
|
26
|
-
exports.EARTH_RADIUS_OUTER = EARTH_RADIUS_OUTER;
|
|
27
24
|
function torad(deg) {
|
|
28
25
|
return deg / 180 * Math.acos(-1);
|
|
29
26
|
}
|
package/lib/geometry/index.js
CHANGED
|
@@ -18,7 +18,7 @@ var _BaseLayer2 = _interopRequireDefault(require("../core/BaseLayer"));
|
|
|
18
18
|
var _models = _interopRequireDefault(require("./models"));
|
|
19
19
|
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); }; }
|
|
20
20
|
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; } }
|
|
21
|
-
var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
21
|
+
var GeometryLayer = exports.default = /*#__PURE__*/function (_BaseLayer) {
|
|
22
22
|
(0, _inherits2.default)(GeometryLayer, _BaseLayer);
|
|
23
23
|
var _super = _createSuper(GeometryLayer);
|
|
24
24
|
function GeometryLayer() {
|
|
@@ -83,7 +83,7 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
83
83
|
value: function getModelType() {
|
|
84
84
|
var _shapeAttribute$scale;
|
|
85
85
|
var shapeAttribute = this.styleAttributeService.getLayerStyleAttribute('shape');
|
|
86
|
-
var shape = shapeAttribute === null || shapeAttribute === void 0
|
|
86
|
+
var shape = shapeAttribute === null || shapeAttribute === void 0 || (_shapeAttribute$scale = shapeAttribute.scale) === null || _shapeAttribute$scale === void 0 ? void 0 : _shapeAttribute$scale.field;
|
|
87
87
|
if (shape === 'plane') {
|
|
88
88
|
return 'plane';
|
|
89
89
|
} else if (shape === 'sprite') {
|
|
@@ -96,5 +96,4 @@ var GeometryLayer = /*#__PURE__*/function (_BaseLayer) {
|
|
|
96
96
|
}
|
|
97
97
|
}]);
|
|
98
98
|
return GeometryLayer;
|
|
99
|
-
}(_BaseLayer2.default);
|
|
100
|
-
exports.default = GeometryLayer;
|
|
99
|
+
}(_BaseLayer2.default);
|
|
@@ -23,7 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
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";
|
|
24
24
|
/* babel-plugin-inline-import '../shaders/billboard_vert.glsl' */
|
|
25
25
|
var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\nuniform float u_raisingHeight: 0.0;\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 gl_Position = project_common_position_to_clipspace_v2(vec4(x , y, z , 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
26
|
-
var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
26
|
+
var BillBoardModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
27
27
|
(0, _inherits2.default)(BillBoardModel, _BaseModel);
|
|
28
28
|
var _super = _createSuper(BillBoardModel);
|
|
29
29
|
function BillBoardModel() {
|
|
@@ -86,7 +86,7 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
86
86
|
key: "clearModels",
|
|
87
87
|
value: function clearModels() {
|
|
88
88
|
var _this$texture;
|
|
89
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
89
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
90
90
|
}
|
|
91
91
|
}, {
|
|
92
92
|
key: "initModels",
|
|
@@ -214,5 +214,4 @@ var BillBoardModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
214
214
|
}
|
|
215
215
|
}]);
|
|
216
216
|
return BillBoardModel;
|
|
217
|
-
}(_BaseModel2.default);
|
|
218
|
-
exports.default = BillBoardModel;
|
|
217
|
+
}(_BaseModel2.default);
|
|
@@ -24,7 +24,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
24
24
|
var planeFrag = "\nuniform sampler2D u_texture;\nuniform float u_mapFlag;\nuniform float u_opacity;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"picking\"\nvoid main() {\n // gl_FragColor = vec4(v_Color, u_opacity);\n if(u_mapFlag > 0.0) {\n gl_FragColor = texture2D(u_texture, vec2(v_uv.x, 1.0 - v_uv.y));\n gl_FragColor.a *= u_opacity;\n } else {\n // gl_FragColor = vec4(v_uv, 0.0, u_opacity);\n gl_FragColor = vec4(v_Color, u_opacity);\n }\n gl_FragColor.a *= v_clip;\n gl_FragColor = filterColor(gl_FragColor);\n}\n";
|
|
25
25
|
/* babel-plugin-inline-import '../shaders/plane_vert.glsl' */
|
|
26
26
|
var planeVert = "precision highp float;\nuniform mat4 u_ModelMatrix;\n\nuniform float u_opacity;\nuniform float u_terrainClipHeight;\n\nattribute vec3 a_Position;\nattribute vec2 a_Uv;\nattribute vec3 a_Color;\n\nvarying vec3 v_Color;\nvarying vec2 v_uv;\nvarying float v_clip;\n\n#pragma include \"projection\"\n#pragma include \"picking\"\nvoid main() {\n v_Color = a_Color;\n v_uv = a_Uv;\n \n vec4 project_pos = project_position(vec4(a_Position, 1.0));\n\n v_clip = 1.0;\n if(a_Position.z < u_terrainClipHeight) {\n v_clip = 0.0;\n }\n \n gl_Position = project_common_position_to_clipspace_v2(vec4(project_pos.xy, a_Position.z, 1.0));\n\n setPickingColor(a_PickingColor);\n}\n";
|
|
27
|
-
var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
27
|
+
var PlaneModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
28
28
|
(0, _inherits2.default)(PlaneModel, _BaseModel);
|
|
29
29
|
var _super = _createSuper(PlaneModel);
|
|
30
30
|
function PlaneModel() {
|
|
@@ -129,7 +129,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
129
129
|
if (this.mapTexture !== mapTexture) {
|
|
130
130
|
var _this$texture;
|
|
131
131
|
this.mapTexture = mapTexture;
|
|
132
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
132
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
133
133
|
this.updateTexture(mapTexture);
|
|
134
134
|
}
|
|
135
135
|
return {
|
|
@@ -145,7 +145,7 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
145
145
|
var _this$texture2;
|
|
146
146
|
// @ts-ignore
|
|
147
147
|
this.terrainImage = null;
|
|
148
|
-
(_this$texture2 = this.texture) === null || _this$texture2 === void 0
|
|
148
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
149
149
|
}
|
|
150
150
|
}, {
|
|
151
151
|
key: "initModels",
|
|
@@ -378,5 +378,4 @@ var PlaneModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
378
378
|
}
|
|
379
379
|
}]);
|
|
380
380
|
return PlaneModel;
|
|
381
|
-
}(_BaseModel2.default);
|
|
382
|
-
exports.default = PlaneModel;
|
|
381
|
+
}(_BaseModel2.default);
|
|
@@ -29,7 +29,7 @@ var SPRITE_ANIMATE_DIR = /*#__PURE__*/function (SPRITE_ANIMATE_DIR) {
|
|
|
29
29
|
SPRITE_ANIMATE_DIR["DOWN"] = "down";
|
|
30
30
|
return SPRITE_ANIMATE_DIR;
|
|
31
31
|
}(SPRITE_ANIMATE_DIR || {});
|
|
32
|
-
var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
32
|
+
var SpriteModel = exports.default = /*#__PURE__*/function (_BaseModel) {
|
|
33
33
|
(0, _inherits2.default)(SpriteModel, _BaseModel);
|
|
34
34
|
var _super = _createSuper(SpriteModel);
|
|
35
35
|
function SpriteModel() {
|
|
@@ -148,7 +148,7 @@ var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
148
148
|
if (this.mapTexture !== mapTexture) {
|
|
149
149
|
var _this$texture;
|
|
150
150
|
this.mapTexture = mapTexture;
|
|
151
|
-
(_this$texture = this.texture) === null || _this$texture === void 0
|
|
151
|
+
(_this$texture = this.texture) === null || _this$texture === void 0 || _this$texture.destroy();
|
|
152
152
|
this.updateTexture(mapTexture);
|
|
153
153
|
}
|
|
154
154
|
return {
|
|
@@ -163,7 +163,7 @@ var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
163
163
|
value: function clearModels() {
|
|
164
164
|
var _this$texture2;
|
|
165
165
|
cancelAnimationFrame(this.timer);
|
|
166
|
-
(_this$texture2 = this.texture) === null || _this$texture2 === void 0
|
|
166
|
+
(_this$texture2 = this.texture) === null || _this$texture2 === void 0 || _this$texture2.destroy();
|
|
167
167
|
}
|
|
168
168
|
}, {
|
|
169
169
|
key: "initModels",
|
|
@@ -266,5 +266,4 @@ var SpriteModel = /*#__PURE__*/function (_BaseModel) {
|
|
|
266
266
|
}
|
|
267
267
|
}]);
|
|
268
268
|
return SpriteModel;
|
|
269
|
-
}(_BaseModel2.default);
|
|
270
|
-
exports.default = SpriteModel;
|
|
269
|
+
}(_BaseModel2.default);
|