deeptwins-engine-3d 0.1.7 → 0.1.10
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/dist/esm/cameraControl/ModelRoamHistory.d.ts +2 -1
- package/dist/esm/cameraControl/ModelRoamHistory.js +33 -29
- package/dist/esm/cameraControl/ModelRoamRealTime.d.ts +4 -3
- package/dist/esm/cameraControl/ModelRoamRealTime.js +26 -22
- package/dist/esm/cameraControl/Roam.d.ts +3 -1
- package/dist/esm/cameraControl/Roam.js +17 -13
- package/dist/esm/cameraControl/Rotate.d.ts +3 -1
- package/dist/esm/cameraControl/Rotate.js +29 -25
- package/dist/esm/cameraControl/RotateInPlace.d.ts +3 -1
- package/dist/esm/cameraControl/RotateInPlace.js +22 -19
- package/dist/esm/constant.d.ts +12 -0
- package/dist/esm/constant.js +16 -0
- package/dist/esm/graphicLayer/BaseEntity.d.ts +0 -1
- package/dist/esm/graphicLayer/BaseEntity.js +0 -1
- package/dist/esm/graphicLayer/BaseLayer.d.ts +3 -2
- package/dist/esm/graphicLayer/BaseLayer.js +73 -41
- package/dist/esm/graphicLayer/BasePointPrimitive.d.ts +4 -2
- package/dist/esm/graphicLayer/BasePointPrimitive.js +14 -10
- package/dist/esm/graphicLayer/BasePrimitive.d.ts +3 -5
- package/dist/esm/graphicLayer/BasePrimitive.js +4 -18
- package/dist/esm/graphicLayer/BasePrimitiveInstance.d.ts +1 -2
- package/dist/esm/graphicLayer/BasePrimitiveInstance.js +0 -1
- package/dist/esm/graphicLayer/BaseSource.d.ts +4 -3
- package/dist/esm/graphicLayer/BaseSource.js +28 -11
- package/dist/esm/graphicLayer/BillboardEntity.js +3 -6
- package/dist/esm/graphicLayer/BillboardPrimitive.d.ts +2 -0
- package/dist/esm/graphicLayer/BillboardPrimitive.js +29 -5
- package/dist/esm/graphicLayer/BoxEntity.js +2 -5
- package/dist/esm/graphicLayer/BoxPrimitive.d.ts +2 -2
- package/dist/esm/graphicLayer/BoxPrimitive.js +11 -6
- package/dist/esm/graphicLayer/BoxPrimitiveInstance.js +4 -6
- package/dist/esm/graphicLayer/EllipseEntity.js +2 -5
- package/dist/esm/graphicLayer/EllipsePrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/EllipsePrimitive.js +9 -4
- package/dist/esm/graphicLayer/EllipsePrimitiveInstance.js +4 -7
- package/dist/esm/graphicLayer/EllipsoidEntity.js +2 -5
- package/dist/esm/graphicLayer/EllipsoidPrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/EllipsoidPrimitive.js +9 -4
- package/dist/esm/graphicLayer/EllipsoidPrimitiveInstance.js +3 -3
- package/dist/esm/graphicLayer/GraphicLayerCollection.d.ts +9 -7
- package/dist/esm/graphicLayer/GraphicLayerCollection.js +118 -42
- package/dist/esm/graphicLayer/HtmlEntity.js +20 -9
- package/dist/esm/graphicLayer/LabelEntity.js +2 -5
- package/dist/esm/graphicLayer/LabelPrimitive.d.ts +2 -0
- package/dist/esm/graphicLayer/LabelPrimitive.js +31 -8
- package/dist/esm/graphicLayer/ModelEntity.js +2 -5
- package/dist/esm/graphicLayer/ModelPrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/ModelPrimitive.js +2 -1
- package/dist/esm/graphicLayer/ModelPrimitiveInstance.js +4 -7
- package/dist/esm/graphicLayer/PointEntity.js +2 -5
- package/dist/esm/graphicLayer/PointPrimitive.d.ts +2 -0
- package/dist/esm/graphicLayer/PointPrimitive.js +29 -5
- package/dist/esm/graphicLayer/PolygonEntity.js +4 -7
- package/dist/esm/graphicLayer/PolygonPrimitive.d.ts +2 -2
- package/dist/esm/graphicLayer/PolygonPrimitive.js +11 -6
- package/dist/esm/graphicLayer/PolygonPrimitiveInstance.js +4 -7
- package/dist/esm/graphicLayer/PolylineEntity.js +4 -7
- package/dist/esm/graphicLayer/PolylinePrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/PolylinePrimitive.js +9 -4
- package/dist/esm/graphicLayer/PolylinePrimitiveInstance.js +3 -3
- package/dist/esm/graphicLayer/PolylineVolumeEntity.js +3 -5
- package/dist/esm/graphicLayer/PolylineVolumePrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/PolylineVolumePrimitive.js +9 -4
- package/dist/esm/graphicLayer/PolylineVolumePrimitiveInstance.js +4 -7
- package/dist/esm/graphicLayer/WallEntity.js +4 -7
- package/dist/esm/graphicLayer/WallPrimitive.d.ts +1 -1
- package/dist/esm/graphicLayer/WallPrimitive.js +9 -4
- package/dist/esm/graphicLayer/WallPrimitiveInstance.js +4 -7
- package/dist/esm/index.js +1 -1
- package/dist/esm/map/Event.d.ts +4 -2
- package/dist/esm/map/Event.js +19 -14
- package/dist/esm/map/Map.d.ts +6 -1
- package/dist/esm/map/Map.js +14 -4
- package/dist/esm/material/WeatherEffects.d.ts +3 -1
- package/dist/esm/material/WeatherEffects.js +11 -6
- package/dist/esm/tool/common.d.ts +3 -1
- package/dist/esm/tool/common.js +13 -8
- package/dist/esm/tool/utils.d.ts +2 -0
- package/dist/esm/tool/utils.js +10 -0
- package/dist/esm/videoFusion/BaseVideo.d.ts +6 -2
- package/dist/esm/videoFusion/BaseVideo.js +48 -19
- package/dist/esm/videoFusion/VideoProject.js +16 -10
- package/dist/esm/videoFusion/VideoTexture.js +4 -2
- package/dist/esm/visualization/Airspace.d.ts +3 -1
- package/dist/esm/visualization/Airspace.js +27 -12
- package/dist/esm/visualization/BaseFrustum.d.ts +3 -1
- package/dist/esm/visualization/BaseFrustum.js +23 -9
- package/dist/esm/visualization/BaseHeatmap.d.ts +4 -2
- package/dist/esm/visualization/BaseHeatmap.js +22 -12
- package/dist/esm/visualization/Frustum.js +6 -6
- package/dist/esm/visualization/FrustumWithCamera.js +9 -9
- package/dist/esm/visualization/Heatmap2d.js +32 -6
- package/dist/esm/visualization/Heatmap3d.js +21 -4
- package/dist/esm/visualization/PointCluster.d.ts +3 -1
- package/dist/esm/visualization/PointCluster.js +26 -14
- package/dist/umd/deeptwins-engine-3d.min.js +1 -1
- package/package.json +1 -2
|
@@ -10,29 +10,37 @@ import { DEFAULT_AIRSPACE_STYLE } from "../constant";
|
|
|
10
10
|
import BaseSource from "../graphicLayer/BaseSource";
|
|
11
11
|
import BoxPrimitive from "../graphicLayer/BoxPrimitive";
|
|
12
12
|
import BoxPrimitiveInstance from "../graphicLayer/BoxPrimitiveInstance";
|
|
13
|
+
import * as utils from "../tool/utils";
|
|
13
14
|
|
|
14
15
|
// 空域绘制
|
|
15
16
|
var Airspace = /*#__PURE__*/function () {
|
|
16
17
|
function Airspace(map, geoJson) {
|
|
17
18
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
18
19
|
_classCallCheck(this, Airspace);
|
|
19
|
-
_defineProperty(this, "
|
|
20
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
20
21
|
_defineProperty(this, "options", void 0);
|
|
21
22
|
_defineProperty(this, "primitives", []);
|
|
22
23
|
_defineProperty(this, "isDestroyed", false);
|
|
23
|
-
this.
|
|
24
|
+
this._mapContext = map._mapContext;
|
|
24
25
|
this.options = merge(DEFAULT_AIRSPACE_STYLE(), options);
|
|
25
26
|
var source = BaseSource.geoJsonToGeoCartesian3Array(geoJson);
|
|
26
27
|
this.sliceArrayAsync(source, this.options.chunkSize);
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
// 是否能进行操作
|
|
30
29
|
_createClass(Airspace, [{
|
|
30
|
+
key: "getMap",
|
|
31
|
+
value: function getMap() {
|
|
32
|
+
return this._mapContext && this._mapContext.getMap();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// 是否能进行操作
|
|
36
|
+
}, {
|
|
31
37
|
key: "_canOperate",
|
|
32
38
|
value: function _canOperate() {
|
|
33
39
|
if (this.isDestroyed) {
|
|
34
|
-
|
|
40
|
+
utils.error('Airspace实例已销毁');
|
|
41
|
+
return false;
|
|
35
42
|
}
|
|
43
|
+
return true;
|
|
36
44
|
}
|
|
37
45
|
|
|
38
46
|
// 每10w条数据切片
|
|
@@ -41,6 +49,9 @@ var Airspace = /*#__PURE__*/function () {
|
|
|
41
49
|
value: function sliceArrayAsync(data) {
|
|
42
50
|
var _this = this;
|
|
43
51
|
var chunkSize = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 10000;
|
|
52
|
+
if (!this._canOperate()) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
44
55
|
var processChunk = function processChunk() {
|
|
45
56
|
if (data.length === 0) return;
|
|
46
57
|
_this.create(data.splice(0, chunkSize));
|
|
@@ -51,8 +62,12 @@ var Airspace = /*#__PURE__*/function () {
|
|
|
51
62
|
}, {
|
|
52
63
|
key: "create",
|
|
53
64
|
value: function create(source) {
|
|
54
|
-
|
|
65
|
+
if (!this._canOperate()) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
var boxPrimitive = new BoxPrimitive(this._mapContext);
|
|
55
69
|
this.primitives.push(boxPrimitive);
|
|
70
|
+
var primitiveInstance = [];
|
|
56
71
|
for (var i = 0; i < source.length; i++) {
|
|
57
72
|
new BoxPrimitiveInstance({
|
|
58
73
|
positions: source[i].positions,
|
|
@@ -61,25 +76,25 @@ var Airspace = /*#__PURE__*/function () {
|
|
|
61
76
|
dimensions: this.options.dimensions,
|
|
62
77
|
scale: this.options.scale
|
|
63
78
|
},
|
|
64
|
-
|
|
79
|
+
primitiveInstance: primitiveInstance
|
|
65
80
|
});
|
|
66
81
|
}
|
|
67
82
|
boxPrimitive.createPrimitive({
|
|
68
83
|
style: this.options
|
|
69
|
-
});
|
|
70
|
-
boxPrimitive.
|
|
71
|
-
this._map.scene.primitives.add(boxPrimitive.primitive);
|
|
84
|
+
}, primitiveInstance);
|
|
85
|
+
this.getMap().scene.primitives.add(boxPrimitive.primitive);
|
|
72
86
|
}
|
|
73
87
|
}, {
|
|
74
88
|
key: "destroy",
|
|
75
89
|
value: function destroy() {
|
|
76
|
-
this._canOperate()
|
|
90
|
+
if (!this._canOperate()) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
77
93
|
this.isDestroyed = true;
|
|
78
94
|
for (var i = 0; i < this.primitives.length; i++) {
|
|
79
95
|
this.primitives[i].removeAll();
|
|
80
96
|
}
|
|
81
97
|
this.primitives = [];
|
|
82
|
-
this._map = null;
|
|
83
98
|
}
|
|
84
99
|
}]);
|
|
85
100
|
return Airspace;
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { MapContext } from '../map/Map';
|
|
1
2
|
export default class BaseFrustum {
|
|
2
|
-
|
|
3
|
+
_mapContext: MapContext | undefined;
|
|
3
4
|
options: any;
|
|
4
5
|
frustumPrimitive: any;
|
|
5
6
|
frustumLinePrimitive: any;
|
|
6
7
|
isDestroyed: boolean;
|
|
7
8
|
constructor(map: any, options: any);
|
|
9
|
+
getMap(): any;
|
|
8
10
|
private _canOperate;
|
|
9
11
|
getFrustumVertexPoints(): any;
|
|
10
12
|
show(isShow: boolean): void;
|
|
@@ -12,7 +12,7 @@ import * as utils from "../tool/utils";
|
|
|
12
12
|
var BaseFrustum = /*#__PURE__*/function () {
|
|
13
13
|
function BaseFrustum(map, options) {
|
|
14
14
|
_classCallCheck(this, BaseFrustum);
|
|
15
|
-
_defineProperty(this, "
|
|
15
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
16
16
|
// 参数
|
|
17
17
|
_defineProperty(this, "options", void 0);
|
|
18
18
|
// 视锥面
|
|
@@ -20,24 +20,33 @@ var BaseFrustum = /*#__PURE__*/function () {
|
|
|
20
20
|
// 视锥线
|
|
21
21
|
_defineProperty(this, "frustumLinePrimitive", void 0);
|
|
22
22
|
_defineProperty(this, "isDestroyed", false);
|
|
23
|
-
this.
|
|
23
|
+
this._mapContext = map._mapContext;
|
|
24
24
|
this.options = options;
|
|
25
25
|
}
|
|
26
|
-
|
|
27
|
-
// 是否能进行操作
|
|
28
26
|
_createClass(BaseFrustum, [{
|
|
27
|
+
key: "getMap",
|
|
28
|
+
value: function getMap() {
|
|
29
|
+
return this._mapContext && this._mapContext.getMap();
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// 是否能进行操作
|
|
33
|
+
}, {
|
|
29
34
|
key: "_canOperate",
|
|
30
35
|
value: function _canOperate() {
|
|
31
36
|
if (this.isDestroyed) {
|
|
32
|
-
|
|
37
|
+
utils.error('Frustum实例已销毁');
|
|
38
|
+
return false;
|
|
33
39
|
}
|
|
40
|
+
return true;
|
|
34
41
|
}
|
|
35
42
|
|
|
36
43
|
// 获取顶点坐标
|
|
37
44
|
}, {
|
|
38
45
|
key: "getFrustumVertexPoints",
|
|
39
46
|
value: function getFrustumVertexPoints() {
|
|
40
|
-
this._canOperate()
|
|
47
|
+
if (!this._canOperate()) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
41
50
|
var geometry = Cesium.FrustumOutlineGeometry.createGeometry(this.frustumPrimitive.geometryInstances.geometry);
|
|
42
51
|
var positions = geometry.attributes.position.values;
|
|
43
52
|
|
|
@@ -61,6 +70,9 @@ var BaseFrustum = /*#__PURE__*/function () {
|
|
|
61
70
|
}, {
|
|
62
71
|
key: "show",
|
|
63
72
|
value: function show(isShow) {
|
|
73
|
+
if (!this._canOperate()) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
64
76
|
this.frustumPrimitive && (this.frustumPrimitive.show = isShow);
|
|
65
77
|
this.frustumLinePrimitive && (this.frustumLinePrimitive.show = isShow);
|
|
66
78
|
}
|
|
@@ -69,11 +81,13 @@ var BaseFrustum = /*#__PURE__*/function () {
|
|
|
69
81
|
}, {
|
|
70
82
|
key: "destroy",
|
|
71
83
|
value: function destroy() {
|
|
72
|
-
this._canOperate()
|
|
84
|
+
if (!this._canOperate()) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
73
87
|
this.isDestroyed = true;
|
|
74
|
-
this.frustumPrimitive && this.
|
|
88
|
+
this.frustumPrimitive && this.getMap().scene.primitives.remove(this.frustumPrimitive);
|
|
75
89
|
this.frustumPrimitive = null;
|
|
76
|
-
this.frustumLinePrimitive && this.
|
|
90
|
+
this.frustumLinePrimitive && this.getMap().scene.primitives.remove(this.frustumLinePrimitive);
|
|
77
91
|
this.frustumLinePrimitive = null;
|
|
78
92
|
}
|
|
79
93
|
}]);
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { MapContext } from '../map/Map';
|
|
1
2
|
export default class BaseHeatmap {
|
|
3
|
+
_mapContext: MapContext | undefined;
|
|
2
4
|
id: any;
|
|
3
5
|
heatmapInstance: any;
|
|
4
6
|
positions: any[];
|
|
@@ -10,11 +12,11 @@ export default class BaseHeatmap {
|
|
|
10
12
|
isDestroyed: boolean;
|
|
11
13
|
canvasW: number;
|
|
12
14
|
canvasH: number;
|
|
13
|
-
_map: any;
|
|
14
15
|
heatmapEntity: any;
|
|
15
16
|
heatmapPrimitive: any;
|
|
16
17
|
constructor(options?: any);
|
|
17
|
-
|
|
18
|
+
_canOperate(): boolean;
|
|
19
|
+
getMap(): any;
|
|
18
20
|
flyTo(options: any): void;
|
|
19
21
|
_translatePositions(): void;
|
|
20
22
|
private _computeBound;
|
|
@@ -21,6 +21,7 @@ var BaseHeatmap = /*#__PURE__*/function () {
|
|
|
21
21
|
function BaseHeatmap() {
|
|
22
22
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
23
23
|
_classCallCheck(this, BaseHeatmap);
|
|
24
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
24
25
|
_defineProperty(this, "id", void 0);
|
|
25
26
|
_defineProperty(this, "heatmapInstance", void 0);
|
|
26
27
|
_defineProperty(this, "positions", []);
|
|
@@ -32,7 +33,6 @@ var BaseHeatmap = /*#__PURE__*/function () {
|
|
|
32
33
|
_defineProperty(this, "isDestroyed", false);
|
|
33
34
|
_defineProperty(this, "canvasW", 0);
|
|
34
35
|
_defineProperty(this, "canvasH", 0);
|
|
35
|
-
_defineProperty(this, "_map", void 0);
|
|
36
36
|
_defineProperty(this, "heatmapEntity", void 0);
|
|
37
37
|
_defineProperty(this, "heatmapPrimitive", void 0);
|
|
38
38
|
var positions = options.positions,
|
|
@@ -59,17 +59,26 @@ var BaseHeatmap = /*#__PURE__*/function () {
|
|
|
59
59
|
|
|
60
60
|
// 是否能进行操作
|
|
61
61
|
_createClass(BaseHeatmap, [{
|
|
62
|
-
key: "
|
|
63
|
-
value: function
|
|
62
|
+
key: "_canOperate",
|
|
63
|
+
value: function _canOperate() {
|
|
64
64
|
if (this.isDestroyed) {
|
|
65
|
-
|
|
65
|
+
utils.error('heatmap实例已销毁');
|
|
66
|
+
return false;
|
|
66
67
|
}
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
}, {
|
|
71
|
+
key: "getMap",
|
|
72
|
+
value: function getMap() {
|
|
73
|
+
return this._mapContext && this._mapContext.getMap();
|
|
67
74
|
}
|
|
68
75
|
}, {
|
|
69
76
|
key: "flyTo",
|
|
70
77
|
value: function flyTo(options) {
|
|
71
|
-
this.
|
|
72
|
-
|
|
78
|
+
if (!this._canOperate()) {
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (this.getMap()) {
|
|
73
82
|
var boundingSphere = Cesium.BoundingSphere.fromPoints([this.boundBox.leftTop, this.boundBox.leftBottom, this.boundBox.rightBottom, this.boundBox.rightTop]);
|
|
74
83
|
var _ref = options || {},
|
|
75
84
|
_ref$heading = _ref.heading,
|
|
@@ -84,7 +93,7 @@ var BaseHeatmap = /*#__PURE__*/function () {
|
|
|
84
93
|
if (heading || pitch) {
|
|
85
94
|
backOptions.offset = new Cesium.HeadingPitchRange(utils.toRadians(heading), utils.toRadians(pitch), 0);
|
|
86
95
|
}
|
|
87
|
-
this.
|
|
96
|
+
this.getMap().camera.flyToBoundingSphere(boundingSphere, backOptions);
|
|
88
97
|
}
|
|
89
98
|
}
|
|
90
99
|
|
|
@@ -188,24 +197,25 @@ var BaseHeatmap = /*#__PURE__*/function () {
|
|
|
188
197
|
}, {
|
|
189
198
|
key: "destroy",
|
|
190
199
|
value: function destroy() {
|
|
191
|
-
this.
|
|
192
|
-
|
|
200
|
+
if (!this._canOperate()) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
if (this.getMap()) {
|
|
193
204
|
this.isDestroyed = true;
|
|
194
205
|
var heatmapContainer = document.getElementById(this.id);
|
|
195
206
|
heatmapContainer && heatmapContainer.remove();
|
|
196
207
|
if (this.heatmapPrimitive) {
|
|
197
|
-
this.
|
|
208
|
+
this.getMap().scene.primitives.remove(this.heatmapPrimitive);
|
|
198
209
|
this.heatmapPrimitive = null;
|
|
199
210
|
}
|
|
200
211
|
if (this.heatmapEntity) {
|
|
201
|
-
this.
|
|
212
|
+
this.getMap().entities.remove(this.heatmapEntity);
|
|
202
213
|
this.heatmapEntity = null;
|
|
203
214
|
}
|
|
204
215
|
this.heatmapInstance = null;
|
|
205
216
|
this.positions = [];
|
|
206
217
|
this.hierarchy = [];
|
|
207
218
|
this.sources = [];
|
|
208
|
-
this._map = null;
|
|
209
219
|
}
|
|
210
220
|
}
|
|
211
221
|
}]);
|
|
@@ -73,13 +73,13 @@ var Frustum = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
73
73
|
var orientation = Cesium.Transforms.headingPitchRollQuaternion(positionCartesian3, hpr);
|
|
74
74
|
var frustum = new Cesium.PerspectiveFrustum({
|
|
75
75
|
// 查看的视场角
|
|
76
|
-
fov: fov ? utils.toRadians(fov) : this.
|
|
76
|
+
fov: fov ? utils.toRadians(fov) : this.getMap().camera.frustum.fov,
|
|
77
77
|
// 视锥体的宽度/高度
|
|
78
|
-
aspectRatio: aspectRatio ? aspectRatio : this.
|
|
78
|
+
aspectRatio: aspectRatio ? aspectRatio : this.getMap().camera.frustum.aspectRatio,
|
|
79
79
|
// 近面距视点的距离
|
|
80
|
-
near: near ? near : this.
|
|
80
|
+
near: near ? near : this.getMap().camera.frustum.near,
|
|
81
81
|
// 远面距视点的距离
|
|
82
|
-
far: far ? far : this.
|
|
82
|
+
far: far ? far : this.getMap().camera.frustum.far
|
|
83
83
|
});
|
|
84
84
|
this.frustumPrimitive = new Cesium.Primitive({
|
|
85
85
|
geometryInstances: new Cesium.GeometryInstance({
|
|
@@ -102,7 +102,7 @@ var Frustum = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
102
102
|
asynchronous: false
|
|
103
103
|
});
|
|
104
104
|
this.frustumPrimitive.show = show;
|
|
105
|
-
this.
|
|
105
|
+
this.getMap().scene.primitives.add(this.frustumPrimitive);
|
|
106
106
|
if (outline) {
|
|
107
107
|
this.frustumLinePrimitive = new Cesium.Primitive({
|
|
108
108
|
geometryInstances: new Cesium.GeometryInstance({
|
|
@@ -123,7 +123,7 @@ var Frustum = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
123
123
|
asynchronous: false
|
|
124
124
|
});
|
|
125
125
|
this.frustumLinePrimitive.show = show;
|
|
126
|
-
this.
|
|
126
|
+
this.getMap().scene.primitives.add(this.frustumLinePrimitive);
|
|
127
127
|
}
|
|
128
128
|
}
|
|
129
129
|
}]);
|
|
@@ -60,19 +60,19 @@ var FrustumWithCamera = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
60
60
|
var positionCartesian3 = utils.lngLatAltToCartesian3(lng, lat, alt);
|
|
61
61
|
var frustum = new Cesium.PerspectiveFrustum({
|
|
62
62
|
// 查看的视场角,绕Z轴旋转,以弧度方式输入
|
|
63
|
-
fov: fov ? utils.toRadians(fov) : this.
|
|
63
|
+
fov: fov ? utils.toRadians(fov) : this.getMap().camera.frustum.fov,
|
|
64
64
|
// 视锥体的宽度/高度
|
|
65
|
-
aspectRatio: aspectRatio ? aspectRatio : this.
|
|
65
|
+
aspectRatio: aspectRatio ? aspectRatio : this.getMap().camera.frustum.aspectRatio,
|
|
66
66
|
// 近面距视点的距离
|
|
67
|
-
near: near ? near : this.
|
|
67
|
+
near: near ? near : this.getMap().camera.frustum.near,
|
|
68
68
|
// 远面距视点的距离
|
|
69
|
-
far: far ? far : this.
|
|
69
|
+
far: far ? far : this.getMap().camera.frustum.far
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
// 计算摄像机的方向四元数
|
|
73
|
-
var direction = Cesium.Cartesian3.clone(this.
|
|
74
|
-
var up = Cesium.Cartesian3.clone(this.
|
|
75
|
-
var right = Cesium.Cartesian3.clone(this.
|
|
73
|
+
var direction = Cesium.Cartesian3.clone(this.getMap().camera.directionWC);
|
|
74
|
+
var up = Cesium.Cartesian3.clone(this.getMap().camera.upWC);
|
|
75
|
+
var right = Cesium.Cartesian3.clone(this.getMap().camera.rightWC);
|
|
76
76
|
var rotationMatrix = new Cesium.Matrix3();
|
|
77
77
|
Cesium.Matrix3.setColumn(rotationMatrix, 0, right, rotationMatrix); // X 轴
|
|
78
78
|
Cesium.Matrix3.setColumn(rotationMatrix, 1, up, rotationMatrix); // Y 轴
|
|
@@ -99,7 +99,7 @@ var FrustumWithCamera = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
99
99
|
asynchronous: false
|
|
100
100
|
});
|
|
101
101
|
this.frustumPrimitive.show = show;
|
|
102
|
-
this.
|
|
102
|
+
this.getMap().scene.primitives.add(this.frustumPrimitive);
|
|
103
103
|
if (outline) {
|
|
104
104
|
this.frustumLinePrimitive = new Cesium.Primitive({
|
|
105
105
|
geometryInstances: new Cesium.GeometryInstance({
|
|
@@ -122,7 +122,7 @@ var FrustumWithCamera = /*#__PURE__*/function (_BaseFrustum) {
|
|
|
122
122
|
asynchronous: false
|
|
123
123
|
});
|
|
124
124
|
this.frustumLinePrimitive.show = show;
|
|
125
|
-
this.
|
|
125
|
+
this.getMap().scene.primitives.add(this.frustumLinePrimitive);
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
}]);
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -26,10 +32,21 @@ var Heatmap2d = /*#__PURE__*/function (_BaseHeatmap) {
|
|
|
26
32
|
_createClass(Heatmap2d, [{
|
|
27
33
|
key: "addToMap",
|
|
28
34
|
value: function addToMap(map) {
|
|
29
|
-
this.
|
|
30
|
-
|
|
35
|
+
if (!this._canOperate()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this._mapContext = map._mapContext;
|
|
31
39
|
if (!this.boundBox) return;
|
|
32
|
-
this.
|
|
40
|
+
var _this$style = this.style,
|
|
41
|
+
min = _this$style.min,
|
|
42
|
+
max = _this$style.max;
|
|
43
|
+
this.heatmapInstance.setData({
|
|
44
|
+
min: min || 0,
|
|
45
|
+
max: max || Math.max.apply(Math, _toConsumableArray(this.sources.map(function (t) {
|
|
46
|
+
return t.value;
|
|
47
|
+
}))),
|
|
48
|
+
data: this.sources
|
|
49
|
+
});
|
|
33
50
|
this._createPolygonEntity();
|
|
34
51
|
}
|
|
35
52
|
|
|
@@ -51,10 +68,10 @@ var Heatmap2d = /*#__PURE__*/function (_BaseHeatmap) {
|
|
|
51
68
|
heightReference: this.style.heightReference,
|
|
52
69
|
perPositionHeight: this.style.perPositionHeight
|
|
53
70
|
};
|
|
54
|
-
if (this.style.
|
|
71
|
+
if (this.style.heightReference === Cesium.HeightReference.NONE) {
|
|
55
72
|
polygonInfo.height = this.style.height;
|
|
56
73
|
}
|
|
57
|
-
this.heatmapEntity = this.
|
|
74
|
+
this.heatmapEntity = this.getMap().entities.add({
|
|
58
75
|
id: this.id,
|
|
59
76
|
polygon: polygonInfo
|
|
60
77
|
});
|
|
@@ -64,12 +81,21 @@ var Heatmap2d = /*#__PURE__*/function (_BaseHeatmap) {
|
|
|
64
81
|
}, {
|
|
65
82
|
key: "setData",
|
|
66
83
|
value: function setData(positions) {
|
|
67
|
-
this.
|
|
84
|
+
if (!this._canOperate()) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
68
87
|
this.hierarchy = [];
|
|
69
88
|
this.sources = [];
|
|
70
89
|
this.positions = positions;
|
|
71
90
|
this._translatePositions();
|
|
91
|
+
var _this$style2 = this.style,
|
|
92
|
+
min = _this$style2.min,
|
|
93
|
+
max = _this$style2.max;
|
|
72
94
|
this.heatmapInstance.setData({
|
|
95
|
+
min: min || 0,
|
|
96
|
+
max: max || Math.max.apply(Math, _toConsumableArray(this.sources.map(function (t) {
|
|
97
|
+
return t.value;
|
|
98
|
+
}))),
|
|
73
99
|
data: this.sources
|
|
74
100
|
});
|
|
75
101
|
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
3
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
6
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
7
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
2
8
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
3
9
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
4
10
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
@@ -26,10 +32,21 @@ var Heatmap3d = /*#__PURE__*/function (_BaseHeatmap) {
|
|
|
26
32
|
_createClass(Heatmap3d, [{
|
|
27
33
|
key: "addToMap",
|
|
28
34
|
value: function addToMap(map) {
|
|
29
|
-
this.
|
|
30
|
-
|
|
35
|
+
if (!this._canOperate()) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
this._mapContext = map._mapContext;
|
|
31
39
|
if (!this.boundBox) return;
|
|
32
|
-
this.
|
|
40
|
+
var _this$style = this.style,
|
|
41
|
+
min = _this$style.min,
|
|
42
|
+
max = _this$style.max;
|
|
43
|
+
this.heatmapInstance.setData({
|
|
44
|
+
min: min || 0,
|
|
45
|
+
max: max || Math.max.apply(Math, _toConsumableArray(this.sources.map(function (t) {
|
|
46
|
+
return t.value;
|
|
47
|
+
}))),
|
|
48
|
+
data: this.sources
|
|
49
|
+
});
|
|
33
50
|
this._createPolygonPrimitive();
|
|
34
51
|
}
|
|
35
52
|
}, {
|
|
@@ -56,7 +73,7 @@ var Heatmap3d = /*#__PURE__*/function (_BaseHeatmap) {
|
|
|
56
73
|
var geometryInstance = new Cesium.GeometryInstance({
|
|
57
74
|
geometry: geometry
|
|
58
75
|
});
|
|
59
|
-
this.heatmapPrimitive = this.
|
|
76
|
+
this.heatmapPrimitive = this.getMap().scene.primitives.add(new Cesium.Primitive({
|
|
60
77
|
geometryInstances: [geometryInstance],
|
|
61
78
|
appearance: new Cesium.MaterialAppearance({
|
|
62
79
|
material: new Cesium.Material({
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { MapContext } from '../map/Map';
|
|
1
2
|
export default class PointCluster {
|
|
3
|
+
_mapContext: MapContext | undefined;
|
|
2
4
|
options: any;
|
|
3
5
|
source: any;
|
|
4
6
|
billboards: any;
|
|
@@ -6,8 +8,8 @@ export default class PointCluster {
|
|
|
6
8
|
billboardsCollectionCombine: any;
|
|
7
9
|
primitivesCollection: any;
|
|
8
10
|
isDestroyed: boolean;
|
|
9
|
-
private _map;
|
|
10
11
|
constructor(map: any, options: any);
|
|
12
|
+
getMap(): any;
|
|
11
13
|
private _canOperate;
|
|
12
14
|
createCluster(): void;
|
|
13
15
|
private _drawImage;
|
|
@@ -20,6 +20,7 @@ import * as utils from "../tool/utils";
|
|
|
20
20
|
var PointCluster = /*#__PURE__*/function () {
|
|
21
21
|
function PointCluster(map, options) {
|
|
22
22
|
_classCallCheck(this, PointCluster);
|
|
23
|
+
_defineProperty(this, "_mapContext", void 0);
|
|
23
24
|
_defineProperty(this, "options", void 0);
|
|
24
25
|
_defineProperty(this, "source", void 0);
|
|
25
26
|
_defineProperty(this, "billboards", []);
|
|
@@ -27,24 +28,30 @@ var PointCluster = /*#__PURE__*/function () {
|
|
|
27
28
|
_defineProperty(this, "billboardsCollectionCombine", void 0);
|
|
28
29
|
_defineProperty(this, "primitivesCollection", void 0);
|
|
29
30
|
_defineProperty(this, "isDestroyed", false);
|
|
30
|
-
|
|
31
|
-
this._map = map;
|
|
31
|
+
this._mapContext = map._mapContext;
|
|
32
32
|
this.options = Object.assign(DEFAULT_POINT_CLUSTER_STYLE(), cloneDeep(options));
|
|
33
33
|
// 初始化标签实例
|
|
34
34
|
this.billboardsCollectionCombine = new Cesium.BillboardCollection();
|
|
35
35
|
// 初始化实体
|
|
36
|
-
this.primitivesCollection = this.
|
|
36
|
+
this.primitivesCollection = this.getMap().scene.primitives.add(new Cesium.PrimitiveCollection());
|
|
37
37
|
this.source = BaseSource.geoJsonToGeoCartesian3Array(this.options.data);
|
|
38
38
|
this.createCluster();
|
|
39
39
|
}
|
|
40
|
-
|
|
41
|
-
// 是否能进行操作
|
|
42
40
|
_createClass(PointCluster, [{
|
|
41
|
+
key: "getMap",
|
|
42
|
+
value: function getMap() {
|
|
43
|
+
return this._mapContext && this._mapContext.getMap();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 是否能进行操作
|
|
47
|
+
}, {
|
|
43
48
|
key: "_canOperate",
|
|
44
49
|
value: function _canOperate() {
|
|
45
50
|
if (this.isDestroyed) {
|
|
46
|
-
|
|
51
|
+
utils.error('PointCluster实例已销毁');
|
|
52
|
+
return false;
|
|
47
53
|
}
|
|
54
|
+
return true;
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
// 创建聚合
|
|
@@ -52,7 +59,9 @@ var PointCluster = /*#__PURE__*/function () {
|
|
|
52
59
|
key: "createCluster",
|
|
53
60
|
value: function createCluster() {
|
|
54
61
|
var _this = this;
|
|
55
|
-
this._canOperate()
|
|
62
|
+
if (!this._canOperate()) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
56
65
|
// @ts-ignore
|
|
57
66
|
var primitiveCluster = new PrimitiveCluster();
|
|
58
67
|
primitiveCluster.enabled = this.options.enabled;
|
|
@@ -75,7 +84,7 @@ var PointCluster = /*#__PURE__*/function () {
|
|
|
75
84
|
// 将数据传给primitiveCluster的标签属性
|
|
76
85
|
primitiveCluster._billboardCollection = this.billboardsCollectionCombine;
|
|
77
86
|
// 初始化
|
|
78
|
-
primitiveCluster._initialize(this.
|
|
87
|
+
primitiveCluster._initialize(this.getMap().scene);
|
|
79
88
|
// 将标签数据添加到实体中
|
|
80
89
|
this.primitivesCollection.add(primitiveCluster);
|
|
81
90
|
|
|
@@ -134,7 +143,9 @@ var PointCluster = /*#__PURE__*/function () {
|
|
|
134
143
|
}, {
|
|
135
144
|
key: "flyTo",
|
|
136
145
|
value: function flyTo(options) {
|
|
137
|
-
this._canOperate()
|
|
146
|
+
if (!this._canOperate()) {
|
|
147
|
+
return;
|
|
148
|
+
}
|
|
138
149
|
// 计算包围球
|
|
139
150
|
var positions = flattenDeep(this.source.map(function (t) {
|
|
140
151
|
return t.positions;
|
|
@@ -153,27 +164,28 @@ var PointCluster = /*#__PURE__*/function () {
|
|
|
153
164
|
if (heading || pitch) {
|
|
154
165
|
backOptions.offset = new Cesium.HeadingPitchRange(utils.toRadians(heading), utils.toRadians(pitch), 0);
|
|
155
166
|
}
|
|
156
|
-
this.
|
|
167
|
+
this.getMap().camera.flyToBoundingSphere(boundingSphere, backOptions);
|
|
157
168
|
}
|
|
158
169
|
|
|
159
170
|
// 监听
|
|
160
171
|
}, {
|
|
161
172
|
key: "on",
|
|
162
173
|
value: function on(type, event) {
|
|
163
|
-
return this.
|
|
174
|
+
return this.getMap()._event.listenToPointCluster(type, event, this);
|
|
164
175
|
}
|
|
165
176
|
}, {
|
|
166
177
|
key: "destroy",
|
|
167
178
|
value: function destroy() {
|
|
168
|
-
this._canOperate()
|
|
179
|
+
if (!this._canOperate()) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
169
182
|
this.isDestroyed = true;
|
|
170
|
-
this.
|
|
183
|
+
this.getMap().scene.primitives.remove(this.primitivesCollection);
|
|
171
184
|
this.source = null;
|
|
172
185
|
this.clusterIcon = {};
|
|
173
186
|
this.billboardsCollectionCombine = null;
|
|
174
187
|
this.primitivesCollection = null;
|
|
175
188
|
this.billboards = [];
|
|
176
|
-
this._map = null;
|
|
177
189
|
}
|
|
178
190
|
}]);
|
|
179
191
|
return PointCluster;
|