deeptwins-engine-3d 0.1.45 → 0.1.47

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.
@@ -36,7 +36,7 @@ var VideoProject = /*#__PURE__*/function (_BaseVideo) {
36
36
  }
37
37
  _createClass(VideoProject, [{
38
38
  key: "addToMap",
39
- value: function addToMap(map) {
39
+ value: function addToMap() {
40
40
  var _this2 = this;
41
41
  if (!this._canOperate()) {
42
42
  return;
@@ -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
- var _this$options = this.options,
57
- _this$options$type = _this$options.type,
58
- type = _this$options$type === void 0 ? 'fixed' : _this$options$type,
59
- frustum = _this$options.frustum,
60
- _this$options$style = _this$options.style,
61
- _this$options$style2 = _this$options$style === void 0 ? {
62
- edgeFeather: false,
63
- clampToGround: 'terrain',
64
- showLine: true
65
- } : _this$options$style,
66
- edgeFeather = _this$options$style2.edgeFeather,
67
- clampToGround = _this$options$style2.clampToGround,
68
- showLine = _this$options$style2.showLine;
69
- frustum.show(false);
70
- this.type = type;
71
- this.frustum = frustum;
72
- // 取后4个点
73
- var points = this.frustum.getFrustumVertexPoints().slice(-4);
74
- if (this.type === 'projection') {
75
- // 交点数组
76
- var interPoints = [];
77
- points.forEach(function (point) {
78
- var interPoint = _this2._getInterPointByLine(_this2.frustum.options.position, point);
79
- interPoints.push(interPoint);
80
- });
81
- if (showLine) {
82
- // 绘制线
83
- this._drawLine(interPoints);
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
- if (this.type === 'fixed') {
106
- if (showLine) {
107
- // 绘制线
108
- this._drawLine(points);
86
+ _this2.videoPolygonLayer = _this2.getMap().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
- this.videoPolygonLayer = map.addGraphicLayer({
111
- type: 'Feature',
112
- geometry: {
113
- type: 'Polygon',
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
- this.status = 'START';
111
+ _this2.videoPolygonLayer = _this2.getMap().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$style3;
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$style3 = this.options.style) !== null && _this$options$style3 !== void 0 && _this$options$style3.clampToGround && this.type === 'projection') {
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) {
@@ -1,5 +1,5 @@
1
1
  import BaseVideo from './BaseVideo';
2
2
  export default class VideoTexture extends BaseVideo {
3
3
  constructor(map: any, options: any);
4
- addToMap(map: any): void;
4
+ addToMap(): void;
5
5
  }
@@ -32,7 +32,7 @@ var VideoTexture = /*#__PURE__*/function (_BaseVideo) {
32
32
  }
33
33
  _createClass(VideoTexture, [{
34
34
  key: "addToMap",
35
- value: function addToMap(map) {
35
+ value: function addToMap() {
36
36
  var _this = this;
37
37
  if (!this._canOperate()) {
38
38
  return;
@@ -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
- this.videoPolygonLayer = map.addGraphicLayer(this.options.data, {
59
- type: 'polygon',
60
- style: _objectSpread({
61
- material: edgeFeather ? new Cesium.ImageMaterialProperty({
62
- image: new Cesium.CallbackProperty(function () {
63
- return _this._drawCanvas(videoOptions);
64
- }, false),
65
- transparent: true
66
- }) : this.videoElement
67
- }, style || {})
68
- });
69
- this.status = 'START';
58
+ setTimeout(function () {
59
+ _this.videoPolygonLayer = _this.getMap().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;