deeptwins-engine-3d 0.1.45 → 0.1.46
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/index.js
CHANGED
|
@@ -58,11 +58,11 @@ DEEP_TWINS_BASE_URL && (window.CESIUM_BASE_URL = DEEP_TWINS_BASE_URL);
|
|
|
58
58
|
// 全局加载css
|
|
59
59
|
loadCss(Cesium.buildModuleUrl('Widgets/widgets.css'));
|
|
60
60
|
// 打印版本信息
|
|
61
|
-
console.log('DeepTwinsEngine3D Version:', "0.1.
|
|
61
|
+
console.log('DeepTwinsEngine3D Version:', "0.1.46");
|
|
62
62
|
export var DeepTwinsEngine3D = /*#__PURE__*/_createClass(function DeepTwinsEngine3D() {
|
|
63
63
|
_classCallCheck(this, DeepTwinsEngine3D);
|
|
64
64
|
});
|
|
65
|
-
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.
|
|
65
|
+
_defineProperty(DeepTwinsEngine3D, "Version", "0.1.46");
|
|
66
66
|
_defineProperty(DeepTwinsEngine3D, "Map", Map);
|
|
67
67
|
_defineProperty(DeepTwinsEngine3D, "GroundSkyBox", GroundSkyBox);
|
|
68
68
|
_defineProperty(DeepTwinsEngine3D, "RasterLayer", RasterLayer);
|
|
@@ -66,9 +66,9 @@ var BaseVideo = /*#__PURE__*/function () {
|
|
|
66
66
|
if (!videoContainer) {
|
|
67
67
|
return;
|
|
68
68
|
}
|
|
69
|
-
this.videoElement = document.createElement('video');
|
|
70
|
-
this.videoElement.id = uuidv4();
|
|
71
69
|
if (this.videoType === 'video') {
|
|
70
|
+
this.videoElement = document.createElement('video');
|
|
71
|
+
this.videoElement.id = uuidv4();
|
|
72
72
|
var _merge = merge(DEFAULT_VIDEO_TEXTURE_VIDEO(), this.options.video),
|
|
73
73
|
loop = _merge.loop,
|
|
74
74
|
muted = _merge.muted,
|
|
@@ -89,6 +89,8 @@ var BaseVideo = /*#__PURE__*/function () {
|
|
|
89
89
|
this.videoElement.appendChild(sourceEl);
|
|
90
90
|
videoContainer.appendChild(this.videoElement);
|
|
91
91
|
} else if (this.videoType === 'hls') {
|
|
92
|
+
this.videoElement = document.createElement('video');
|
|
93
|
+
this.videoElement.id = uuidv4();
|
|
92
94
|
var _merge2 = merge(DEFAULT_VIDEO_TEXTURE_HLS(), this.options.hls),
|
|
93
95
|
_muted = _merge2.muted,
|
|
94
96
|
_autoPlay = _merge2.autoPlay,
|
|
@@ -128,16 +130,15 @@ var BaseVideo = /*#__PURE__*/function () {
|
|
|
128
130
|
});
|
|
129
131
|
}
|
|
130
132
|
} else if (this.videoType === 'custom') {
|
|
131
|
-
var
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
this.videoElement.width = _width2;
|
|
136
|
-
this.videoElement.height = _height2;
|
|
137
|
-
videoContainer.appendChild(this.videoElement);
|
|
133
|
+
var element = document.createElement('div');
|
|
134
|
+
element.id = uuidv4();
|
|
135
|
+
var onReady = this.options.custom.onReady;
|
|
136
|
+
videoContainer.appendChild(element);
|
|
138
137
|
if (onReady) {
|
|
139
138
|
this.status = 'READY';
|
|
140
|
-
onReady(
|
|
139
|
+
onReady(element, function (video) {
|
|
140
|
+
_this.videoElement = video;
|
|
141
|
+
});
|
|
141
142
|
}
|
|
142
143
|
}
|
|
143
144
|
}
|
|
@@ -313,7 +314,7 @@ var BaseVideo = /*#__PURE__*/function () {
|
|
|
313
314
|
this.isDestroyed = true;
|
|
314
315
|
if (this.videoType === 'hls') {
|
|
315
316
|
this.synchronizer && this.synchronizer.destroy();
|
|
316
|
-
this.hls && this.hls.
|
|
317
|
+
this.hls && this.hls.destroy();
|
|
317
318
|
this.getMap().clock.shouldAnimate = false;
|
|
318
319
|
}
|
|
319
320
|
if (this.videoType === 'custom') {
|
|
@@ -53,81 +53,83 @@ var VideoProject = /*#__PURE__*/function (_BaseVideo) {
|
|
|
53
53
|
if (this.videoType === 'custom') {
|
|
54
54
|
videoOptions = merge({}, this.options.custom);
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
this.videoPolygonLayer = map.addGraphicLayer({
|
|
86
|
-
type: 'Feature',
|
|
87
|
-
geometry: {
|
|
88
|
-
type: 'Polygon',
|
|
89
|
-
coordinates: [interPoints]
|
|
90
|
-
}
|
|
91
|
-
}, {
|
|
92
|
-
type: 'polygon',
|
|
93
|
-
style: {
|
|
94
|
-
material: edgeFeather ? new Cesium.ImageMaterialProperty({
|
|
95
|
-
image: new Cesium.CallbackProperty(function () {
|
|
96
|
-
return _this2._drawCanvas(videoOptions);
|
|
97
|
-
}, false),
|
|
98
|
-
transparent: true
|
|
99
|
-
}) : this.videoElement,
|
|
100
|
-
heightReference: clampToGround ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE,
|
|
101
|
-
perPositionHeight: !clampToGround
|
|
56
|
+
setTimeout(function () {
|
|
57
|
+
var _this2$options = _this2.options,
|
|
58
|
+
_this2$options$type = _this2$options.type,
|
|
59
|
+
type = _this2$options$type === void 0 ? 'fixed' : _this2$options$type,
|
|
60
|
+
frustum = _this2$options.frustum,
|
|
61
|
+
_this2$options$style = _this2$options.style,
|
|
62
|
+
_this2$options$style2 = _this2$options$style === void 0 ? {
|
|
63
|
+
edgeFeather: false,
|
|
64
|
+
clampToGround: 'terrain',
|
|
65
|
+
showLine: true
|
|
66
|
+
} : _this2$options$style,
|
|
67
|
+
edgeFeather = _this2$options$style2.edgeFeather,
|
|
68
|
+
clampToGround = _this2$options$style2.clampToGround,
|
|
69
|
+
showLine = _this2$options$style2.showLine;
|
|
70
|
+
frustum.show(false);
|
|
71
|
+
_this2.type = type;
|
|
72
|
+
_this2.frustum = frustum;
|
|
73
|
+
// 取后4个点
|
|
74
|
+
var points = _this2.frustum.getFrustumVertexPoints().slice(-4);
|
|
75
|
+
if (_this2.type === 'projection') {
|
|
76
|
+
// 交点数组
|
|
77
|
+
var interPoints = [];
|
|
78
|
+
points.forEach(function (point) {
|
|
79
|
+
var interPoint = _this2._getInterPointByLine(_this2.frustum.options.position, point);
|
|
80
|
+
interPoints.push(interPoint);
|
|
81
|
+
});
|
|
82
|
+
if (showLine) {
|
|
83
|
+
// 绘制线
|
|
84
|
+
_this2._drawLine(interPoints);
|
|
102
85
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
86
|
+
_this2.videoPolygonLayer = map.addGraphicLayer({
|
|
87
|
+
type: 'Feature',
|
|
88
|
+
geometry: {
|
|
89
|
+
type: 'Polygon',
|
|
90
|
+
coordinates: [interPoints]
|
|
91
|
+
}
|
|
92
|
+
}, {
|
|
93
|
+
type: 'polygon',
|
|
94
|
+
style: {
|
|
95
|
+
material: edgeFeather ? new Cesium.ImageMaterialProperty({
|
|
96
|
+
image: new Cesium.CallbackProperty(function () {
|
|
97
|
+
return _this2._drawCanvas(videoOptions);
|
|
98
|
+
}, false),
|
|
99
|
+
transparent: true
|
|
100
|
+
}) : _this2.videoElement,
|
|
101
|
+
heightReference: clampToGround ? Cesium.HeightReference.CLAMP_TO_GROUND : Cesium.HeightReference.NONE,
|
|
102
|
+
perPositionHeight: !clampToGround
|
|
103
|
+
}
|
|
104
|
+
});
|
|
109
105
|
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
coordinates: [points]
|
|
115
|
-
}
|
|
116
|
-
}, {
|
|
117
|
-
type: 'polygon',
|
|
118
|
-
style: {
|
|
119
|
-
material: edgeFeather ? new Cesium.ImageMaterialProperty({
|
|
120
|
-
image: new Cesium.CallbackProperty(function () {
|
|
121
|
-
return _this2._drawCanvas(videoOptions);
|
|
122
|
-
}, false),
|
|
123
|
-
transparent: true
|
|
124
|
-
}) : this.videoElement,
|
|
125
|
-
heightReference: Cesium.HeightReference.NONE,
|
|
126
|
-
perPositionHeight: true
|
|
106
|
+
if (_this2.type === 'fixed') {
|
|
107
|
+
if (showLine) {
|
|
108
|
+
// 绘制线
|
|
109
|
+
_this2._drawLine(points);
|
|
127
110
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
111
|
+
_this2.videoPolygonLayer = map.addGraphicLayer({
|
|
112
|
+
type: 'Feature',
|
|
113
|
+
geometry: {
|
|
114
|
+
type: 'Polygon',
|
|
115
|
+
coordinates: [points]
|
|
116
|
+
}
|
|
117
|
+
}, {
|
|
118
|
+
type: 'polygon',
|
|
119
|
+
style: {
|
|
120
|
+
material: edgeFeather ? new Cesium.ImageMaterialProperty({
|
|
121
|
+
image: new Cesium.CallbackProperty(function () {
|
|
122
|
+
return _this2._drawCanvas(videoOptions);
|
|
123
|
+
}, false),
|
|
124
|
+
transparent: true
|
|
125
|
+
}) : _this2.videoElement,
|
|
126
|
+
heightReference: Cesium.HeightReference.NONE,
|
|
127
|
+
perPositionHeight: true
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
_this2.status = 'START';
|
|
132
|
+
}, 200);
|
|
131
133
|
}
|
|
132
134
|
|
|
133
135
|
// 显示隐藏
|
|
@@ -146,7 +148,7 @@ var VideoProject = /*#__PURE__*/function (_BaseVideo) {
|
|
|
146
148
|
key: "_drawLine",
|
|
147
149
|
value: function _drawLine(interPoints) {
|
|
148
150
|
var _this3 = this,
|
|
149
|
-
_this$options$
|
|
151
|
+
_this$options$style;
|
|
150
152
|
var draw = function draw(geoJson) {
|
|
151
153
|
_this3.frustumLineLayer = _this3.getMap().addGraphicLayer(geoJson, {
|
|
152
154
|
type: 'polylineP',
|
|
@@ -157,7 +159,7 @@ var VideoProject = /*#__PURE__*/function (_BaseVideo) {
|
|
|
157
159
|
};
|
|
158
160
|
var linePoints = [];
|
|
159
161
|
// 是否计算贴地
|
|
160
|
-
if ((_this$options$
|
|
162
|
+
if ((_this$options$style = this.options.style) !== null && _this$options$style !== void 0 && _this$options$style.clampToGround && this.type === 'projection') {
|
|
161
163
|
var clampToGround = new ClampToGround(this.getMap());
|
|
162
164
|
var c3arr = utils.lngLatAltArrayToCartesian3Array(interPoints);
|
|
163
165
|
clampToGround.getLngLatAltArrToHeight(c3arr, 'terrain').then(function (result) {
|
|
@@ -55,18 +55,20 @@ var VideoTexture = /*#__PURE__*/function (_BaseVideo) {
|
|
|
55
55
|
} : _this$options$style,
|
|
56
56
|
edgeFeather = _this$options$style2.edgeFeather,
|
|
57
57
|
style = _objectWithoutProperties(_this$options$style2, _excluded);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
58
|
+
setTimeout(function () {
|
|
59
|
+
_this.videoPolygonLayer = map.addGraphicLayer(_this.options.data, {
|
|
60
|
+
type: 'polygon',
|
|
61
|
+
style: _objectSpread({
|
|
62
|
+
material: edgeFeather ? new Cesium.ImageMaterialProperty({
|
|
63
|
+
image: new Cesium.CallbackProperty(function () {
|
|
64
|
+
return _this._drawCanvas(videoOptions);
|
|
65
|
+
}, false),
|
|
66
|
+
transparent: true
|
|
67
|
+
}) : _this.videoElement
|
|
68
|
+
}, style || {})
|
|
69
|
+
});
|
|
70
|
+
_this.status = 'START';
|
|
71
|
+
}, 200);
|
|
70
72
|
}
|
|
71
73
|
}]);
|
|
72
74
|
return VideoTexture;
|