@anov/3d 0.0.79 → 0.0.81
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/factory/unit/CameraPoi.d.ts +2 -1
- package/dist/factory/unit/CameraPoi.js +361 -122
- package/dist/factory/unit/CameraPoi.js.map +1 -1
- package/dist/factory/unit/circle.js +3 -3
- package/dist/factory/unit/circle.js.map +1 -1
- package/dist/factory/unit/index.js +10 -6
- package/dist/factory/unit/index.js.map +1 -1
- package/dist/factory/unit/poi.js +1 -1
- package/dist/factory/unit/poi.js.map +1 -1
- package/dist/module/camera/index.js +1 -2
- package/dist/module/camera/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -16,6 +16,7 @@ declare class CameraPoi {
|
|
|
16
16
|
generateObject(): Promise<void>;
|
|
17
17
|
cameraEvent(sprite: Group, region: any): void;
|
|
18
18
|
probeEvent(sprite: SpritePoi, region: any): void;
|
|
19
|
+
setMeshVisible(visible: any): void;
|
|
19
20
|
closeHotmap(): void;
|
|
20
21
|
togglePoi(visible?: boolean): void;
|
|
21
22
|
remove(): void;
|
|
@@ -30,7 +31,7 @@ declare class Dialog {
|
|
|
30
31
|
eventListener: Set<Function>;
|
|
31
32
|
eventList: Map<string, Function>;
|
|
32
33
|
constructor(cameraManage: any);
|
|
33
|
-
getMesh(position: any,
|
|
34
|
+
getMesh(position: any, careraParams: any): Promise<unknown>;
|
|
34
35
|
getTarget(cameraPosition: any, rotation?: number[]): any;
|
|
35
36
|
getBoxSize(sprite: Sprite): {
|
|
36
37
|
width: number;
|
|
@@ -17,8 +17,248 @@ import { loadingManager, usePath } from "../3d";
|
|
|
17
17
|
|
|
18
18
|
// @ts-ignore
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
var data = {
|
|
21
|
+
camera: [{
|
|
22
|
+
id: '1',
|
|
23
|
+
name: '摄像头1',
|
|
24
|
+
position: [-315, 30, -150],
|
|
25
|
+
fovDefault: 60,
|
|
26
|
+
fovRange: [30, 120],
|
|
27
|
+
dialogCamera: {
|
|
28
|
+
position: [-315, 30, -150],
|
|
29
|
+
rotation: [30, 180, 0]
|
|
30
|
+
}
|
|
31
|
+
}, {
|
|
32
|
+
id: '2',
|
|
33
|
+
name: '摄像头2',
|
|
34
|
+
position: [30, 30, -150],
|
|
35
|
+
fovDefault: 60,
|
|
36
|
+
fovRange: [30, 120],
|
|
37
|
+
dialogCamera: {
|
|
38
|
+
position: [30, 30, -150],
|
|
39
|
+
rotation: [30, 180, 0]
|
|
40
|
+
}
|
|
41
|
+
}, {
|
|
42
|
+
id: '3',
|
|
43
|
+
name: '摄像头3',
|
|
44
|
+
position: [360, 30, -150],
|
|
45
|
+
fovDefault: 60,
|
|
46
|
+
fovRange: [30, 120],
|
|
47
|
+
dialogCamera: {
|
|
48
|
+
position: [360, 30, -150],
|
|
49
|
+
rotation: [30, 180, 0]
|
|
50
|
+
}
|
|
51
|
+
}, {
|
|
52
|
+
id: '4',
|
|
53
|
+
name: '摄像头4',
|
|
54
|
+
position: [-320, 30, 32],
|
|
55
|
+
dialogCamera: {
|
|
56
|
+
position: [-320, 30, 32],
|
|
57
|
+
rotation: [30, 180, 0]
|
|
58
|
+
}
|
|
59
|
+
}, {
|
|
60
|
+
id: '5',
|
|
61
|
+
name: '摄像头5',
|
|
62
|
+
position: [-307, 30, 170],
|
|
63
|
+
fovDefault: 60,
|
|
64
|
+
fovRange: [30, 120],
|
|
65
|
+
dialogCamera: {
|
|
66
|
+
position: [-307, 30, 170],
|
|
67
|
+
rotation: [30, 180, 0]
|
|
68
|
+
}
|
|
69
|
+
}, {
|
|
70
|
+
id: '6',
|
|
71
|
+
name: '摄像头6',
|
|
72
|
+
position: [77, 30, 96],
|
|
73
|
+
fovDefault: 60,
|
|
74
|
+
fovRange: [30, 120],
|
|
75
|
+
dialogCamera: {
|
|
76
|
+
position: [77, 30, 96],
|
|
77
|
+
rotation: [30, 180, 0]
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
id: '7',
|
|
81
|
+
name: '摄像头7',
|
|
82
|
+
position: [404, 30, 85],
|
|
83
|
+
fovDefault: 60,
|
|
84
|
+
fovRange: [30, 120],
|
|
85
|
+
dialogCamera: {
|
|
86
|
+
position: [404, 30, 85],
|
|
87
|
+
rotation: [30, 180, 0]
|
|
88
|
+
}
|
|
89
|
+
}],
|
|
90
|
+
probePoint: [{
|
|
91
|
+
id: '1',
|
|
92
|
+
name: '异常监测点1',
|
|
93
|
+
warn: true,
|
|
94
|
+
position: [56, 21, 86],
|
|
95
|
+
heat_map: {
|
|
96
|
+
diameter: 10,
|
|
97
|
+
intensity: 1,
|
|
98
|
+
data: [{
|
|
99
|
+
value: 1257.21,
|
|
100
|
+
position: [-31.4, 0, 112.58]
|
|
101
|
+
}, {
|
|
102
|
+
value: 5188.86,
|
|
103
|
+
position: [59.81, 0, 108.16]
|
|
104
|
+
}, {
|
|
105
|
+
value: 8233.59,
|
|
106
|
+
position: [127.01, 0, 93.51]
|
|
107
|
+
}, {
|
|
108
|
+
value: 6160.32,
|
|
109
|
+
position: [-23.39, 0, 109.85]
|
|
110
|
+
}, {
|
|
111
|
+
value: 2089.44,
|
|
112
|
+
position: [86.24, 0, 98.25]
|
|
113
|
+
}, {
|
|
114
|
+
value: 7964.25,
|
|
115
|
+
position: [142.08, 0, 91.55]
|
|
116
|
+
}, {
|
|
117
|
+
value: 2891.54,
|
|
118
|
+
position: [-18.76, 0, 105.96]
|
|
119
|
+
}, {
|
|
120
|
+
value: 4016.91,
|
|
121
|
+
position: [129.83, 0, 58.93]
|
|
122
|
+
}, {
|
|
123
|
+
value: 1658.48,
|
|
124
|
+
position: [114.01, 0, 73.39]
|
|
125
|
+
}, {
|
|
126
|
+
value: 6015.75,
|
|
127
|
+
position: [95.08, 0, 81.71]
|
|
128
|
+
}, {
|
|
129
|
+
value: 2645.72,
|
|
130
|
+
position: [71.33, 0, 111.15]
|
|
131
|
+
}, {
|
|
132
|
+
value: 5328.71,
|
|
133
|
+
position: [53.08, 0, 100.99]
|
|
134
|
+
}, {
|
|
135
|
+
value: 7860.39,
|
|
136
|
+
position: [45.44, 0, 62.02]
|
|
137
|
+
}, {
|
|
138
|
+
value: 629.26,
|
|
139
|
+
position: [66.18, 0, 68.98]
|
|
140
|
+
}, {
|
|
141
|
+
value: 7998.3,
|
|
142
|
+
position: [66.91, 0, 61.18]
|
|
143
|
+
}, {
|
|
144
|
+
value: 1793.47,
|
|
145
|
+
position: [96.94, 0, 82.64]
|
|
146
|
+
}, {
|
|
147
|
+
value: 8761.08,
|
|
148
|
+
position: [79.27, 0, 98.97]
|
|
149
|
+
}, {
|
|
150
|
+
value: 171.17,
|
|
151
|
+
position: [-8.36, 0, 106.03]
|
|
152
|
+
}, {
|
|
153
|
+
value: 7927.78,
|
|
154
|
+
position: [19.1, 0, 68.98]
|
|
155
|
+
}, {
|
|
156
|
+
value: 1245.33,
|
|
157
|
+
position: [-12.97, 0, 100.53]
|
|
158
|
+
}, {
|
|
159
|
+
value: 5776.97,
|
|
160
|
+
position: [58.42, 0, 63.39]
|
|
161
|
+
}, {
|
|
162
|
+
value: 7995.19,
|
|
163
|
+
position: [27.95, 0, 71.28]
|
|
164
|
+
}, {
|
|
165
|
+
value: 5594.95,
|
|
166
|
+
position: [-40.68, 0, 113.13]
|
|
167
|
+
}, {
|
|
168
|
+
value: 1100.63,
|
|
169
|
+
position: [-25.66, 0, 112.21]
|
|
170
|
+
}, {
|
|
171
|
+
value: 4414.18,
|
|
172
|
+
position: [21.2, 0, 85.83]
|
|
173
|
+
}, {
|
|
174
|
+
value: 6992.41,
|
|
175
|
+
position: [46.74, 0, 99.35]
|
|
176
|
+
}, {
|
|
177
|
+
value: 9635.05,
|
|
178
|
+
position: [75.22, 0, 85.63]
|
|
179
|
+
}, {
|
|
180
|
+
value: 2605.65,
|
|
181
|
+
position: [-8.83, 0, 98.76]
|
|
182
|
+
}, {
|
|
183
|
+
value: 4383.19,
|
|
184
|
+
position: [71.33, 0, 99.15]
|
|
185
|
+
}, {
|
|
186
|
+
value: 8279.62,
|
|
187
|
+
position: [11.94, 0, 106.16]
|
|
188
|
+
}, {
|
|
189
|
+
value: 1684.68,
|
|
190
|
+
position: [92.12, 0, 88.78]
|
|
191
|
+
}, {
|
|
192
|
+
value: 9923.54,
|
|
193
|
+
position: [80.71, 0, 62.07]
|
|
194
|
+
}, {
|
|
195
|
+
value: 7653.27,
|
|
196
|
+
position: [148.54, 0, 60.52]
|
|
197
|
+
}, {
|
|
198
|
+
value: 5039.09,
|
|
199
|
+
position: [62.98, 0, 59.55]
|
|
200
|
+
}, {
|
|
201
|
+
value: 551.79,
|
|
202
|
+
position: [135.28, 0, 103.93]
|
|
203
|
+
}, {
|
|
204
|
+
value: 4524.42,
|
|
205
|
+
position: [-4.12, 0, 67.67]
|
|
206
|
+
}, {
|
|
207
|
+
value: 2241.86,
|
|
208
|
+
position: [101.14, 0, 101.28]
|
|
209
|
+
}, {
|
|
210
|
+
value: 3456.36,
|
|
211
|
+
position: [116.45, 0, 93.74]
|
|
212
|
+
}, {
|
|
213
|
+
value: 4585.21,
|
|
214
|
+
position: [43.88, 0, 86.63]
|
|
215
|
+
}, {
|
|
216
|
+
value: 4457.15,
|
|
217
|
+
position: [124.61, 0, 70.21]
|
|
218
|
+
}, {
|
|
219
|
+
value: 2494.11,
|
|
220
|
+
position: [29.21, 0, 104.71]
|
|
221
|
+
}, {
|
|
222
|
+
value: 1231.78,
|
|
223
|
+
position: [97.08, 0, 69.05]
|
|
224
|
+
}, {
|
|
225
|
+
value: 6806.42,
|
|
226
|
+
position: [4.42, 0, 102.62]
|
|
227
|
+
}, {
|
|
228
|
+
value: 603.51,
|
|
229
|
+
position: [108.36, 0, 94.25]
|
|
230
|
+
}, {
|
|
231
|
+
value: 3680.9,
|
|
232
|
+
position: [-35.15, 0, 99.69]
|
|
233
|
+
}, {
|
|
234
|
+
value: 6376.6,
|
|
235
|
+
position: [61.69, 0, 102.39]
|
|
236
|
+
}, {
|
|
237
|
+
value: 4364.56,
|
|
238
|
+
position: [43.58, 0, 112.51]
|
|
239
|
+
}, {
|
|
240
|
+
value: 7729.71,
|
|
241
|
+
position: [-5.25, 0, 113.76]
|
|
242
|
+
}, {
|
|
243
|
+
value: 9914.23,
|
|
244
|
+
position: [-13.56, 0, 84.21]
|
|
245
|
+
}, {
|
|
246
|
+
value: 5854.25,
|
|
247
|
+
position: [50, 0, 83.54]
|
|
248
|
+
}]
|
|
249
|
+
}
|
|
250
|
+
}, {
|
|
251
|
+
id: '2',
|
|
252
|
+
name: '甲烷监测点2',
|
|
253
|
+
warn: false,
|
|
254
|
+
position: [384, 21, 75]
|
|
255
|
+
}, {
|
|
256
|
+
id: '3',
|
|
257
|
+
name: '甲烷监测点3',
|
|
258
|
+
warn: false,
|
|
259
|
+
position: [9, 21, -134]
|
|
260
|
+
}]
|
|
261
|
+
};
|
|
22
262
|
var load = new ModelLoader();
|
|
23
263
|
var CameraPoi = /*#__PURE__*/function () {
|
|
24
264
|
function CameraPoi(gobal) {
|
|
@@ -39,85 +279,69 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
39
279
|
_createClass(CameraPoi, [{
|
|
40
280
|
key: "generateObject",
|
|
41
281
|
value: function () {
|
|
42
|
-
var _generateObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
43
|
-
var _this = this
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
282
|
+
var _generateObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
283
|
+
var _this = this,
|
|
284
|
+
_data$probePoint;
|
|
285
|
+
var model, point, rotatingRight, unFrame;
|
|
286
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
287
|
+
while (1) switch (_context.prev = _context.next) {
|
|
47
288
|
case 0:
|
|
48
|
-
|
|
289
|
+
_context.next = 2;
|
|
49
290
|
return load.loadGLTF("".concat(usePath, "shexiang.glb"), false, true, './draco/', function (gltf) {
|
|
50
291
|
return gltf;
|
|
51
292
|
});
|
|
52
293
|
case 2:
|
|
53
|
-
model =
|
|
54
|
-
|
|
55
|
-
var
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
scan.rotation.x = -Math.PI / 2 + 0.5;
|
|
75
|
-
scan.position.copy(position.clone().add(new Vector3(0, -2, 0)));
|
|
76
|
-
group.add(scan);
|
|
77
|
-
_this.cameraMesh.set(region.title, group);
|
|
78
|
-
_this.gobal.interactionManager.add(group);
|
|
79
|
-
_this.cameraEvent(group, region);
|
|
80
|
-
_this.gobal.scene.add(group);
|
|
294
|
+
model = _context.sent;
|
|
295
|
+
data.camera.forEach(function (region) {
|
|
296
|
+
var group = new Group();
|
|
297
|
+
group.name = region.id;
|
|
298
|
+
var sprite = new SpritePoi("".concat(usePath, "camera.png"), {
|
|
299
|
+
scale: [14, 14, 1]
|
|
300
|
+
});
|
|
301
|
+
sprite.rotation.y = Math.PI;
|
|
302
|
+
var position = new Vector3().fromArray(region.position);
|
|
303
|
+
sprite.position.copy(position);
|
|
304
|
+
group.add(sprite);
|
|
305
|
+
var scan = model.scene.clone();
|
|
306
|
+
scan.scale.addScalar(8);
|
|
307
|
+
scan.rotation.x = -Math.PI / 2 + 0.5;
|
|
308
|
+
scan.position.copy(position.clone().add(new Vector3(0, -2, 0)));
|
|
309
|
+
group.add(scan);
|
|
310
|
+
_this.cameraMesh.set(region.name, group);
|
|
311
|
+
_this.gobal.interactionManager.add(group);
|
|
312
|
+
_this.cameraEvent(group, region);
|
|
313
|
+
_this.gobal.scene.add(group);
|
|
314
|
+
});
|
|
81
315
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case 19:
|
|
112
|
-
case "end":
|
|
113
|
-
return _context.stop();
|
|
114
|
-
}
|
|
115
|
-
}, _callee);
|
|
116
|
-
}));
|
|
117
|
-
return function (_x) {
|
|
118
|
-
return _ref.apply(this, arguments);
|
|
119
|
-
};
|
|
120
|
-
}());
|
|
316
|
+
// 甲烷检测点
|
|
317
|
+
point = new MethanePoint();
|
|
318
|
+
(_data$probePoint = data.probePoint) === null || _data$probePoint === void 0 ? void 0 : _data$probePoint.forEach(function (item) {
|
|
319
|
+
var mesh;
|
|
320
|
+
if (item.warn) {
|
|
321
|
+
mesh = new SpritePoi("".concat(usePath, "p4/warn.png"), {
|
|
322
|
+
scale: [16, 16, 1]
|
|
323
|
+
});
|
|
324
|
+
_this.gobal.interactionManager.add(mesh);
|
|
325
|
+
_this.probeEvent(mesh, item);
|
|
326
|
+
// 使用GSAP创建跳动动画
|
|
327
|
+
gsap.to(mesh.position, {
|
|
328
|
+
y: '+=3',
|
|
329
|
+
// 上跳10个单位
|
|
330
|
+
duration: 0.2,
|
|
331
|
+
// 动画持续时间
|
|
332
|
+
ease: 'power1.inOut',
|
|
333
|
+
// 缓动函数
|
|
334
|
+
yoyo: true,
|
|
335
|
+
// 循环
|
|
336
|
+
repeat: -1 // 无限重复
|
|
337
|
+
});
|
|
338
|
+
} else {
|
|
339
|
+
mesh = point.create();
|
|
340
|
+
}
|
|
341
|
+
mesh.position.copy(new Vector3().fromArray(item.position));
|
|
342
|
+
_this.warnMesh.set(item.name, mesh);
|
|
343
|
+
_this.gobal.scene.add(mesh);
|
|
344
|
+
});
|
|
121
345
|
// 设置左右旋转的标志位和旋转速度
|
|
122
346
|
rotatingRight = true; // 是否正在向右转动
|
|
123
347
|
unFrame = use.useframe(function () {
|
|
@@ -140,11 +364,11 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
140
364
|
});
|
|
141
365
|
});
|
|
142
366
|
this.eventListener.add(unFrame);
|
|
143
|
-
case
|
|
367
|
+
case 9:
|
|
144
368
|
case "end":
|
|
145
|
-
return
|
|
369
|
+
return _context.stop();
|
|
146
370
|
}
|
|
147
|
-
},
|
|
371
|
+
}, _callee, this);
|
|
148
372
|
}));
|
|
149
373
|
function generateObject() {
|
|
150
374
|
return _generateObject.apply(this, arguments);
|
|
@@ -156,24 +380,24 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
156
380
|
value: function cameraEvent(sprite, region) {
|
|
157
381
|
var _this2 = this;
|
|
158
382
|
var fn = /*#__PURE__*/function () {
|
|
159
|
-
var
|
|
383
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
160
384
|
var isClose, _use$useScene, camera, position, targetPosition, camaraPosition;
|
|
161
|
-
return _regeneratorRuntime().wrap(function
|
|
162
|
-
while (1) switch (
|
|
385
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
386
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
163
387
|
case 0:
|
|
164
388
|
if (!_this2.currentDialogMesh) {
|
|
165
|
-
|
|
389
|
+
_context2.next = 7;
|
|
166
390
|
break;
|
|
167
391
|
}
|
|
168
|
-
isClose = _this2.currentDialogMesh.name === region.
|
|
392
|
+
isClose = _this2.currentDialogMesh.name === region.name;
|
|
169
393
|
_this2.dialogManage.close();
|
|
170
394
|
if (!isClose) {
|
|
171
|
-
|
|
395
|
+
_context2.next = 5;
|
|
172
396
|
break;
|
|
173
397
|
}
|
|
174
|
-
return
|
|
398
|
+
return _context2.abrupt("return");
|
|
175
399
|
case 5:
|
|
176
|
-
|
|
400
|
+
_context2.next = 8;
|
|
177
401
|
break;
|
|
178
402
|
case 7:
|
|
179
403
|
if (_this2.headMap && _this2.headMap.isShow) {
|
|
@@ -187,40 +411,45 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
187
411
|
}
|
|
188
412
|
case 8:
|
|
189
413
|
sendToMessage(MessageType.Event, 'onCameraStatus', EMessageStatus.Success, undefined, {
|
|
190
|
-
id: region.
|
|
414
|
+
id: region.id
|
|
191
415
|
});
|
|
192
|
-
position = new Vector3().fromArray(region.
|
|
416
|
+
position = new Vector3().fromArray(region.position);
|
|
193
417
|
targetPosition = position.clone().toArray();
|
|
194
418
|
camaraPosition = position.clone().add(new Vector3(0, 40, 80)).toArray();
|
|
195
419
|
_this2.gobal.cameraUtil.set({
|
|
196
420
|
position: camaraPosition,
|
|
197
421
|
target: targetPosition
|
|
198
422
|
});
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
423
|
+
_this2.setMeshVisible(false);
|
|
424
|
+
_context2.next = 16;
|
|
425
|
+
return _this2.dialogManage.getMesh(position, region);
|
|
426
|
+
case 16:
|
|
427
|
+
_this2.currentDialogMesh = _context2.sent;
|
|
203
428
|
_this2.dialogManage.addEventListener('close', function () {
|
|
204
429
|
// 初始相机到原始位置
|
|
205
430
|
_this2.gobal.cameraUtil.set({
|
|
206
431
|
position: _this2.startPosition.toArray(),
|
|
207
432
|
target: _this2.cameraLookAt.toArray()
|
|
208
433
|
});
|
|
434
|
+
_this2.setMeshVisible(true);
|
|
209
435
|
_this2.currentDialogMesh = null;
|
|
436
|
+
_this2.cameraMesh.forEach(function (mesh) {
|
|
437
|
+
mesh.visible = true;
|
|
438
|
+
});
|
|
210
439
|
sendToMessage(MessageType.Event, 'onCancelCameraStatus', EMessageStatus.Success, undefined, {
|
|
211
|
-
id: region.
|
|
440
|
+
id: region.id
|
|
212
441
|
});
|
|
213
442
|
});
|
|
214
|
-
_this2.currentDialogMesh.name = region.
|
|
443
|
+
_this2.currentDialogMesh.name = region.name;
|
|
215
444
|
_this2.gobal.scene.add(_this2.currentDialogMesh);
|
|
216
|
-
case
|
|
445
|
+
case 20:
|
|
217
446
|
case "end":
|
|
218
|
-
return
|
|
447
|
+
return _context2.stop();
|
|
219
448
|
}
|
|
220
|
-
},
|
|
449
|
+
}, _callee2);
|
|
221
450
|
}));
|
|
222
451
|
return function fn() {
|
|
223
|
-
return
|
|
452
|
+
return _ref.apply(this, arguments);
|
|
224
453
|
};
|
|
225
454
|
}();
|
|
226
455
|
sprite.addEventListener('click', fn);
|
|
@@ -235,23 +464,23 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
235
464
|
var _use$useScene2 = use.useScene(),
|
|
236
465
|
camera = _use$useScene2.camera;
|
|
237
466
|
this.headMap = new HeadMap();
|
|
238
|
-
var unClick = sprite.addEventListener('click', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
467
|
+
var unClick = sprite.addEventListener('click', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
239
468
|
var position, camaraPosition;
|
|
240
|
-
return _regeneratorRuntime().wrap(function
|
|
241
|
-
while (1) switch (
|
|
469
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
470
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
242
471
|
case 0:
|
|
243
472
|
if (sprite.visible) {
|
|
244
|
-
|
|
473
|
+
_context3.next = 2;
|
|
245
474
|
break;
|
|
246
475
|
}
|
|
247
|
-
return
|
|
476
|
+
return _context3.abrupt("return");
|
|
248
477
|
case 2:
|
|
249
478
|
sprite.visible = false;
|
|
250
479
|
sendToMessage(MessageType.Event, 'onGasMonitorStatus', EMessageStatus.Success, undefined, {
|
|
251
|
-
id: region.
|
|
480
|
+
id: region.id
|
|
252
481
|
});
|
|
253
482
|
_this3.togglePoi(false);
|
|
254
|
-
position = new Vector3().fromArray(region.
|
|
483
|
+
position = new Vector3().fromArray(region.position);
|
|
255
484
|
camaraPosition = position.clone().add(new Vector3(0, 30, 0));
|
|
256
485
|
_this3.startPosition = camera.position.clone();
|
|
257
486
|
// 获取相机朝向
|
|
@@ -282,12 +511,22 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
282
511
|
});
|
|
283
512
|
case 11:
|
|
284
513
|
case "end":
|
|
285
|
-
return
|
|
514
|
+
return _context3.stop();
|
|
286
515
|
}
|
|
287
|
-
},
|
|
516
|
+
}, _callee3);
|
|
288
517
|
})));
|
|
289
518
|
this.eventListener.add(unClick);
|
|
290
519
|
}
|
|
520
|
+
}, {
|
|
521
|
+
key: "setMeshVisible",
|
|
522
|
+
value: function setMeshVisible(visible) {
|
|
523
|
+
this.cameraMesh.forEach(function (mesh) {
|
|
524
|
+
return mesh.visible = visible;
|
|
525
|
+
});
|
|
526
|
+
this.warnMesh.forEach(function (mesh) {
|
|
527
|
+
return mesh.visible = visible;
|
|
528
|
+
});
|
|
529
|
+
}
|
|
291
530
|
}, {
|
|
292
531
|
key: "closeHotmap",
|
|
293
532
|
value: function closeHotmap() {
|
|
@@ -316,6 +555,7 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
316
555
|
}, {
|
|
317
556
|
key: "remove",
|
|
318
557
|
value: function remove() {
|
|
558
|
+
this.dialogManage.close();
|
|
319
559
|
// 删除摄像机POI点
|
|
320
560
|
this.cameraMesh.forEach(function (sprite) {
|
|
321
561
|
sprite.removeFromParent();
|
|
@@ -338,7 +578,6 @@ var CameraPoi = /*#__PURE__*/function () {
|
|
|
338
578
|
orbitControls.enabled = true;
|
|
339
579
|
}
|
|
340
580
|
this.eventListener.clear();
|
|
341
|
-
this.dialogManage.close();
|
|
342
581
|
}
|
|
343
582
|
}]);
|
|
344
583
|
return CameraPoi;
|
|
@@ -414,16 +653,16 @@ var Dialog = /*#__PURE__*/function () {
|
|
|
414
653
|
_createClass(Dialog, [{
|
|
415
654
|
key: "getMesh",
|
|
416
655
|
value: function () {
|
|
417
|
-
var _getMesh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
656
|
+
var _getMesh = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(position, careraParams) {
|
|
418
657
|
var _this4 = this;
|
|
419
658
|
var _this$manage$gobal$sc, texture, close, cuteSprite, unFrame;
|
|
420
|
-
return _regeneratorRuntime().wrap(function
|
|
421
|
-
while (1) switch (
|
|
659
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
660
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
422
661
|
case 0:
|
|
423
662
|
this.close();
|
|
424
|
-
this.camera = new PerspectiveCamera(
|
|
425
|
-
this.camera.position.copy(
|
|
426
|
-
this.camera.rotation.set(
|
|
663
|
+
this.camera = new PerspectiveCamera(careraParams.fovDefault || 60, window.innerWidth / window.innerHeight, 0.1, 10000);
|
|
664
|
+
this.camera.position.copy(new Vector3().fromArray(careraParams.position));
|
|
665
|
+
this.camera.rotation.set(Math.PI / 6, Math.PI, 0);
|
|
427
666
|
_this$manage$gobal$sc = this.manage.gobal.scene.setCustomPerspective(this.camera), texture = _this$manage$gobal$sc.texture, close = _this$manage$gobal$sc.close;
|
|
428
667
|
cuteSprite = new Sprite(new SpriteMaterial({
|
|
429
668
|
map: texture,
|
|
@@ -437,7 +676,7 @@ var Dialog = /*#__PURE__*/function () {
|
|
|
437
676
|
_this4.updateScale(cuteSprite);
|
|
438
677
|
});
|
|
439
678
|
this.eventListener.add(unFrame);
|
|
440
|
-
return
|
|
679
|
+
return _context4.abrupt("return", new Promise(function (reslove) {
|
|
441
680
|
setTimeout(function () {
|
|
442
681
|
var borderMesh = _this4.getBorderMesh(_this4.camera, cuteSprite);
|
|
443
682
|
var group = new Group();
|
|
@@ -451,11 +690,11 @@ var Dialog = /*#__PURE__*/function () {
|
|
|
451
690
|
}));
|
|
452
691
|
case 12:
|
|
453
692
|
case "end":
|
|
454
|
-
return
|
|
693
|
+
return _context4.stop();
|
|
455
694
|
}
|
|
456
|
-
},
|
|
695
|
+
}, _callee4, this);
|
|
457
696
|
}));
|
|
458
|
-
function getMesh(
|
|
697
|
+
function getMesh(_x, _x2) {
|
|
459
698
|
return _getMesh.apply(this, arguments);
|
|
460
699
|
}
|
|
461
700
|
return getMesh;
|
|
@@ -497,9 +736,9 @@ var Dialog = /*#__PURE__*/function () {
|
|
|
497
736
|
// 将边界框的最小和最大顶点转换为屏幕坐标
|
|
498
737
|
var min = bbox.min.project(camera);
|
|
499
738
|
var max = bbox.max.project(camera);
|
|
500
|
-
var
|
|
501
|
-
w =
|
|
502
|
-
h =
|
|
739
|
+
var _ref3 = [window.innerWidth, window.innerHeight],
|
|
740
|
+
w = _ref3[0],
|
|
741
|
+
h = _ref3[1];
|
|
503
742
|
var dom = document.querySelector('#app');
|
|
504
743
|
if (dom) {
|
|
505
744
|
w = dom.clientWidth;
|
|
@@ -652,7 +891,7 @@ var Dialog = /*#__PURE__*/function () {
|
|
|
652
891
|
sliderBar.type = 'range';
|
|
653
892
|
sliderBar.min = '30';
|
|
654
893
|
sliderBar.max = '120';
|
|
655
|
-
sliderBar.value = '
|
|
894
|
+
sliderBar.value = '60';
|
|
656
895
|
sliderBar.className = 'dialog-slider';
|
|
657
896
|
sliderBar.addEventListener('input', function () {
|
|
658
897
|
camera.fov = sliderBar.value;
|