@yangyongtao/gaea 1.1.33 → 1.1.34
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/CHANGELOG.md +5 -0
- package/package.json +1 -1
- package/src/GaeaMethods.js +472 -545
package/src/GaeaMethods.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* gaea-3dview npm package
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* 用法:
|
|
7
|
-
* setConfig({ serveUrl: '...', serveLocal: '...' });
|
|
4
|
+
* 鍒濆鍖栧湪 new GaeaApp() 鏃惰嚜鍔ㄥ畬鎴愶紝Vue 椤甸潰鍙渶閰嶇疆銆? *
|
|
5
|
+
* 鐢ㄦ硶锛? * setConfig({ serveUrl: '...', serveLocal: '...' });
|
|
8
6
|
* const app = new GaeaApp();
|
|
9
|
-
* await app.ready; //
|
|
10
|
-
*/
|
|
7
|
+
* await app.ready; // 鍙€夛紝绛夊緟鍒濆鍖栧畬鎴? */
|
|
11
8
|
|
|
12
9
|
import { Group, Tween, Easing } from '@tweenjs/tween.js';
|
|
13
10
|
window.TWEEN = { Group, Tween, Easing };
|
|
@@ -15,7 +12,7 @@ window.TWEEN = { Group, Tween, Easing };
|
|
|
15
12
|
import Gaea from '../public/index.js';
|
|
16
13
|
|
|
17
14
|
|
|
18
|
-
// ==================== Loading
|
|
15
|
+
// ==================== Loading 鍔ㄧ敾 ====================
|
|
19
16
|
|
|
20
17
|
(function injectLoadingStyle() {
|
|
21
18
|
if (document.getElementById('gaea-loading-style')) return;
|
|
@@ -54,9 +51,9 @@ import Gaea from '../public/index.js';
|
|
|
54
51
|
transition: background 0.2s; backdrop-filter: blur(4px);
|
|
55
52
|
}
|
|
56
53
|
#gaea-layertree-btn:hover { background: rgba(0,0,0,0.7); }
|
|
57
|
-
/*
|
|
54
|
+
/* 灞忓箷鍥炬爣鏍峰紡锛堝榻?ht_3dview锛?*/
|
|
58
55
|
.gaea-locationLineStyle {
|
|
59
|
-
position: absolute; overflow: hidden; z-index:
|
|
56
|
+
position: absolute; overflow: hidden; z-index: 1; pointer-events: auto;
|
|
60
57
|
user-select: none; -webkit-user-select: none;
|
|
61
58
|
}
|
|
62
59
|
.gaea-locationLineStyle .text-wrapper {
|
|
@@ -75,7 +72,7 @@ import Gaea from '../public/index.js';
|
|
|
75
72
|
}
|
|
76
73
|
.gaea-iconscreen {
|
|
77
74
|
position: absolute; overflow: hidden; width: 169px; height: 55px;
|
|
78
|
-
user-select: none; -webkit-user-select: none; z-index:
|
|
75
|
+
user-select: none; -webkit-user-select: none; z-index: 1; pointer-events: auto;
|
|
79
76
|
}
|
|
80
77
|
.gaea-iconscreen img {
|
|
81
78
|
position: absolute; width: 100%; height: 100%;
|
|
@@ -92,7 +89,7 @@ import Gaea from '../public/index.js';
|
|
|
92
89
|
}
|
|
93
90
|
.gaea-iconGif {
|
|
94
91
|
position: absolute; overflow: hidden; width: 48px; height: 48px;
|
|
95
|
-
user-select: none; -webkit-user-select: none; z-index:
|
|
92
|
+
user-select: none; -webkit-user-select: none; z-index: 1; pointer-events: auto;
|
|
96
93
|
}
|
|
97
94
|
.gaea-iconGif img {
|
|
98
95
|
width: 100%; height: 100%; object-fit: contain; display: block;
|
|
@@ -117,30 +114,28 @@ function hideLoading() {
|
|
|
117
114
|
}
|
|
118
115
|
|
|
119
116
|
|
|
120
|
-
// ====================
|
|
117
|
+
// ==================== 閰嶇疆 ====================
|
|
121
118
|
|
|
122
|
-
/**
|
|
119
|
+
/** 榛樿寮曟搸璧勬簮鏈嶅姟鍣ㄥ湴鍧€锛圙aea.pck / Gaea.wasm 绛夊ぇ鏂囦欢锛夛紝鍙湪杩愯鏃?鐜鍙橀噺瑕嗙洊 */
|
|
123
120
|
const DEFAULT_ENGINE_ASSETS_URL = 'http://172.20.176.100:7072/gaea/Gaea';
|
|
124
121
|
|
|
125
122
|
/**
|
|
126
|
-
*
|
|
127
|
-
*
|
|
128
|
-
*
|
|
129
|
-
* > 构建环境变量 VITE_GAEA_EXECUTABLE > 内置默认资源服务器地址。
|
|
130
|
-
*/
|
|
123
|
+
* 瑙f瀽榛樿 executable锛? * 浼樺厛绾э細杩愯鏃跺叏灞€鍙橀噺 window.__GAEA_ASSETS_URL__锛堝涓荤珯鐐?config.js 鍙缃紝
|
|
124
|
+
* 鎹㈠湴鍧€鏃犻渶閲嶆柊鎵撳寘锛? dev 鐜鏈湴 /Gaea锛堣蛋 vite dev server 涓棿浠讹紝涓嶄緷璧栫嚎涓婏級
|
|
125
|
+
* > 鏋勫缓鐜鍙橀噺 VITE_GAEA_EXECUTABLE > 鍐呯疆榛樿璧勬簮鏈嶅姟鍣ㄥ湴鍧€銆? */
|
|
131
126
|
function resolveDefaultExecutable() {
|
|
132
127
|
if (typeof window !== 'undefined' && window.__GAEA_ASSETS_URL__) {
|
|
133
128
|
return window.__GAEA_ASSETS_URL__;
|
|
134
129
|
}
|
|
135
130
|
try {
|
|
136
131
|
if (import.meta.env) {
|
|
137
|
-
// dev
|
|
132
|
+
// dev 寮€鍙戯細寮曟搸璧勬簮璧?vite dev server 涓棿浠讹紙鏈湴 gaea public锛夛紝鏃犻渶璁块棶绾夸笂
|
|
138
133
|
if (import.meta.env.DEV) return '/Gaea';
|
|
139
|
-
//
|
|
134
|
+
// 鏋勫缓鏃跺彲鐢ㄧ幆澧冨彉閲忚鐩栵紙濡傛湰鍦版祴璇?build 浜х墿鎸囧悜鏈湴璧勬簮鏈嶅姟鍣級
|
|
140
135
|
if (import.meta.env.VITE_GAEA_EXECUTABLE) return import.meta.env.VITE_GAEA_EXECUTABLE;
|
|
141
136
|
}
|
|
142
137
|
} catch (e) {
|
|
143
|
-
/*
|
|
138
|
+
/* 闈?vite 鐜蹇界暐 */
|
|
144
139
|
}
|
|
145
140
|
return DEFAULT_ENGINE_ASSETS_URL;
|
|
146
141
|
}
|
|
@@ -148,153 +143,151 @@ function resolveDefaultExecutable() {
|
|
|
148
143
|
const defaultConfig = {
|
|
149
144
|
serveUrl: '',
|
|
150
145
|
serveLocal: '',
|
|
151
|
-
// Engine
|
|
146
|
+
// Engine 閰嶇疆
|
|
152
147
|
executable: resolveDefaultExecutable(),
|
|
153
148
|
fileSizes: { 'Gaea.pck': 450751936, 'Gaea.wasm': 16580215 },
|
|
154
149
|
canvasResizePolicy: 2,
|
|
155
150
|
experimentalVK: false,
|
|
156
151
|
focusCanvas: true,
|
|
157
152
|
/**
|
|
158
|
-
*
|
|
159
|
-
* '
|
|
160
|
-
* 'online' - 在线:仅加载天地图影像,不加载地形和贴地线
|
|
161
|
-
*/
|
|
153
|
+
* 鏈嶅姟妯″紡锛? * 'platform' - 鏈嶅姟骞冲彴锛氬奖鍍忚蛋 serveUrl 鐨?WMTS锛屽苟鍔犺浇鍦板舰銆佽创鍦扮嚎
|
|
154
|
+
* 'online' - 鍦ㄧ嚎锛氫粎鍔犺浇澶╁湴鍥惧奖鍍忥紝涓嶅姞杞藉湴褰㈠拰璐村湴绾? */
|
|
162
155
|
serviceMode: 'platform',
|
|
163
|
-
/**
|
|
156
|
+
/** 澶╁湴鍥?token锛堝湪绾挎ā寮忎娇鐢級 */
|
|
164
157
|
tiandituToken: '63201cfd7df1e1bff7d88bb8baa32151',
|
|
165
|
-
/**
|
|
158
|
+
/** 澶╁湴鍥炬渶灏?鏈€澶у眰绾?*/
|
|
166
159
|
tiandituLevelRange: [0, 21],
|
|
167
|
-
/**
|
|
160
|
+
/** 榛樿鍔犺浇鐨勫奖鍍忓浘灞傦紙鏈嶅姟骞冲彴妯″紡鐢熸晥锛?*/
|
|
168
161
|
defaultLayers: [
|
|
169
162
|
{ layerName: 'earthland', forMat: 'image/png', min: 0, max: 18, transparency: 0.3 },
|
|
170
|
-
{ layerName: '
|
|
163
|
+
{ layerName: '鑻嶅崡L19', forMat: 'image/png', min: 5, max: 17 },
|
|
171
164
|
],
|
|
172
|
-
/**
|
|
165
|
+
/** 榛樿鍔犺浇鐨勫湴褰㈡湇鍔★紙璧?serveUrl锛寀rl 涓虹浉瀵硅矾寰勬垨瀹屾暣鍦板潃锛涚┖鏁扮粍鍒欎笉鍔犺浇锛?*/
|
|
173
166
|
defaultTerrains: [
|
|
174
|
-
{ name: '
|
|
167
|
+
{ name: '鑻嶅崡鍘垮湴褰?, url: 'htc/service/tms/1.0.0/鑻嶅崡鍘垮湴褰EPSG%3A4326@terrain/' },
|
|
175
168
|
],
|
|
176
|
-
/**
|
|
169
|
+
/** 榛樿鍔犺浇鐨勮创鍦扮嚎锛堢煝閲忕嚎鏈嶅姟锛屼緷璧?WMTS 鏈嶅姟鍒楄〃锛涚┖鏁扮粍鍒欎笉鍔犺浇锛?*/
|
|
177
170
|
defaultGroundLines: [
|
|
178
|
-
{ name: '
|
|
179
|
-
{ name: '
|
|
180
|
-
{ name: '
|
|
181
|
-
{ name: '
|
|
171
|
+
{ name: '鑻嶅崡鍘胯竟鐣?, range: [0, 9], color: [255, 255, 0], index: 100 },
|
|
172
|
+
{ name: '鑻嶅崡鍘块晣杈圭晫', range: [9, 15], color: [0, 255, 0], index: 80 },
|
|
173
|
+
{ name: '鑻嶅崡鍘挎潙杈圭晫', range: [15, 19], color: [255, 255, 255], index: 60 },
|
|
174
|
+
{ name: '娌挎郸娴峰宸ョ▼鑼冨洿绾?, range: [0, 21], color: [0, 255, 255], index: 120 },
|
|
182
175
|
],
|
|
183
|
-
/**
|
|
176
|
+
/** 榛樿鍔犺浇鐨勫€炬枩鎽勫奖 3D Tiles锛堢┖鏁扮粍鍒欎笉鍔犺浇锛?*/
|
|
184
177
|
default3DTiles: [],
|
|
185
|
-
/**
|
|
178
|
+
/** 榛樿鐩告満瑙嗚 */
|
|
186
179
|
defaultCameraPosition: '27.3680928977018,120.414139621887,0,109379.690132486,0,0',
|
|
187
|
-
/**
|
|
180
|
+
/** 寮曟搸鍔犺浇杩涘害鍥炶皟 */
|
|
188
181
|
onProgress: null,
|
|
189
|
-
/**
|
|
190
|
-
loadingText: 'GAEA
|
|
191
|
-
/** DataHub API
|
|
182
|
+
/** 寮曟搸鍔犺浇鎻愮ず鏂囧瓧 */
|
|
183
|
+
loadingText: 'GAEA 寮曟搸鍔犺浇涓?..',
|
|
184
|
+
/** DataHub API 鍦板潃锛堝浘灞傛爲鏁版嵁鎺ュ彛锛夛紝涓虹┖鍒欏彧鐢ㄩ粯璁ゆ暟鎹?*/
|
|
192
185
|
dataHubApiUrl: '',
|
|
193
|
-
/**
|
|
186
|
+
/** 鏄惁鏄剧ず鍥惧眰鏍戞寜閽紙鍙充笂瑙掗噸缃寜閽梺杈癸級 */
|
|
194
187
|
showLayerTreeBtn: false,
|
|
195
|
-
/**
|
|
188
|
+
/** 榛樿闅愯棌鐨勫垎绫?key 鍒楄〃锛屽 ['rainStations', 'rescue'] */
|
|
196
189
|
defaultHiddenCategories: [],
|
|
197
|
-
/**
|
|
190
|
+
/** 鍥惧眰鏍戝垎绫绘暟鎹紙榛樿鏁版嵁锛屾帴鍙f暟鎹細鍚堝苟杩涙潵锛?*/
|
|
198
191
|
layerCategories: [
|
|
199
|
-
{ key: 'seawall', text: '
|
|
200
|
-
{ text: '
|
|
201
|
-
{ text: '
|
|
202
|
-
{ text: '
|
|
203
|
-
{ text: '
|
|
204
|
-
{ text: '
|
|
205
|
-
{ text: '
|
|
206
|
-
{ text: '
|
|
207
|
-
{ text: '
|
|
208
|
-
{ text: '
|
|
209
|
-
{ text: '
|
|
192
|
+
{ key: 'seawall', text: '娴峰', visible: true, children: [
|
|
193
|
+
{ text: '娌挎郸娴峰', level: '3', imgUrl: '/image/screenIcon/娴峰-3绾?png', position: { x: 27.220705, y: 120.457998, z: 20 } },
|
|
194
|
+
{ text: '闇炲叧娴峰', level: '3', imgUrl: '/image/screenIcon/娴峰-3绾?png', position: { x: 27.171059, y: 120.467901, z: 20 } },
|
|
195
|
+
{ text: '涓夎寙娴峰', level: '4', imgUrl: '/image/screenIcon/娴峰-4绾?png', position: { x: 27.193284, y: 120.464411, z: 20 } },
|
|
196
|
+
{ text: '澶ф笖娴峰', level: '2', imgUrl: '/image/screenIcon/娴峰-2绾?png', position: { x: 27.39027, y: 120.599554, z: 20 } },
|
|
197
|
+
{ text: '淇℃櫤娴峰', level: '4', imgUrl: '/image/screenIcon/娴峰-4绾?png', position: { x: 27.300806, y: 120.544077, z: 20 } },
|
|
198
|
+
{ text: '涓嬪湪娴峰', level: '3', imgUrl: '/image/screenIcon/娴峰-3绾?png', position: { x: 27.215789, y: 120.445849, z: 10 } },
|
|
199
|
+
{ text: '鏈ㄦ灄娴峰', level: '5', imgUrl: '/image/screenIcon/娴峰-5绾?png', position: { x: 27.193183, y: 120.424486, z: 20 } },
|
|
200
|
+
{ text: '闆惧煄娴峰', level: '4', imgUrl: '/image/screenIcon/娴峰-4绾?png', position: { x: 27.27682, y: 120.518917, z: 20 } },
|
|
201
|
+
{ text: '娓斿矙娴峰', level: '4', imgUrl: '/image/screenIcon/娴峰-4绾?png', position: { x: 27.403744, y: 120.557879, z: 20 } },
|
|
202
|
+
{ text: '娴佸矏宀欐捣濉?, level: '4', imgUrl: '/image/screenIcon/娴峰-4绾?png', position: { x: 27.318176, y: 120.542761, z: 20 } },
|
|
210
203
|
]},
|
|
211
|
-
{ key: 'hydrometricStations', text: '
|
|
212
|
-
{ text: '
|
|
213
|
-
{ text: '
|
|
214
|
-
{ text: '
|
|
215
|
-
{ text: '
|
|
204
|
+
{ key: 'hydrometricStations', text: '姘存枃绔?, visible: true, children: [
|
|
205
|
+
{ text: '鐏垫邯', stcd: '7010CK01', sttp: 'ZQ', position: { x: 27.5014, y: 120.3847, z: 100 } },
|
|
206
|
+
{ text: '娴佺煶', stcd: '7010CK02', sttp: 'ZQ', position: { x: 27.5029, y: 120.4615, z: 100 } },
|
|
207
|
+
{ text: '瑙傜編', stcd: '7050CK02', sttp: 'ZQ', position: { x: 27.4658, y: 120.364, z: 100 } },
|
|
208
|
+
{ text: '妗傚叞婧?, stcd: '7061CK68', sttp: 'ZQ', position: { x: 27.4584, y: 120.3071, z: 100 } },
|
|
216
209
|
]},
|
|
217
|
-
{ key: 'tideStations', text: '
|
|
218
|
-
{ key: 'riverStations', text: '
|
|
219
|
-
{ key: 'rainStations', text: '
|
|
220
|
-
{ key: 'reservoirs', text: '
|
|
221
|
-
{ key: 'sluice', text: '
|
|
222
|
-
{ text: '
|
|
223
|
-
{ text: '
|
|
224
|
-
{ text: '
|
|
225
|
-
{ text: '
|
|
226
|
-
{ text: '
|
|
227
|
-
{ text: '
|
|
210
|
+
{ key: 'tideStations', text: '娼綅绔?, visible: true, children: [] },
|
|
211
|
+
{ key: 'riverStations', text: '娌抽亾姘翠綅绔?, visible: true, children: [] },
|
|
212
|
+
{ key: 'rainStations', text: '闆ㄩ噺绔?, visible: true, children: [] },
|
|
213
|
+
{ key: 'reservoirs', text: '姘村簱', visible: true, children: [] },
|
|
214
|
+
{ key: 'sluice', text: '姘撮椄', visible: true, children: [
|
|
215
|
+
{ text: '鑱旂洘姘撮椄', position: { x: 27.200462, y: 120.465635, z: 50 } },
|
|
216
|
+
{ text: '娌挎郸姘撮椄', position: { x: 27.222987, y: 120.453175, z: 20 } },
|
|
217
|
+
{ text: '涓嬪湪姘撮椄', position: { x: 27.221816, y: 120.445182, z: 50 } },
|
|
218
|
+
{ text: '涓嬪湪娴峰绾虫帓闂?, position: { x: 27.219978, y: 120.445672, z: 50 } },
|
|
219
|
+
{ text: '宀熬姘撮椄', position: { x: 27.215762, y: 120.462235, z: 40 } },
|
|
220
|
+
{ text: '宀熬鏂伴椄', position: { x: 27.210369, y: 120.458532, z: 10 } },
|
|
228
221
|
]},
|
|
229
|
-
{ key: 'secData', text: '
|
|
222
|
+
{ key: 'secData', text: '鏂潰鏁版嵁', visible: true, children: [
|
|
230
223
|
{ text: 'YPDP0+600', position: { x: 27.217692, y: 120.461823, z: 30 },
|
|
231
224
|
indexList: {
|
|
232
|
-
1: { label: '
|
|
233
|
-
2: { label: '
|
|
234
|
-
3: { label: '6.89', details: ['
|
|
235
|
-
4: { label: '6.00', details: ['
|
|
236
|
-
5: { label: '
|
|
237
|
-
6: { label: '3.00', details: ['
|
|
238
|
-
7: { label: '
|
|
239
|
-
8: { label: '2.00', details: ['
|
|
240
|
-
9: { label: '3.94
|
|
241
|
-
10: { label: '4.5', details: ['
|
|
242
|
-
11: { label: '50
|
|
225
|
+
1: { label: '绱犲~鍦?, details: ['鎴愬垎: 浜哄伐鍥炲~榛忔€у湡', '鍘氬害: 绾?.5m', '浣滅敤: 琛ㄥ眰瑕嗙洊闃叉姢'] },
|
|
226
|
+
2: { label: '娣ゆ偿', details: ['绫诲埆: 娴风浉娣ゆ偿', '棰滆壊: 鐏伴粦鑹?, '鐘舵€? 娴佸', '鍚按鐜? 绾?5%'] },
|
|
227
|
+
3: { label: '6.89', details: ['绫诲瀷: 鍫ら《璁捐楂樼▼', '鏁板€? 6.89m', '浣滅敤: 闃叉椽鍫ゅ潩椤堕儴鏍囬珮'] },
|
|
228
|
+
4: { label: '6.00', details: ['绫诲瀷: 璁捐娲按浣?, '鏁板€? 6.00m', '鏍囧噯: 閲嶇幇鏈烶=5%'] },
|
|
229
|
+
5: { label: '妞嶈鎶ゅ潯', details: ['绫诲瀷: 鑽夌毊鎶ゅ潯', '鍧″害: 1:2', '浣滅敤: 闃叉鍧¢潰闆ㄦ按鍐插埛'] },
|
|
230
|
+
6: { label: '3.00', details: ['绫诲瀷: 甯告按浣?, '鏁板€? 3.00m', '浣滅敤: 鏃ュ父杩愯姘翠綅绾?] },
|
|
231
|
+
7: { label: '鐮栫煶娣峰悎鏂欏~绛?, details: ['鎴愬垎: 鐮栫煶涓庨粡鍦熸贩鍚?, '鍘氬害: 绾?.5m', '浣滅敤: 鍫よ韩濉瓚涓讳綋'] },
|
|
232
|
+
8: { label: '2.00', details: ['绫诲瀷: 鍫よ剼楂樼▼', '鏁板€? 2.00m', '浣滅敤: 鍫ゅ潩搴曢儴鍩虹鏍囬珮'] },
|
|
233
|
+
9: { label: '3.94璁捐娲按P=5%', details: ['绫诲瀷: 璁捐娲按浣?, '棰戠巼: 5%(20骞翠竴閬?', '鏁板€? 3.94m', '浣滅敤: 鍫ら槻璁捐鏍囧噯姘翠綅'] },
|
|
234
|
+
10: { label: '4.5', details: ['绫诲瀷: 璁捐楂樻疆浣?, '鏍囧噯: 50骞翠竴閬?, '鏁板€? 4.45m', '浣滅敤: 娴峰牑闃叉疆鏍囧噯'] },
|
|
235
|
+
11: { label: '50骞翠竴閬囪璁¢珮娼綅4.45m', details: ['绫诲瀷: 璁捐楂樻疆浣?, '閲嶇幇鏈? 50骞?, '鏁板€? 4.45m', '浣滅敤: 鏍℃牳鍫ら《楂樼▼'] },
|
|
243
236
|
},
|
|
244
237
|
favorite: '27.2201168867619,120.460489990829,152.923049719807,297.140390154652,50.2192727515776,0.00126576050689737',
|
|
245
238
|
secAnimation: [{x:27.217703, y:120.46207, z:32}, {x:27.217626, y:120.461815, z:32}, {x:27.217433, y:120.461448, z:32}] },
|
|
246
239
|
{ text: 'YPDP0+100', position: { x: 27.223027, y: 120.454653, z: 30 },
|
|
247
240
|
indexList: {
|
|
248
|
-
1: { label: '
|
|
249
|
-
2: { label: '
|
|
250
|
-
3: { label: '
|
|
251
|
-
4: { label: '6.98', details: ['
|
|
252
|
-
5: { label: '6.00', details: ['
|
|
253
|
-
6: { label: '3.94', details: ['
|
|
254
|
-
7: { label: '2.00', details: ['
|
|
255
|
-
8: { label: '4.5', details: ['
|
|
241
|
+
1: { label: '娣ゆ偿', details: ['绫诲埆: 娴风浉娣ゆ偿', '棰滆壊: 鐏伴粦鑹?, '鐘舵€? 娴佸'] },
|
|
242
|
+
2: { label: '绱犲湡', details: ['绫诲埆: 澶╃劧娌夌Н鍦?, '棰滆壊: 榛勮鑹?, '鐘舵€? 鍙', '鎵胯浇鍔? 涓€鑸?] },
|
|
243
|
+
3: { label: '鐮栫煶娣峰悎鏉愭枡濉瓚', details: ['鎴愬垎: 鐮栫煶涓庨粡鍦熸贩鍚?, '鍘氬害: 绾?m', '浣滅敤: 鍫よ韩濉瓚涓讳綋'] },
|
|
244
|
+
4: { label: '6.98', details: ['绫诲瀷: 鍫ら《璁捐楂樼▼', '鏁板€? 6.98m'] },
|
|
245
|
+
5: { label: '6.00', details: ['绫诲瀷: 璁捐娲按浣?, '鏁板€? 6.00m', '鏍囧噯: P=5%'] },
|
|
246
|
+
6: { label: '3.94', details: ['绫诲瀷: 璁捐娲按浣?, '棰戠巼: 5%', '鏁板€? 3.94m'] },
|
|
247
|
+
7: { label: '2.00', details: ['绫诲瀷: 鍫よ剼楂樼▼', '鏁板€? 2.00m'] },
|
|
248
|
+
8: { label: '4.5', details: ['绫诲瀷: 璁捐楂樻疆浣?, '鏍囧噯: 50骞翠竴閬?, '鏁板€? 4.45m'] },
|
|
256
249
|
},
|
|
257
250
|
favorite: '27.2241401069656,120.45184648674,114.05854266096,366.355033916145,42.1285030727423,359.999914392757',
|
|
258
251
|
secAnimation: [{x:27.223145, y:120.454946, z:30}, {x:27.223085, y:120.454756, z:30}, {x:27.222844, y:120.454466, z:30}] },
|
|
259
252
|
{ text: 'YPDP0+200', position: { x: 27.222541, y: 120.455453, z: 30 },
|
|
260
253
|
indexList: {
|
|
261
|
-
0: { label: '
|
|
262
|
-
1: { label: '
|
|
263
|
-
2: { label: '
|
|
264
|
-
3: { label: '6.98', details: ['
|
|
265
|
-
4: { label: '6.00', details: ['
|
|
266
|
-
5: { label: '3.94', details: ['
|
|
267
|
-
6: { label: '2.00', details: ['
|
|
268
|
-
7: { label: '4.5', details: ['
|
|
254
|
+
0: { label: '娣ゆ偿', details: ['绫诲埆: 娴风浉娣ゆ偿', '棰滆壊: 鐏伴粦鑹?, '鐘舵€? 娴佸'] },
|
|
255
|
+
1: { label: '绱犲湡', details: ['绫诲埆: 澶╃劧娌夌Н鍦?, '棰滆壊: 榛勮鑹?, '鐘舵€? 鍙'] },
|
|
256
|
+
2: { label: '鐮栫煶娣峰悎鏉愭枡濉瓚', details: ['鎴愬垎: 鐮栫煶涓庨粡鍦熸贩鍚?, '浣滅敤: 鍫よ韩濉瓚涓讳綋'] },
|
|
257
|
+
3: { label: '6.98', details: ['绫诲瀷: 鍫ら《璁捐楂樼▼', '鏁板€? 6.98m'] },
|
|
258
|
+
4: { label: '6.00', details: ['绫诲瀷: 璁捐娲按浣?, '鏁板€? 6.00m', '鏍囧噯: P=5%'] },
|
|
259
|
+
5: { label: '3.94', details: ['绫诲瀷: 璁捐娲按浣?, '棰戠巼: 5%', '鏁板€? 3.94m'] },
|
|
260
|
+
6: { label: '2.00', details: ['绫诲瀷: 鍫よ剼楂樼▼', '鏁板€? 2.00m'] },
|
|
261
|
+
7: { label: '4.5', details: ['绫诲瀷: 璁捐楂樻疆浣?, '鏍囧噯: 50骞翠竴閬?, '鏁板€? 4.45m'] },
|
|
269
262
|
},
|
|
270
263
|
favorite: '27.2239199251089,120.452312356798,114.058543530715,366.288499980401,42.128503423954,359.999913220015',
|
|
271
264
|
secAnimation: [{x:27.222801, y:120.455528, z:30}, {x:27.222681, y:120.455458, z:30}, {x:27.22226, y:120.455318, z:30}] },
|
|
272
265
|
{ text: 'YPDP0+750', position: { x: 27.220289, y: 120.459753, z: 30 },
|
|
273
266
|
indexList: {
|
|
274
|
-
0: { label: '
|
|
275
|
-
1: { label: '
|
|
276
|
-
2: { label: '7.00', details: ['
|
|
277
|
-
3: { label: '6.00', details: ['
|
|
278
|
-
4: { label: '3.94', details: ['
|
|
279
|
-
5: { label: '2.00', details: ['
|
|
280
|
-
6: { label: '4.5', details: ['
|
|
281
|
-
7: { label: '
|
|
267
|
+
0: { label: '娣ゆ偿', details: ['绫诲埆: 娴风浉娣ゆ偿', '棰滆壊: 鐏伴粦鑹?, '鐘舵€? 娴佸'] },
|
|
268
|
+
1: { label: '鐮栫煶娣峰悎鏂欏~绛?, details: ['鎴愬垎: 鐮栫煶涓庨粡鍦熸贩鍚?, '鍘氬害: 绾?.5m', '浣滅敤: 鍫よ韩濉瓚涓讳綋'] },
|
|
269
|
+
2: { label: '7.00', details: ['绫诲瀷: 鍫ら《璁捐楂樼▼', '鏁板€? 7.00m'] },
|
|
270
|
+
3: { label: '6.00', details: ['绫诲瀷: 璁捐娲按浣?, '鏁板€? 6.00m', '鏍囧噯: P=5%'] },
|
|
271
|
+
4: { label: '3.94', details: ['绫诲瀷: 璁捐娲按浣?, '棰戠巼: 5%', '鏁板€? 3.94m'] },
|
|
272
|
+
5: { label: '2.00', details: ['绫诲瀷: 鍫よ剼楂樼▼', '鏁板€? 2.00m'] },
|
|
273
|
+
6: { label: '4.5', details: ['绫诲瀷: 璁捐楂樻疆浣?, '鏍囧噯: 50骞翠竴閬?, '鏁板€? 4.45m'] },
|
|
274
|
+
7: { label: '妞嶈鎶ゅ潯', details: ['绫诲瀷: 鑽夌毊鎶ゅ潯', '鍧″害: 1:2', '浣滅敤: 闃叉鍧¢潰鍐插埛'] },
|
|
282
275
|
},
|
|
283
276
|
favorite: '27.2220502555847,120.457317110875,125.021048589548,347.301009802588,44.1512225983844,0.0020422112185327',
|
|
284
277
|
secAnimation: [{x:27.220482, y:120.459976, z:30}, {x:27.220375, y:120.459853, z:30}, {x:27.220072, y:120.459602, z:30}] },
|
|
285
278
|
]},
|
|
286
|
-
{ key: 'uavNests', text: '
|
|
287
|
-
{ key: 'rescue', text: '
|
|
288
|
-
{ text: '
|
|
289
|
-
{ text: '
|
|
290
|
-
{ text: '
|
|
291
|
-
{ text: '
|
|
292
|
-
{ text: '
|
|
279
|
+
{ key: 'uavNests', text: '鏃犱汉鏈哄发绔?, visible: true, children: [] },
|
|
280
|
+
{ key: 'rescue', text: '闅愭偅', visible: false, children: [
|
|
281
|
+
{ text: '闅愭偅1', position: { x: 27.381728, y: 120.587895, z: 20 } },
|
|
282
|
+
{ text: '闅愭偅2', position: { x: 27.183096, y: 120.48657, z: 20 } },
|
|
283
|
+
{ text: '闅愭偅3', position: { x: 27.313019, y: 120.538779, z: 20 } },
|
|
284
|
+
{ text: '闅愭偅4', position: { x: 27.219926, y: 120.455543, z: 20 } },
|
|
285
|
+
{ text: '闅愭偅5', position: { x: 27.266007, y: 120.52789, z: 20 } },
|
|
293
286
|
]},
|
|
294
|
-
{ key: 'materials', text: '
|
|
295
|
-
{ text: '
|
|
296
|
-
{ text: '
|
|
297
|
-
{ text: '
|
|
287
|
+
{ key: 'materials', text: '鐗╄祫浠撳簱', visible: false, children: [
|
|
288
|
+
{ text: '浠撳簱1', position: { x: 27.220674, y: 120.460029, z: 1.179 } },
|
|
289
|
+
{ text: '浠撳簱2', position: { x: 27.227569, y: 120.458844, z: 4.265 } },
|
|
290
|
+
{ text: '浠撳簱3', position: { x: 27.23543, y: 120.452171, z: 3.29 } },
|
|
298
291
|
]},
|
|
299
292
|
],
|
|
300
293
|
};
|
|
@@ -307,7 +300,7 @@ export function getConfig() { return _config; }
|
|
|
307
300
|
|
|
308
301
|
// ==================== GaeaApp ====================
|
|
309
302
|
|
|
310
|
-
console.log('[GaeaMethods]
|
|
303
|
+
console.log('[GaeaMethods] 妯″潡宸插姞杞?- setCategoryVisible 鍙敤');
|
|
311
304
|
|
|
312
305
|
export class GaeaApp {
|
|
313
306
|
constructor(options = {}) {
|
|
@@ -316,134 +309,131 @@ export class GaeaApp {
|
|
|
316
309
|
this.tLayers = [];
|
|
317
310
|
this.layerCategories = this.config.layerCategories || [];
|
|
318
311
|
this._screenIconList = [];
|
|
319
|
-
this._markersVisible = true; //
|
|
312
|
+
this._markersVisible = true; // 鍏ㄥ眬鍥炬爣鍙鎬э紙2D 妯″紡涓嬪己鍒堕殣钘忥紝3D 涓嬫仮澶嶏級
|
|
320
313
|
this._hiddenCategories = new Set();
|
|
321
|
-
this._tilesetMap = {}; //
|
|
314
|
+
this._tilesetMap = {}; // 宸插姞杞界殑 3D Tiles 寮曠敤锛宬ey 涓?tileset 鍚嶇О
|
|
322
315
|
this._secIsClickArr = [];
|
|
323
316
|
this._secScreenIconKeyValue = {};
|
|
324
317
|
this._groundPolygonElements = [];
|
|
325
318
|
this.tweenGroup = new TWEEN.Group();
|
|
326
319
|
this._tourConfig = {
|
|
327
|
-
'
|
|
328
|
-
{ name: '
|
|
329
|
-
{ name: '
|
|
330
|
-
{ name: '
|
|
331
|
-
{ name: '
|
|
320
|
+
'娌挎郸姘撮椄': { direction: [-0.5, 0.3, 0.3], positionList: [
|
|
321
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.222747, y: 120.453035, z: 21.4 }, lockOut: [-0.5, 0.3, 0], lockOutAngle: 1.5 },
|
|
322
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.222827, y: 120.453089, z: 21.4 }, lockIn: [-0.5, 0.3, 0], lockInAngle: -1.5, lockOut: [-0.5, 0.3, 0], lockOutAngle: 1.5 },
|
|
323
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.222909, y: 120.453142, z: 21.4 }, lockIn: [-0.5, 0.3, 0], lockInAngle: -1.5, lockOut: [-0.5, 0.3, 0], lockOutAngle: 1.5 },
|
|
324
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.222982, y: 120.453192, z: 21.4 }, lockIn: [-0.5, 0.3, 0], lockInAngle: -1.5 },
|
|
332
325
|
]},
|
|
333
|
-
'
|
|
334
|
-
{ name: '
|
|
335
|
-
{ name: '
|
|
336
|
-
{ name: '
|
|
337
|
-
{ name: '
|
|
338
|
-
{ name: '
|
|
339
|
-
{ name: '
|
|
340
|
-
{ name: '
|
|
341
|
-
{ name: '
|
|
326
|
+
'鑱旂洘姘撮椄': { direction: [1.5, 0, 0], positionList: [
|
|
327
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200467, y: 120.465716, z: 26 }, lockIn: [0, -0.5, 0], lockInAngle: -1.5, lockOut: [0.5, 0, 0], lockOutAngle: -1.5 },
|
|
328
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200486, y: 120.465716, z: 26 }, lockIn: [0.5, 0, 0], lockInAngle: 1.5, lockOut: [0.5, 0, 0], lockOutAngle: -1.5 },
|
|
329
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200513, y: 120.465716, z: 26 }, lockIn: [0.5, 0, 0], lockInAngle: 1.5, lockOut: [0, 0.5, 0], lockOutAngle: -1.5 },
|
|
330
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200513, y: 120.46561, z: 26 }, lockIn: [0, 0.5, 0], lockInAngle: 1.5, lockOut: [0, 0.5, 0], lockOutAngle: -1.5 },
|
|
331
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200513, y: 120.465524, z: 26 }, lockIn: [0, 0.5, 0], lockInAngle: 1.5, lockOut: [-0.5, 0, 0], lockOutAngle: -1.5 },
|
|
332
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200463, y: 120.465521, z: 26 }, lockIn: [-0.5, 0, 0], lockInAngle: 1.5, lockOut: [0, -0.5, 0], lockOutAngle: -1.5 },
|
|
333
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200467, y: 120.465616, z: 26 }, lockIn: [0, -0.5, 0], lockInAngle: 1.5, lockOut: [0, -0.5, 0], lockOutAngle: -1.5 },
|
|
334
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.200467, y: 120.465716, z: 26 }, lockIn: [0, -0.5, 0], lockInAngle: 1.5, lockOut: [0.5, 0, 0], lockOutAngle: -1.5 },
|
|
342
335
|
]},
|
|
343
|
-
'
|
|
344
|
-
{ name: '
|
|
345
|
-
{ name: '
|
|
346
|
-
{ name: '
|
|
336
|
+
'涓嬪湪姘撮椄': { direction: [0.5, 0, 0], positionList: [
|
|
337
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.221763, y: 120.4452, z: 27.6 }, lockOut: [0, -0.5, 0], lockOutAngle: 1.5 },
|
|
338
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.221763, y: 120.445142, z: 27.6 }, lockIn: [0, -0.5, 0], lockInAngle: -1.5, lockOut: [0, -0.5, 0], lockOutAngle: 1.5 },
|
|
339
|
+
{ name: '浣嶇疆鐐?', pos: { x: 27.221763, y: 120.445084, z: 27.6 }, lockIn: [0, -0.5, 0], lockInAngle: -1.5 },
|
|
347
340
|
]},
|
|
348
|
-
'
|
|
349
|
-
'
|
|
341
|
+
'宀熬鏂伴椄': { direction: [-0.5, 0.5, 0.5], positionList: [] },
|
|
342
|
+
'宀熬姘撮椄': { direction: [-0.4, 0.5, 0.3], positionList: [] },
|
|
350
343
|
};
|
|
351
344
|
console.log('[GaeaApp] constructor layerCategories:', this.layerCategories.length);
|
|
352
345
|
window.Gaea = Gaea;
|
|
353
346
|
|
|
354
|
-
//
|
|
347
|
+
// 鏄剧ず loading
|
|
355
348
|
showLoading();
|
|
356
349
|
|
|
357
|
-
//
|
|
350
|
+
// 鑷姩鍚姩鍒濆鍖栵紝catch 闃叉鏈鐞嗙殑 Promise rejection
|
|
358
351
|
this.ready = this._autoInit().catch(err => {
|
|
359
|
-
console.error('[GaeaApp]
|
|
352
|
+
console.error('[GaeaApp] 鍒濆鍖栧け璐?', err);
|
|
360
353
|
});
|
|
361
354
|
}
|
|
362
355
|
|
|
363
356
|
get config() { return { ..._config, ...this._options }; }
|
|
364
357
|
|
|
365
|
-
// ----
|
|
358
|
+
// ---- 鍐呴儴鍒濆鍖?----
|
|
366
359
|
|
|
367
360
|
async _autoInit() {
|
|
368
|
-
console.log('[GaeaApp]
|
|
361
|
+
console.log('[GaeaApp] 寮€濮嬪垵濮嬪寲...');
|
|
369
362
|
|
|
370
|
-
// 1.
|
|
363
|
+
// 1. 绛?canvas 灏辩华
|
|
371
364
|
await this._waitForCanvas();
|
|
372
|
-
console.log('[GaeaApp] canvas
|
|
365
|
+
console.log('[GaeaApp] canvas 灏辩华');
|
|
373
366
|
|
|
374
|
-
// 2.
|
|
367
|
+
// 2. 鍚姩 Godot 寮曟搸
|
|
375
368
|
await this._startEngine();
|
|
376
|
-
console.log('[GaeaApp]
|
|
369
|
+
console.log('[GaeaApp] 寮曟搸鍚姩瀹屾垚');
|
|
377
370
|
|
|
378
|
-
// 3.
|
|
379
|
-
|
|
380
|
-
console.log('[GaeaApp] 环境初始化完成');
|
|
371
|
+
// 3. 鍒濆鍖栫幆澧? await this._initEnvironment();
|
|
372
|
+
console.log('[GaeaApp] 鐜鍒濆鍖栧畬鎴?);
|
|
381
373
|
|
|
382
|
-
// 4.
|
|
374
|
+
// 4. 鍔犺浇榛樿鍥惧眰
|
|
383
375
|
await this._initLayers();
|
|
384
|
-
console.log('[GaeaApp]
|
|
376
|
+
console.log('[GaeaApp] 鍥惧眰鍔犺浇瀹屾垚');
|
|
385
377
|
|
|
386
|
-
//
|
|
378
|
+
// 褰卞儚/鍦板舰灏辩华鍗冲彲鏄剧ず鍦板浘锛岄殣钘?loading锛岄伩鍏嶇敤鎴风瓑寰呮ā鍨?鎺ュ彛
|
|
387
379
|
hideLoading();
|
|
388
380
|
this._addResetButton();
|
|
389
381
|
this._addLayerTreeButton();
|
|
390
|
-
console.log('[GaeaApp]
|
|
382
|
+
console.log('[GaeaApp] 鍦板浘宸插氨缁紝妯″瀷涓庡浘灞傛爲鏁版嵁鍚庡彴鍔犺浇涓?..');
|
|
391
383
|
|
|
392
|
-
//
|
|
384
|
+
// 鍓╀綑閲嶈祫婧愶紙妯″瀷浣嶇疆銆丟LTF銆佸浘灞傛爲鎺ュ彛銆佸睆骞曞浘鏍囷級鍚庡彴寮傛鍔犺浇锛屼笉闃诲鍦板浘鏄剧ず
|
|
393
385
|
this._loadRestAsync();
|
|
394
386
|
}
|
|
395
387
|
|
|
396
|
-
/**
|
|
388
|
+
/** 鍚庡彴寮傛鍔犺浇锛氭ā鍨嬩綅缃皟鏁?鈫?GLTF 鈫?鍥惧眰鏍戞暟鎹?鈫?灞忓箷鍥炬爣 */
|
|
397
389
|
async _loadRestAsync() {
|
|
398
390
|
try {
|
|
399
|
-
// 5.
|
|
400
|
-
console.log('[GaeaApp]
|
|
391
|
+
// 5. 璋冩暣妯″瀷浣嶇疆
|
|
392
|
+
console.log('[GaeaApp] 寮€濮嬭皟鏁存ā鍨嬩綅缃?..');
|
|
401
393
|
const models = [
|
|
402
|
-
{ nodeName: '
|
|
403
|
-
{ nodeName: '
|
|
404
|
-
{ nodeName: '
|
|
405
|
-
{ nodeName: '
|
|
406
|
-
{ nodeName: '
|
|
394
|
+
{ nodeName: '娌挎郸姘撮椄', position: '-2876603.788, 4892658.352, 2900208.622', rotation: '-37.24, 162.42, -17.17' },
|
|
395
|
+
{ nodeName: '涓嬪湪姘撮椄', position: '-2875959.024, 4893109.058, 2900101.919', rotation: '-23.42, -165.20, -34.52' },
|
|
396
|
+
{ nodeName: '鑱旂洘姘撮椄', position: '-2878251.995, 4893011.199, 2897998.160', rotation: '-23.43, -165.98, -33.40' },
|
|
397
|
+
{ nodeName: '宀熬鏂伴椄', position: '-2877382.212, 4892920.226, 2898965.484', rotation: '7.79, 36.98, 40.83' },
|
|
398
|
+
{ nodeName: '宀熬姘撮椄', position: '-2877582.576, 4892520.352, 2899499.184', rotation: '-41.04, 126.37, 6.29' },
|
|
407
399
|
];
|
|
408
400
|
for (const model of models) {
|
|
409
401
|
try {
|
|
410
402
|
const node = Gaea.World.Instance.GetNode(model.nodeName);
|
|
411
|
-
if (!node) { console.warn(`[GaeaApp]
|
|
403
|
+
if (!node) { console.warn(`[GaeaApp] 鏈壘鍒拌妭鐐? ${model.nodeName}`); continue; }
|
|
412
404
|
const inst = Gaea.MeshInstance.ConvertBy(node);
|
|
413
405
|
const pos = model.position.split(',').map(v => parseFloat(v.trim()));
|
|
414
406
|
const rot = model.rotation.split(',').map(v => parseFloat(v.trim()));
|
|
415
407
|
if (inst.Translation) inst.Translation = new Gaea.Vector3(pos[0], pos[1], pos[2]);
|
|
416
408
|
if (inst.RotationDegrees) inst.RotationDegrees = new Gaea.Vector3(rot[0], rot[1], rot[2]);
|
|
417
409
|
} catch (e) {
|
|
418
|
-
console.warn(`[GaeaApp]
|
|
410
|
+
console.warn(`[GaeaApp] 璋冩暣妯″瀷 ${model.nodeName} 澶辫触:`, e.message);
|
|
419
411
|
}
|
|
420
412
|
}
|
|
421
|
-
console.log('[GaeaApp]
|
|
413
|
+
console.log('[GaeaApp] 鎵€鏈夋ā鍨嬩綅缃皟鏁村畬鎴?);
|
|
422
414
|
|
|
423
|
-
// 6.
|
|
415
|
+
// 6. 鍔犺浇 GLTF 妯″瀷
|
|
424
416
|
await this._loadGltfModels();
|
|
425
417
|
|
|
426
|
-
// 7.
|
|
418
|
+
// 7. 鑾峰彇鍥惧眰鏍戞暟鎹紙鏈夋帴鍙h蛋鎺ュ彛锛屾病鎺ュ彛鐢ㄩ粯璁わ級
|
|
427
419
|
await this._fetchLayerTreeData();
|
|
428
420
|
|
|
429
|
-
//
|
|
421
|
+
// 鍚屾 layerCategories锛堜慨澶嶆暟鎹洿鏂版湭鍚屾鐨勯棶棰橈級
|
|
430
422
|
this.layerCategories = this.config.layerCategories || [];
|
|
431
|
-
console.log('[GaeaApp] layerCategories
|
|
423
|
+
console.log('[GaeaApp] layerCategories 鏇存柊鍚?', this.layerCategories.length);
|
|
432
424
|
|
|
433
|
-
// 8.
|
|
434
|
-
this._initScreenIcons();
|
|
425
|
+
// 8. 鍒濆鍖栧睆骞曞浘鏍? this._initScreenIcons();
|
|
435
426
|
|
|
436
|
-
//
|
|
437
|
-
const hiddenCats = this.config.defaultHiddenCategories || []
|
|
427
|
+
// 搴旂敤榛樿闅愯棌鐨勫垎绫? const hiddenCats = this.config.defaultHiddenCategories || []
|
|
438
428
|
hiddenCats.forEach(key => {
|
|
439
429
|
const cat = this.layerCategories.find(c => c.key === key)
|
|
440
430
|
if (cat) cat.visible = false
|
|
441
431
|
this.setCategoryVisible(key, false)
|
|
442
432
|
})
|
|
443
433
|
|
|
444
|
-
console.log('[GaeaApp]
|
|
434
|
+
console.log('[GaeaApp] 鍚庡彴璧勬簮鍔犺浇瀹屾垚');
|
|
445
435
|
} catch (e) {
|
|
446
|
-
console.error('[GaeaApp]
|
|
436
|
+
console.error('[GaeaApp] 鍚庡彴璧勬簮鍔犺浇鍑洪敊:', e);
|
|
447
437
|
}
|
|
448
438
|
}
|
|
449
439
|
|
|
@@ -455,7 +445,7 @@ export class GaeaApp {
|
|
|
455
445
|
if (el && el.width > 0) {
|
|
456
446
|
resolve();
|
|
457
447
|
} else if (Date.now() - start > 10000) {
|
|
458
|
-
reject(new Error('
|
|
448
|
+
reject(new Error('绛夊緟 canvas 瓒呮椂'));
|
|
459
449
|
} else {
|
|
460
450
|
requestAnimationFrame(check);
|
|
461
451
|
}
|
|
@@ -466,10 +456,10 @@ export class GaeaApp {
|
|
|
466
456
|
|
|
467
457
|
async _startEngine() {
|
|
468
458
|
if (!window.Engine) {
|
|
469
|
-
throw new Error('window.Engine
|
|
459
|
+
throw new Error('window.Engine 涓嶅瓨鍦紝璇风‘淇?<script src="/Gaea.js"> 宸插姞杞?);
|
|
470
460
|
}
|
|
471
461
|
if (!window.Engine.isWebGLAvailable()) {
|
|
472
|
-
throw new Error('WebGL
|
|
462
|
+
throw new Error('WebGL 涓嶅彲鐢?);
|
|
473
463
|
}
|
|
474
464
|
|
|
475
465
|
const cfg = this.config;
|
|
@@ -486,7 +476,7 @@ export class GaeaApp {
|
|
|
486
476
|
});
|
|
487
477
|
|
|
488
478
|
await engine.startGame({
|
|
489
|
-
onProgress: cfg.onProgress || ((cur, total) => console.log(
|
|
479
|
+
onProgress: cfg.onProgress || ((cur, total) => console.log(`寮曟搸鍔犺浇: ${cur}/${total}`)),
|
|
490
480
|
});
|
|
491
481
|
}
|
|
492
482
|
|
|
@@ -515,10 +505,10 @@ export class GaeaApp {
|
|
|
515
505
|
const cfg = this.config;
|
|
516
506
|
|
|
517
507
|
if (cfg.serviceMode === 'online') {
|
|
518
|
-
//
|
|
508
|
+
// 鍦ㄧ嚎妯″紡锛氫粎鍔犺浇澶╁湴鍥惧奖鍍忥紝涓嶅姞杞藉湴褰?璐村湴绾?3D Tiles
|
|
519
509
|
this.addTianditu();
|
|
520
510
|
} else {
|
|
521
|
-
//
|
|
511
|
+
// 鏈嶅姟骞冲彴妯″紡锛歐MTS 褰卞儚 + 璐村湴绾?+ 鍦板舰
|
|
522
512
|
await this.getAllServe();
|
|
523
513
|
const list = cfg.defaultLayers;
|
|
524
514
|
if (list?.length) {
|
|
@@ -526,79 +516,74 @@ export class GaeaApp {
|
|
|
526
516
|
this.addLayer(layer);
|
|
527
517
|
}
|
|
528
518
|
}
|
|
529
|
-
//
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
// 倾斜摄影 3D Tiles(isInitLoad 为 true 的自动加载,依赖地形服务)
|
|
534
|
-
const tiles = cfg.default3DTiles || []
|
|
519
|
+
// 璐村湴绾匡紙鐭㈤噺绾挎湇鍔★紝渚濊禆 this.layers锛? try { this.addGroundLines(); } catch (e) { console.error('鍔犺浇璐村湴绾垮け璐?', e); }
|
|
520
|
+
// 鍦板舰鏈嶅姟
|
|
521
|
+
try { await this.addInitTerrainServer(); } catch (e) { console.error('鍔犺浇鍦板舰澶辫触:', e); }
|
|
522
|
+
// 鍊炬枩鎽勫奖 3D Tiles锛坕sInitLoad 涓?true 鐨勮嚜鍔ㄥ姞杞斤紝渚濊禆鍦板舰鏈嶅姟锛? const tiles = cfg.default3DTiles || []
|
|
535
523
|
tiles.filter(item => item.isInitLoad).forEach(item => this.add3DTiles(item))
|
|
536
524
|
}
|
|
537
525
|
|
|
538
526
|
const pos = cfg.defaultCameraPosition;
|
|
539
527
|
if (pos) {
|
|
540
|
-
//
|
|
528
|
+
// 绛変竴甯у啀璁剧浉鏈猴紝纭繚寮曟搸鎶婂浘灞傚鐞嗗畬
|
|
541
529
|
await new Promise(r => requestAnimationFrame(r));
|
|
542
530
|
this.SetPosition(pos);
|
|
543
531
|
}
|
|
544
532
|
}
|
|
545
533
|
|
|
546
|
-
// ----
|
|
534
|
+
// ---- 澶╁湴鍥?----
|
|
547
535
|
|
|
548
|
-
/**
|
|
536
|
+
/** 鍔犺浇澶╁湴鍥惧奖鍍?+ 娉ㄨ */
|
|
549
537
|
addTianditu() {
|
|
550
538
|
const cfg = this.config;
|
|
551
539
|
|
|
552
|
-
//
|
|
553
|
-
const imgStore = new Gaea.TDTWMTSImageStore();
|
|
540
|
+
// 褰卞儚搴曞浘锛堝崼鏄熷浘锛? const imgStore = new Gaea.TDTWMTSImageStore();
|
|
554
541
|
imgStore.ServerUri = cfg.tiandituServerUri || 'https://t{0}.tianditu.gov.cn/img_c/wmts';
|
|
555
542
|
imgStore.FormatString = cfg.tiandituFormatString || 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=img&STYLE=default&TILEMATRIXSET=c&FORMAT=tiles&TILECOL={0}&TILEROW={1}&TILEMATRIX={2}&tk={3}';
|
|
556
543
|
imgStore.ImageExtension = cfg.tiandituImageExtension ?? Gaea.ImageExtensionEnum.JPEG;
|
|
557
544
|
imgStore.TK = cfg.tiandituToken;
|
|
558
|
-
imgStore.Name = '
|
|
545
|
+
imgStore.Name = '褰卞儚搴曞浘';
|
|
559
546
|
imgStore.LevelRange = new Gaea.Vector2(cfg.tiandituLevelRange[0], cfg.tiandituLevelRange[1]);
|
|
560
547
|
Gaea.World.Instance.DefaultPyramidTileSet.AddImageStore(imgStore);
|
|
561
|
-
console.log('
|
|
548
|
+
console.log('澶╁湴鍥惧奖鍍忓姞杞芥垚鍔?);
|
|
562
549
|
|
|
563
|
-
//
|
|
564
|
-
const labelStore = new Gaea.TDTWMTSImageStore();
|
|
550
|
+
// 娉ㄨ鍥惧眰锛堥亾璺?鍦板悕鏍囨敞锛? const labelStore = new Gaea.TDTWMTSImageStore();
|
|
565
551
|
labelStore.ServerUri = 'https://t{0}.tianditu.gov.cn/cia_c/wmts';
|
|
566
552
|
labelStore.FormatString = 'SERVICE=WMTS&REQUEST=GetTile&VERSION=1.0.0&LAYER=cia&STYLE=default&TILEMATRIXSET=c&FORMAT=image/png&TILECOL={0}&TILEROW={1}&TILEMATRIX={2}&tk={3}';
|
|
567
553
|
labelStore.ImageExtension = Gaea.ImageExtensionEnum.PNG;
|
|
568
554
|
labelStore.TK = cfg.tiandituToken;
|
|
569
|
-
labelStore.Name = '
|
|
555
|
+
labelStore.Name = '澶╁湴鍥炬敞璁?;
|
|
570
556
|
labelStore.LevelRange = new Gaea.Vector2(cfg.tiandituLevelRange[0], cfg.tiandituLevelRange[1]);
|
|
571
557
|
Gaea.World.Instance.DefaultPyramidTileSet.AddImageStore(labelStore);
|
|
572
|
-
console.log('
|
|
558
|
+
console.log('澶╁湴鍥炬敞璁板姞杞芥垚鍔?);
|
|
573
559
|
|
|
574
560
|
return { imgStore, labelStore };
|
|
575
561
|
}
|
|
576
562
|
|
|
577
|
-
/**
|
|
563
|
+
/** 娣诲姞鍙充笂瑙掗噸缃寜閽?*/
|
|
578
564
|
_addResetButton() {
|
|
579
565
|
if (document.getElementById('gaea-reset-btn')) return;
|
|
580
566
|
const btn = document.createElement('button');
|
|
581
567
|
btn.id = 'gaea-reset-btn';
|
|
582
|
-
btn.title = '
|
|
583
|
-
btn.innerHTML = '
|
|
568
|
+
btn.title = '閲嶇疆瑙嗚';
|
|
569
|
+
btn.innerHTML = '鉄?;
|
|
584
570
|
btn.onclick = () => {
|
|
585
571
|
const pos = this.config.defaultCameraPosition;
|
|
586
572
|
if (pos) this.SetPosition(pos);
|
|
587
|
-
//
|
|
573
|
+
// 瑙i攣瑙嗚锛堝唴閮ㄤ細璋?UseAutoVisible 鎭㈠闈炴柇闈㈠浘鏍囷級
|
|
588
574
|
this.lockedModesSwitch(false);
|
|
589
|
-
//
|
|
575
|
+
// 鎭㈠琚?hiddenScreenWithClass 闅愯棌鐨勫浘鏍?DOM
|
|
590
576
|
if (this._markersVisible) {
|
|
591
577
|
document.querySelectorAll('.gaea-locationLineStyle, .gaea-iconscreen, .gaea-iconGif').forEach(el => {
|
|
592
578
|
el.style.display = '';
|
|
593
579
|
});
|
|
594
580
|
}
|
|
595
|
-
//
|
|
581
|
+
// 鏂潰妯″瀷缂╁洖
|
|
596
582
|
if (this._raisedSection) {
|
|
597
583
|
this._raisedSection.TranslateObjectLocal(new Gaea.Vector3(0, -44, 0));
|
|
598
584
|
this._raisedSection = null;
|
|
599
585
|
}
|
|
600
|
-
//
|
|
601
|
-
if (this._currentTourModel) {
|
|
586
|
+
// 閲嶇疆娓歌妯″瀷浣嶇疆鍒板垵濮嬩綅缃? if (this._currentTourModel) {
|
|
602
587
|
const name = this._currentTourModel?.Root?.Name;
|
|
603
588
|
const cfg = this._gltfCfgMap?.[name];
|
|
604
589
|
if (cfg) {
|
|
@@ -607,10 +592,9 @@ export class GaeaApp {
|
|
|
607
592
|
this._currentTourModel = null;
|
|
608
593
|
this._currentTourIndexPos = 0;
|
|
609
594
|
}
|
|
610
|
-
//
|
|
611
|
-
this._secIsClickArr = [];
|
|
595
|
+
// 閲嶇疆鏂潰鐘舵€? this._secIsClickArr = [];
|
|
612
596
|
this._secScreenIconKeyValue = {};
|
|
613
|
-
//
|
|
597
|
+
// 闅愯棌鏂潰鏍囩
|
|
614
598
|
this._screenIconList.forEach(item => {
|
|
615
599
|
if (item.type === 'dabaSec') {
|
|
616
600
|
item.element.ForceSetVisible(false);
|
|
@@ -618,48 +602,48 @@ export class GaeaApp {
|
|
|
618
602
|
}
|
|
619
603
|
});
|
|
620
604
|
document.querySelectorAll('.waterLevel, .damScreen').forEach(el => el.style.display = 'none');
|
|
621
|
-
//
|
|
605
|
+
// 閫氱煡 SecTourView 闅愯棌
|
|
622
606
|
document.dispatchEvent(new CustomEvent('gaea-reset-view', { bubbles: true }));
|
|
623
607
|
};
|
|
624
608
|
document.body.appendChild(btn);
|
|
625
609
|
}
|
|
626
610
|
|
|
627
|
-
/**
|
|
611
|
+
/** 娣诲姞鍥惧眰鏍戞寜閽?*/
|
|
628
612
|
_addLayerTreeButton() {
|
|
629
613
|
if (document.getElementById('gaea-layertree-btn')) return
|
|
630
614
|
const btn = document.createElement('button')
|
|
631
615
|
btn.id = 'gaea-layertree-btn'
|
|
632
|
-
btn.title = '
|
|
633
|
-
btn.innerHTML = '
|
|
616
|
+
btn.title = '鍥惧眰鎺у埗'
|
|
617
|
+
btn.innerHTML = '鈽?
|
|
634
618
|
btn.onclick = () => {
|
|
635
619
|
document.dispatchEvent(new CustomEvent('gaea-toggle-layertree'))
|
|
636
620
|
}
|
|
637
621
|
document.body.appendChild(btn)
|
|
638
622
|
}
|
|
639
623
|
|
|
640
|
-
// ---- GLTF
|
|
624
|
+
// ---- GLTF 妯″瀷 ----
|
|
641
625
|
|
|
642
626
|
async _loadGltfModels() {
|
|
643
627
|
const gltfList = [
|
|
644
|
-
{ name: 'YPDP0+600', position: { x: 27.217692, y: 120.461823, z: -44 }, rotate: [0, 198, 0], size: [1, 1, 1], show: true, url: 'gltf
|
|
645
|
-
{ name: 'YPDP0+750', position: { x: 27.220289, y: 120.459753, z: -44 }, rotate: [0, 226, 0], size: [1, 1, 1], show: true, url: 'gltf
|
|
646
|
-
{ name: 'YPDP0+100', position: { x: 27.223027, y: 120.454653, z: -44 }, rotate: [0, 222, 0], size: [1, 1, 1], show: true, url: 'gltf
|
|
647
|
-
{ name: 'YPDP0+200', position: { x: 27.222541, y: 120.455453, z: -44 }, rotate: [0, 246, 0], size: [1, 1, 1], show: true, url: 'gltf
|
|
648
|
-
{ name: '
|
|
649
|
-
{ name: '
|
|
650
|
-
{ name: '
|
|
651
|
-
{ name: 'YPDP0+600
|
|
652
|
-
{ name: 'YPDP0+750
|
|
653
|
-
{ name: 'YPDP0+100
|
|
654
|
-
{ name: 'YPDP0+200
|
|
655
|
-
{ name: '
|
|
656
|
-
{ name: '
|
|
657
|
-
{ name: '
|
|
658
|
-
{ name: '
|
|
659
|
-
{ name: '
|
|
660
|
-
{ name: '
|
|
661
|
-
{ name: '
|
|
662
|
-
{ name: '
|
|
628
|
+
{ name: 'YPDP0+600', position: { x: 27.217692, y: 120.461823, z: -44 }, rotate: [0, 198, 0], size: [1, 1, 1], show: true, url: 'gltf/澶у潩鏂潰600.gltf' },
|
|
629
|
+
{ name: 'YPDP0+750', position: { x: 27.220289, y: 120.459753, z: -44 }, rotate: [0, 226, 0], size: [1, 1, 1], show: true, url: 'gltf/澶у潩鏂潰750.gltf' },
|
|
630
|
+
{ name: 'YPDP0+100', position: { x: 27.223027, y: 120.454653, z: -44 }, rotate: [0, 222, 0], size: [1, 1, 1], show: true, url: 'gltf/澶у潩鏂潰100.gltf' },
|
|
631
|
+
{ name: 'YPDP0+200', position: { x: 27.222541, y: 120.455453, z: -44 }, rotate: [0, 246, 0], size: [1, 1, 1], show: true, url: 'gltf/澶у潩鏂潰200.gltf' },
|
|
632
|
+
{ name: '娌挎郸娉电珯', position: { x: 27.222001, y: 120.452509, z: 17 }, rotate: [0, -38, 0], size: [1, 1, 1], show: true, url: 'gltf/娌挎郸娉电珯.gltf', enablePick: true },
|
|
633
|
+
{ name: '涓嬪湪娴峰绾虫帓闂?, position: { x: 27.219978, y: 120.445672, z: 15 }, rotate: [0, 0, 0], size: [1, 1, 1], show: true, url: 'gltf/涓嬪湪娴峰绾虫帓闂?gltf', enablePick: true },
|
|
634
|
+
{ name: '鐩掑瓙妯″瀷', position: { x: 27.241836, y: 120.462750, z: 50 }, rotate: [0, 90, 0], size: [10, 10, 10], show: true, url: 'gltf/box.gltf' },
|
|
635
|
+
{ name: 'YPDP0+600娓歌妯″瀷', position: { x: 27.217433, y: 120.461448, z: 32 }, rotate: [0, 90, 0], size: [1, 1, 1], show: true, url: 'gltf/box.gltf' },
|
|
636
|
+
{ name: 'YPDP0+750娓歌妯″瀷', position: { x: 27.220072, y: 120.459602, z: 30 }, rotate: [0, 90, 0], size: [1, 1, 1], show: true, url: 'gltf/box.gltf' },
|
|
637
|
+
{ name: 'YPDP0+100娓歌妯″瀷', position: { x: 27.222844, y: 120.454466, z: 30 }, rotate: [0, 90, 0], size: [1, 1, 1], show: true, url: 'gltf/box.gltf' },
|
|
638
|
+
{ name: 'YPDP0+200娓歌妯″瀷', position: { x: 27.22226, y: 120.455318, z: 30 }, rotate: [0, 90, 0], size: [1, 1, 1], show: true, url: 'gltf/box.gltf' },
|
|
639
|
+
{ name: '娌挎郸姘撮椄娓歌妯″瀷', position: { x: 27.222747, y: 120.453035, z: 21.8 }, rotate: [0, -30, 0], size: [1, 1, 1], show: false, url: 'gltf/box.gltf' },
|
|
640
|
+
{ name: '娌挎郸姘撮椄瀹氫綅妯″瀷', position: { x: 27.230788, y: 120.453009, z: 487.5 }, rotate: [0, 0, 0], size: [1, 1, 1], show: false, url: 'gltf/box.gltf' },
|
|
641
|
+
{ name: '涓嬪湪姘撮椄娓歌妯″瀷', position: { x: 27.221763, y: 120.4452, z: 27.6 }, rotate: [0, 0, 0], size: [1, 1, 1], show: false, url: 'gltf/box.gltf' },
|
|
642
|
+
{ name: '鑱旂洘姘撮椄娓歌妯″瀷', position: { x: 27.200467, y: 120.465716, z: 26 }, rotate: [0, 180, 0], size: [0.1, 0.1, 0.1], show: false, url: 'gltf/box.gltf' },
|
|
643
|
+
{ name: '宀熬姘撮椄娓歌妯″瀷', position: { x: 27.215661, y: 120.462325, z: 34 }, rotate: [0, -66, 0], size: [1, 1, 1], show: false, url: 'gltf/box.gltf' },
|
|
644
|
+
{ name: '宀熬鏂伴椄娓歌妯″瀷', position: { x: 27.21038, y: 120.458513, z: 4 }, rotate: [0, 30, 0], size: [1, 1, 1], show: false, url: 'gltf/box.gltf' },
|
|
645
|
+
{ name: '鐩掑瓙妯″瀷-yanpu', position: { x: 27.231665, y: 120.456095, z: 48.608 }, rotate: [0, 90, 0], size: [10, 10, 10], show: true, url: 'gltf/box.gltf' },
|
|
646
|
+
{ name: '闃叉睕娌欒', position: { x: 27.218723, y: 120.460473, z: 18 }, rotate: [0, 0, 0], size: [1, 1, 1], show: false, url: 'gltf/sanddai.glb' },
|
|
663
647
|
];
|
|
664
648
|
|
|
665
649
|
this._gltfCfgMap = {};
|
|
@@ -668,16 +652,15 @@ export class GaeaApp {
|
|
|
668
652
|
this._gltfCfgMap[item.name] = item;
|
|
669
653
|
}
|
|
670
654
|
|
|
671
|
-
console.log('[GaeaApp]
|
|
672
|
-
//
|
|
673
|
-
await Promise.all(gltfList.map(async (item) => {
|
|
655
|
+
console.log('[GaeaApp] 寮€濮嬪姞杞?GLTF 妯″瀷...');
|
|
656
|
+
// 骞惰鍔犺浇鎵€鏈夋ā鍨嬶紙鍘熶覆琛岄€愪釜 await 浼氱疮鍔犺€楁椂锛? await Promise.all(gltfList.map(async (item) => {
|
|
674
657
|
item.url = encodeURI(item.url);
|
|
675
658
|
try {
|
|
676
659
|
const el = await this.AddGltf(item);
|
|
677
660
|
if (el) this._gltfElements[item.name] = el;
|
|
678
|
-
} catch (e) { console.warn(`[GaeaApp]
|
|
661
|
+
} catch (e) { console.warn(`[GaeaApp] 妯″瀷 ${item.name} 鍔犺浇澶辫触:`, e.message); }
|
|
679
662
|
}));
|
|
680
|
-
console.log('[GaeaApp] GLTF
|
|
663
|
+
console.log('[GaeaApp] GLTF 妯″瀷鍔犺浇瀹屾垚');
|
|
681
664
|
}
|
|
682
665
|
|
|
683
666
|
AddGltf = ({
|
|
@@ -689,10 +672,10 @@ export class GaeaApp {
|
|
|
689
672
|
const element = new Gaea.GLTFElement();
|
|
690
673
|
element.UseAbsoluteHeight = useAbsoluteHeight;
|
|
691
674
|
element.ResourceName = url;
|
|
692
|
-
console.log(
|
|
675
|
+
console.log(`妯″瀷寮€濮嬪姞杞? ${name}`);
|
|
693
676
|
|
|
694
677
|
element.OnModelInit(async () => {
|
|
695
|
-
//
|
|
678
|
+
// 澶у潩鏂潰妯″瀷璁剧疆 Unshaded
|
|
696
679
|
if (name.includes('YPDP0')) {
|
|
697
680
|
const n = element.Root.GetChildCount();
|
|
698
681
|
for (let i = 0; i < n; i++) {
|
|
@@ -704,7 +687,7 @@ export class GaeaApp {
|
|
|
704
687
|
}
|
|
705
688
|
}
|
|
706
689
|
}
|
|
707
|
-
console.log(
|
|
690
|
+
console.log(`妯″瀷鍔犺浇瀹屾瘯: ${name}`);
|
|
708
691
|
initFun();
|
|
709
692
|
element.EnablePick = enablePick;
|
|
710
693
|
Gaea.QueryServer.Instance.Enable = enablePick;
|
|
@@ -723,36 +706,35 @@ export class GaeaApp {
|
|
|
723
706
|
});
|
|
724
707
|
};
|
|
725
708
|
|
|
726
|
-
// ----
|
|
709
|
+
// ---- 鍥惧眰鏍戞暟鎹?----
|
|
727
710
|
|
|
728
711
|
async _fetchLayerTreeData() {
|
|
729
712
|
const cfg = this.config;
|
|
730
713
|
const apiUrl = cfg.dataHubApiUrl;
|
|
731
714
|
if (!apiUrl) {
|
|
732
|
-
console.log('[GaeaApp]
|
|
715
|
+
console.log('[GaeaApp] 鏈厤缃?dataHubApiUrl锛屼娇鐢ㄩ粯璁ゅ浘灞傛爲鏁版嵁');
|
|
733
716
|
return;
|
|
734
717
|
}
|
|
735
|
-
console.log('[GaeaApp]
|
|
718
|
+
console.log('[GaeaApp] 浠?DataHub 鑾峰彇鍥惧眰鏍戞暟鎹?..');
|
|
736
719
|
try {
|
|
737
720
|
const res = await fetch(`${apiUrl}/open/api/5rLGPS6E8Zvr`, { headers: this._dataHubHeaders(cfg) });
|
|
738
721
|
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
739
722
|
const json = await res.json();
|
|
740
723
|
if (json.data) this._mergeStationData(json.data);
|
|
741
|
-
console.log('[GaeaApp]
|
|
724
|
+
console.log('[GaeaApp] 鍥惧眰鏍戞暟鎹洿鏂板畬鎴?);
|
|
742
725
|
} catch (e) {
|
|
743
|
-
console.warn('[GaeaApp]
|
|
726
|
+
console.warn('[GaeaApp] 鎺ュ彛鑾峰彇澶辫触锛屼娇鐢ㄩ粯璁ゆ暟鎹?', e.message);
|
|
744
727
|
}
|
|
745
728
|
}
|
|
746
729
|
|
|
747
|
-
/** DataHub API
|
|
730
|
+
/** DataHub API 绛惧悕澶达紙HmacSHA256锛?*/
|
|
748
731
|
_dataHubHeaders(cfg) {
|
|
749
732
|
const appKey = cfg.dataHubAppKey || 'testAppKey';
|
|
750
733
|
const appSecret = cfg.dataHubAppSecret || 'testAppSecret';
|
|
751
734
|
const nonce = Math.random().toString(36).substring(2, 10);
|
|
752
735
|
const timestamp = Date.now();
|
|
753
736
|
const signStr = `${appKey}${timestamp}${nonce}`;
|
|
754
|
-
//
|
|
755
|
-
const signature = btoa(signStr + appSecret);
|
|
737
|
+
// 绠€鍖栫増锛氱敤 btoa 鏇夸唬 HmacSHA256锛堢敓浜х幆澧冮渶鐢?Web Crypto API锛? const signature = btoa(signStr + appSecret);
|
|
756
738
|
return {
|
|
757
739
|
'Content-Type': 'application/json',
|
|
758
740
|
'X-App-Key': appKey,
|
|
@@ -762,7 +744,7 @@ export class GaeaApp {
|
|
|
762
744
|
};
|
|
763
745
|
}
|
|
764
746
|
|
|
765
|
-
/**
|
|
747
|
+
/** 灏咥PI娴嬬珯鏁版嵁鍚堝苟鍒伴粯璁ゅ垎绫讳腑 */
|
|
766
748
|
_mergeStationData(apiData) {
|
|
767
749
|
const cfg = this.config;
|
|
768
750
|
const sttpMap = {
|
|
@@ -788,12 +770,12 @@ export class GaeaApp {
|
|
|
788
770
|
}
|
|
789
771
|
}
|
|
790
772
|
|
|
791
|
-
/**
|
|
773
|
+
/** 浠庡浘灞傛爲鏁版嵁鍒涘缓灞忓箷鍥炬爣 */
|
|
792
774
|
_initScreenIcons() {
|
|
793
775
|
const cats = this.layerCategories || [];
|
|
794
776
|
const catConfig = {
|
|
795
777
|
seawall: {
|
|
796
|
-
img: '/image/screenIcon
|
|
778
|
+
img: '/image/screenIcon/娴峰-绾?png', method: 'textImage',
|
|
797
779
|
visibleRange: [5000, 150000], offset: [-40, -35], anchorType: 6,
|
|
798
780
|
onClick: (name, data) => {
|
|
799
781
|
this.flyToNode(data);
|
|
@@ -801,7 +783,7 @@ export class GaeaApp {
|
|
|
801
783
|
},
|
|
802
784
|
},
|
|
803
785
|
hydrometricStations: {
|
|
804
|
-
img: '/image/screenIcon
|
|
786
|
+
img: '/image/screenIcon/娼綅绔?姝e父.png', method: 'textImage',
|
|
805
787
|
visibleRange: [10, 5000], offset: [-40, -35],
|
|
806
788
|
onClick: (name, data) => {
|
|
807
789
|
console.log('[GaeaApp] hydrometricStations onClick:', name, data);
|
|
@@ -814,18 +796,18 @@ export class GaeaApp {
|
|
|
814
796
|
if (window.__gaeaIconClickHandler) {
|
|
815
797
|
window.__gaeaIconClickHandler({ detail: eventData });
|
|
816
798
|
}
|
|
817
|
-
console.log('[GaeaApp] hydrometricStations
|
|
799
|
+
console.log('[GaeaApp] hydrometricStations 浜嬩欢宸叉淳鍙?);
|
|
818
800
|
},
|
|
819
801
|
},
|
|
820
802
|
tideStations: {
|
|
821
|
-
img: '/image/screenIcon
|
|
803
|
+
img: '/image/screenIcon/娼綅绔?姝e父.png', method: 'textImage',
|
|
822
804
|
visibleRange: [10, 5000], offset: [-40, -35],
|
|
823
805
|
onClick: (name, data) => {
|
|
824
806
|
document.dispatchEvent(new CustomEvent('gaea-icon-click', { detail: { category: 'tideStations', name, data } }));
|
|
825
807
|
},
|
|
826
808
|
},
|
|
827
809
|
riverStations: {
|
|
828
|
-
img: '/image/screenIcon
|
|
810
|
+
img: '/image/screenIcon/娌抽亾绔?姝e父.png', method: 'textImage',
|
|
829
811
|
visibleRange: [10, 5000], offset: [-40, -35],
|
|
830
812
|
onClick: (name, data) => {
|
|
831
813
|
this.flyToNode(data);
|
|
@@ -833,7 +815,7 @@ export class GaeaApp {
|
|
|
833
815
|
},
|
|
834
816
|
},
|
|
835
817
|
rainStations: {
|
|
836
|
-
img: '/image/screenIcon
|
|
818
|
+
img: '/image/screenIcon/闆ㄩ噺绔?缁?png', method: 'textImage',
|
|
837
819
|
visibleRange: [10, 5000], offset: [-40, -35],
|
|
838
820
|
onClick: (name, data) => {
|
|
839
821
|
this.flyToNode(data);
|
|
@@ -841,7 +823,7 @@ export class GaeaApp {
|
|
|
841
823
|
},
|
|
842
824
|
},
|
|
843
825
|
reservoirs: {
|
|
844
|
-
img: '/image/screenIcon
|
|
826
|
+
img: '/image/screenIcon/姘村簱绔?png', method: 'styled',
|
|
845
827
|
visibleRange: [10, 5000], offset: [-40, -35],
|
|
846
828
|
onClick: (name, data) => {
|
|
847
829
|
this.flyToNode(data);
|
|
@@ -849,7 +831,7 @@ export class GaeaApp {
|
|
|
849
831
|
},
|
|
850
832
|
},
|
|
851
833
|
sluice: {
|
|
852
|
-
img: '/image/screenIcon
|
|
834
|
+
img: '/image/screenIcon/闂搁棬-缁?png', method: 'textImage',
|
|
853
835
|
visibleRange: [10, 3000], offset: [-40, -35],
|
|
854
836
|
onClick: (name, data) => {
|
|
855
837
|
this.flyToNode(data);
|
|
@@ -857,21 +839,21 @@ export class GaeaApp {
|
|
|
857
839
|
},
|
|
858
840
|
},
|
|
859
841
|
secData: {
|
|
860
|
-
img: '/image/screenIcon
|
|
842
|
+
img: '/image/screenIcon/鏂潰.png', method: 'styled',
|
|
861
843
|
visibleRange: [10, 3000], offset: [-40, -35],
|
|
862
844
|
onClick: (name, data) => {
|
|
863
845
|
this._onSecDataClick(name, data);
|
|
864
846
|
},
|
|
865
847
|
},
|
|
866
848
|
uavNests: {
|
|
867
|
-
img: '/image/screenIcon
|
|
849
|
+
img: '/image/screenIcon/鏃犱汉鏈?png', method: 'imageOnly',
|
|
868
850
|
visibleRange: [10, 5000], offset: [-25, -80],
|
|
869
851
|
onClick: (name, data) => {
|
|
870
852
|
document.dispatchEvent(new CustomEvent('gaea-icon-click', { detail: { category: 'uavNests', name, data } }));
|
|
871
853
|
},
|
|
872
854
|
},
|
|
873
855
|
rescue: {
|
|
874
|
-
img: '/image/screenIcon
|
|
856
|
+
img: '/image/screenIcon/闅愭偅.png', method: 'imageOnly',
|
|
875
857
|
visibleRange: [10, 5000], offset: [-25, -80],
|
|
876
858
|
onClick: (name, data) => {
|
|
877
859
|
this.flyToNode(data);
|
|
@@ -879,7 +861,7 @@ export class GaeaApp {
|
|
|
879
861
|
},
|
|
880
862
|
},
|
|
881
863
|
materials: {
|
|
882
|
-
img: '/image/screenIcon
|
|
864
|
+
img: '/image/screenIcon/鐗╄祫浠撳簱.png', method: 'imageOnly',
|
|
883
865
|
visibleRange: [10, 5000], offset: [-25, -80],
|
|
884
866
|
onClick: (name, data) => {
|
|
885
867
|
this.flyToNode(data);
|
|
@@ -887,7 +869,7 @@ export class GaeaApp {
|
|
|
887
869
|
},
|
|
888
870
|
},
|
|
889
871
|
};
|
|
890
|
-
console.log('[GaeaApp]
|
|
872
|
+
console.log('[GaeaApp] 寮€濮嬪垱寤哄睆骞曞浘鏍?.. categories:', cats.length);
|
|
891
873
|
let count = 0;
|
|
892
874
|
for (const cat of cats) {
|
|
893
875
|
if (!cat.children?.length) continue;
|
|
@@ -912,38 +894,34 @@ export class GaeaApp {
|
|
|
912
894
|
},
|
|
913
895
|
});
|
|
914
896
|
} catch (e) {
|
|
915
|
-
console.warn(`[GaeaApp]
|
|
897
|
+
console.warn(`[GaeaApp] 鍥炬爣 ${child.text} 鍒涘缓澶辫触:`, e.message);
|
|
916
898
|
}
|
|
917
899
|
}
|
|
918
|
-
//
|
|
900
|
+
// 鏍规嵁閰嶇疆鐨?visible 鍐冲畾鍒濆鏄鹃殣锛堜笉褰卞搷鍒涘缓锛屽彧鎺у埗鍒濆鐘舵€侊級
|
|
919
901
|
if (cat.visible === false) {
|
|
920
902
|
this.setCategoryVisible(cat.key, false);
|
|
921
903
|
}
|
|
922
904
|
}
|
|
923
|
-
console.log('[GaeaApp]
|
|
924
|
-
//
|
|
925
|
-
document.dispatchEvent(new CustomEvent('gaea-icons-ready'));
|
|
905
|
+
console.log('[GaeaApp] 灞忓箷鍥炬爣鍒涘缓瀹屾垚, 鍏?', count);
|
|
906
|
+
// 閫氱煡澶栭儴鍥炬爣宸插氨缁? document.dispatchEvent(new CustomEvent('gaea-icons-ready'));
|
|
926
907
|
}
|
|
927
908
|
|
|
928
|
-
// ----
|
|
909
|
+
// ---- 鍥惧眰鍒嗙被鏄鹃殣鎺у埗 ----
|
|
929
910
|
|
|
930
911
|
/**
|
|
931
|
-
*
|
|
932
|
-
* @param {
|
|
933
|
-
* @param {boolean} visible 是否可见
|
|
912
|
+
* 璁剧疆鏌愪釜鍒嗙被鍥炬爣鐨勫彲瑙佹€? * @param {string} categoryKey 鍒嗙被 key锛堝 'seawall', 'hydrometricStations' 绛夛級
|
|
913
|
+
* @param {boolean} visible 鏄惁鍙
|
|
934
914
|
*/
|
|
935
915
|
setCategoryVisible(categoryKey, visible) {
|
|
936
|
-
//
|
|
937
|
-
if (visible) {
|
|
916
|
+
// 璁板綍鍒嗙被鏄鹃殣鐘舵€? if (visible) {
|
|
938
917
|
this._hiddenCategories.delete(categoryKey)
|
|
939
918
|
} else {
|
|
940
919
|
this._hiddenCategories.add(categoryKey)
|
|
941
920
|
}
|
|
942
921
|
const els = document.querySelectorAll('.gaea-cat-' + categoryKey);
|
|
943
|
-
console.log('[GaeaApp] setCategoryVisible:', categoryKey, visible, '
|
|
922
|
+
console.log('[GaeaApp] setCategoryVisible:', categoryKey, visible, '鍏冪礌鏁?', els.length);
|
|
944
923
|
els.forEach(el => { el.style.display = visible && this._markersVisible ? '' : 'none'; });
|
|
945
|
-
//
|
|
946
|
-
const items = this._screenIconList.filter(item => item.category === categoryKey);
|
|
924
|
+
// 鍚屾寮曟搸鍙鎬? const items = this._screenIconList.filter(item => item.category === categoryKey);
|
|
947
925
|
items.forEach(item => {
|
|
948
926
|
if (visible && this._markersVisible) {
|
|
949
927
|
item.element.UseAutoVisible();
|
|
@@ -956,8 +934,7 @@ export class GaeaApp {
|
|
|
956
934
|
}
|
|
957
935
|
|
|
958
936
|
/**
|
|
959
|
-
*
|
|
960
|
-
* @param {string} categoryKey
|
|
937
|
+
* 鑾峰彇鏌愪釜鍒嗙被鐨勫綋鍓嶅彲瑙佹€э紙鏍规嵁 DOM 鍏冪礌鍒ゆ柇锛? * @param {string} categoryKey
|
|
961
938
|
* @returns {boolean}
|
|
962
939
|
*/
|
|
963
940
|
getCategoryVisible(categoryKey) {
|
|
@@ -965,13 +942,13 @@ export class GaeaApp {
|
|
|
965
942
|
return el ? el.style.display !== 'none' : true;
|
|
966
943
|
}
|
|
967
944
|
|
|
968
|
-
// ----
|
|
945
|
+
// ---- 鍏紑鏂规硶 ----
|
|
969
946
|
|
|
970
|
-
/**
|
|
947
|
+
/** 鍒濆鍖栭粯璁ゅ浘灞傚拰鐩告満瑙嗚锛堟墜鍔ㄨ皟鐢紝鍙紶鍙傝鐩栭厤缃級 */
|
|
971
948
|
async initDefaultLayers({ layers, cameraPosition } = {}) {
|
|
972
949
|
const cfg = this.config;
|
|
973
950
|
await this.getAllServe();
|
|
974
|
-
console.log('WMTS
|
|
951
|
+
console.log('WMTS 鍥惧眰鏁伴噺:', this.layers.length);
|
|
975
952
|
this.layers.slice(0, 10).forEach(l => console.log(' -', l.Title));
|
|
976
953
|
|
|
977
954
|
const pos = cameraPosition ?? cfg.defaultCameraPosition;
|
|
@@ -994,7 +971,7 @@ export class GaeaApp {
|
|
|
994
971
|
const layers = Gaea.WMTSImageStore.ParserXml2Capabilities(hostUrl, xml);
|
|
995
972
|
this.layers = [...this.layers, ...(layers || [])];
|
|
996
973
|
} catch (e) {
|
|
997
|
-
console.warn('getAllServe
|
|
974
|
+
console.warn('getAllServe 澶辫触:', e.message);
|
|
998
975
|
}
|
|
999
976
|
return this.layers;
|
|
1000
977
|
}
|
|
@@ -1002,12 +979,12 @@ export class GaeaApp {
|
|
|
1002
979
|
addLayer({ layerName, max, min, transparency, forMat = 'image/vnd.jpeg-png', inserIndex = null } = {}) {
|
|
1003
980
|
const mime = ['image/jpeg','image/png','image/tga','image/webp','image/bmp','application/json;type=geojson','image/vnd.jpeg-png'];
|
|
1004
981
|
const mimeIdx = mime.indexOf(forMat);
|
|
1005
|
-
if (mimeIdx === -1) return console.warn('
|
|
982
|
+
if (mimeIdx === -1) return console.warn('鏈煡鍥惧眰绫诲瀷:', forMat);
|
|
1006
983
|
|
|
1007
|
-
if (!this.layers?.length) return console.warn('
|
|
984
|
+
if (!this.layers?.length) return console.warn('鍥惧眰鍒楄〃涓虹┖锛岃鍏堣皟鐢?getAllServe()');
|
|
1008
985
|
|
|
1009
986
|
const capability = this.layers.find(i => i.Title === layerName);
|
|
1010
|
-
if (!capability) return console.warn(
|
|
987
|
+
if (!capability) return console.warn(`鍥惧眰 "${layerName}" 鏈壘鍒癭);
|
|
1011
988
|
|
|
1012
989
|
const store = new Gaea.WMTSImageStore();
|
|
1013
990
|
store.ImageExtension = mimeIdx;
|
|
@@ -1016,24 +993,24 @@ export class GaeaApp {
|
|
|
1016
993
|
if (max !== undefined) store.LevelRange = new Gaea.Vector2(min, max);
|
|
1017
994
|
if (transparency !== undefined) store.ImageTransparency = transparency;
|
|
1018
995
|
|
|
1019
|
-
if (!store.CurrentCapabilitie.InstanceID) return console.error(`${layerName}
|
|
996
|
+
if (!store.CurrentCapabilitie.InstanceID) return console.error(`${layerName} 鍔犺浇寮傚父`);
|
|
1020
997
|
|
|
1021
998
|
const tileset = Gaea.World.Instance.DefaultPyramidTileSet;
|
|
1022
999
|
inserIndex !== null ? tileset.InsertImageStore(store, inserIndex) : tileset.AddImageStore(store);
|
|
1023
|
-
console.log(
|
|
1000
|
+
console.log(`褰卞儚 "${layerName}" 娣诲姞鎴愬姛`);
|
|
1024
1001
|
return store;
|
|
1025
1002
|
}
|
|
1026
1003
|
|
|
1027
|
-
// ----
|
|
1004
|
+
// ---- 鍦板舰鏈嶅姟 ----
|
|
1028
1005
|
|
|
1029
|
-
/**
|
|
1006
|
+
/** 鍔犺浇鍗曚釜鍦板舰鏈嶅姟 */
|
|
1030
1007
|
_initTerrainServer(url) {
|
|
1031
1008
|
return new Promise((resolve) => {
|
|
1032
1009
|
Gaea.World.Instance.InitTerrainServer2(url, () => resolve());
|
|
1033
1010
|
});
|
|
1034
1011
|
}
|
|
1035
1012
|
|
|
1036
|
-
/**
|
|
1013
|
+
/** 鍔犺浇閰嶇疆涓殑鍦板舰鏈嶅姟锛坈fg.defaultTerrains锛寀rl 涓虹浉瀵?serveUrl 鐨勮矾寰勬垨瀹屾暣鍦板潃锛?*/
|
|
1037
1014
|
async addInitTerrainServer(terrains) {
|
|
1038
1015
|
const cfg = this.config;
|
|
1039
1016
|
const list = terrains ?? cfg.defaultTerrains;
|
|
@@ -1042,20 +1019,20 @@ export class GaeaApp {
|
|
|
1042
1019
|
const url = /^https?:\/\//.test(t.url) ? t.url : `${cfg.serveUrl}${t.url}`;
|
|
1043
1020
|
try {
|
|
1044
1021
|
await this._initTerrainServer(url);
|
|
1045
|
-
console.log(
|
|
1022
|
+
console.log(`鍦板舰 "${t.name}" 鍔犺浇鎴愬姛`);
|
|
1046
1023
|
} catch (e) {
|
|
1047
|
-
console.warn(
|
|
1024
|
+
console.warn(`鍦板舰 "${t.name}" 鍔犺浇澶辫触:`, e?.message);
|
|
1048
1025
|
}
|
|
1049
1026
|
}
|
|
1050
1027
|
}
|
|
1051
1028
|
|
|
1052
|
-
// ----
|
|
1029
|
+
// ---- 璐村湴绾匡紙鐭㈤噺绾挎湇鍔★級 ----
|
|
1053
1030
|
|
|
1054
|
-
/**
|
|
1031
|
+
/** 浠?WMTS 鏈嶅姟鍒楄〃鍒涘缓鐭㈤噺瑕佺礌鏈嶅姟 */
|
|
1055
1032
|
CreateFeature(serviceName, levelRange, render, alias) {
|
|
1056
|
-
if (!this.layers?.length) return console.warn('
|
|
1033
|
+
if (!this.layers?.length) return console.warn('鐭㈤噺鏈嶅姟鍒楄〃涓虹┖锛岃鍏堣皟鐢?getAllServe()');
|
|
1057
1034
|
const cap = this.layers.find(i => i.Title === serviceName);
|
|
1058
|
-
if (!cap) return console.warn(
|
|
1035
|
+
if (!cap) return console.warn(`鐭㈤噺鏈嶅姟 "${serviceName}" 鏈壘鍒癭);
|
|
1059
1036
|
const store = new Gaea.WMTSVectorStore();
|
|
1060
1037
|
store.Name = alias == null ? serviceName : alias;
|
|
1061
1038
|
store.Init(cap);
|
|
@@ -1066,7 +1043,7 @@ export class GaeaApp {
|
|
|
1066
1043
|
return store;
|
|
1067
1044
|
}
|
|
1068
1045
|
|
|
1069
|
-
/**
|
|
1046
|
+
/** 娣诲姞鍗曟潯璐村湴绾?*/
|
|
1070
1047
|
AddVTSLine({ name, range, color, index }) {
|
|
1071
1048
|
const symbol = new Gaea.GroundPolylineSymbol();
|
|
1072
1049
|
symbol.Width = 2;
|
|
@@ -1078,40 +1055,37 @@ export class GaeaApp {
|
|
|
1078
1055
|
return render;
|
|
1079
1056
|
}
|
|
1080
1057
|
|
|
1081
|
-
/**
|
|
1058
|
+
/** 鍔犺浇閰嶇疆涓殑璐村湴绾匡紙cfg.defaultGroundLines锛屼緷璧?getAllServe 鐨勬湇鍔″垪琛級 */
|
|
1082
1059
|
addGroundLines(groundLines) {
|
|
1083
1060
|
const cfg = this.config;
|
|
1084
1061
|
const list = groundLines ?? cfg.defaultGroundLines;
|
|
1085
1062
|
if (!list?.length) return;
|
|
1086
|
-
if (!this.layers?.length) return console.warn('
|
|
1063
|
+
if (!this.layers?.length) return console.warn('璐村湴绾块渶瑕佸厛鍔犺浇 WMTS 鏈嶅姟鍒楄〃(getAllServe)');
|
|
1087
1064
|
for (const item of list) {
|
|
1088
1065
|
if (item.isInitLoad === false) continue;
|
|
1089
1066
|
try {
|
|
1090
1067
|
this.AddVTSLine(item);
|
|
1091
|
-
console.log(
|
|
1068
|
+
console.log(`璐村湴绾?"${item.name}" 鍔犺浇鎴愬姛`);
|
|
1092
1069
|
} catch (e) {
|
|
1093
|
-
console.warn(
|
|
1070
|
+
console.warn(`璐村湴绾?"${item.name}" 鍔犺浇澶辫触:`, e?.message);
|
|
1094
1071
|
}
|
|
1095
1072
|
}
|
|
1096
1073
|
}
|
|
1097
1074
|
|
|
1098
|
-
// ----
|
|
1075
|
+
// ---- 璐村湴闈紙鐭㈤噺闈㈢粯鍒讹級 ----
|
|
1099
1076
|
|
|
1100
1077
|
/**
|
|
1101
|
-
*
|
|
1102
|
-
* @param {
|
|
1103
|
-
* @
|
|
1104
|
-
* @param {string} colorHex - 颜色 hex 值,如 '#3498db'
|
|
1105
|
-
* @returns {object|null} 创建的 PolygonGeometryElement,失败返回 null
|
|
1078
|
+
* 鏍规嵁鍧愭爣鏁扮粍娣诲姞璐村湴闈? * @param {Array} coords - 鍧愭爣鏁扮粍锛屾牸寮?[[lng, lat], [lng, lat], ...]
|
|
1079
|
+
* @param {string} name - 闈㈠悕绉? * @param {string} colorHex - 棰滆壊 hex 鍊硷紝濡?'#3498db'
|
|
1080
|
+
* @returns {object|null} 鍒涘缓鐨?PolygonGeometryElement锛屽け璐ヨ繑鍥?null
|
|
1106
1081
|
*/
|
|
1107
1082
|
addGroundPolygonByCoords(coords, name, colorHex) {
|
|
1108
1083
|
if (!coords || coords.length < 3) {
|
|
1109
|
-
console.warn(
|
|
1084
|
+
console.warn(`鍧愭爣鐐逛笉瓒筹紝璺宠繃: ${name}`);
|
|
1110
1085
|
return null;
|
|
1111
1086
|
}
|
|
1112
|
-
//
|
|
1113
|
-
|
|
1114
|
-
console.warn(`贴地面 "${name}" 已存在,跳过`);
|
|
1087
|
+
// 妫€鏌ユ槸鍚﹀凡瀛樺湪鍚屽悕闈? if (this._groundPolygonElements.find(p => p.name === name)) {
|
|
1088
|
+
console.warn(`璐村湴闈?"${name}" 宸插瓨鍦紝璺宠繃`);
|
|
1115
1089
|
return null;
|
|
1116
1090
|
}
|
|
1117
1091
|
|
|
@@ -1147,36 +1121,36 @@ export class GaeaApp {
|
|
|
1147
1121
|
return polygonElement;
|
|
1148
1122
|
}
|
|
1149
1123
|
|
|
1150
|
-
/**
|
|
1124
|
+
/** 绉婚櫎鎸囧畾璐村湴闈?*/
|
|
1151
1125
|
removeGroundPolygon(element) {
|
|
1152
1126
|
try {
|
|
1153
1127
|
Gaea.World.Instance.RenderableObjectList.Remove(element);
|
|
1154
1128
|
} catch (err) {
|
|
1155
|
-
console.error('
|
|
1129
|
+
console.error('绉婚櫎璐村湴闈㈠け璐?', err);
|
|
1156
1130
|
}
|
|
1157
1131
|
const idx = this._groundPolygonElements.findIndex(p => p.element === element);
|
|
1158
1132
|
if (idx >= 0) this._groundPolygonElements.splice(idx, 1);
|
|
1159
1133
|
}
|
|
1160
1134
|
|
|
1161
|
-
/**
|
|
1135
|
+
/** 娓呴櫎鎵€鏈夎创鍦伴潰 */
|
|
1162
1136
|
clearAllGroundPolygons() {
|
|
1163
1137
|
this._groundPolygonElements.forEach(item => {
|
|
1164
1138
|
try {
|
|
1165
1139
|
Gaea.World.Instance.RenderableObjectList.Remove(item.element);
|
|
1166
1140
|
} catch (err) {
|
|
1167
|
-
console.error('
|
|
1141
|
+
console.error('绉婚櫎璐村湴闈㈠け璐?', err);
|
|
1168
1142
|
}
|
|
1169
1143
|
});
|
|
1170
1144
|
this._groundPolygonElements = [];
|
|
1171
1145
|
}
|
|
1172
1146
|
|
|
1173
|
-
/**
|
|
1147
|
+
/** 瀹氫綅鍒版寚瀹氳瑙掞紙缁忕含搴﹂珮绋?+ 鐩告満鍙傛暟锛?*/
|
|
1174
1148
|
SetPosition(numStr) {
|
|
1175
1149
|
const arr = numStr.split(',').map(s => Number(s.trim()));
|
|
1176
1150
|
Gaea.World.Instance.DefaultCamera.SetPosition2(arr[0], arr[1], arr[2], arr[3], arr[4], arr[5]);
|
|
1177
1151
|
}
|
|
1178
1152
|
|
|
1179
|
-
/**
|
|
1153
|
+
/** 椋炲埌鍥惧眰鏍戣妭鐐逛綅缃?*/
|
|
1180
1154
|
flyToNode(node) {
|
|
1181
1155
|
if (!node?.position) return;
|
|
1182
1156
|
const { x, y, z } = node.position;
|
|
@@ -1185,9 +1159,8 @@ export class GaeaApp {
|
|
|
1185
1159
|
}
|
|
1186
1160
|
|
|
1187
1161
|
/**
|
|
1188
|
-
*
|
|
1189
|
-
* @param {string}
|
|
1190
|
-
* @param {string} [tilesetUrl] - 可选,倾斜摄影 3D Tiles 的 tileset.json 地址
|
|
1162
|
+
* 鏍规嵁鍚嶇О鎴?id 瀹氫綅鍒版捣濉? * @param {string} name - 娴峰鍚嶇О鎴?id
|
|
1163
|
+
* @param {string} [tilesetUrl] - 鍙€夛紝鍊炬枩鎽勫奖 3D Tiles 鐨?tileset.json 鍦板潃
|
|
1191
1164
|
*/
|
|
1192
1165
|
flyToSeawall = (name, tilesetUrl) => {
|
|
1193
1166
|
const cats = this.layerCategories || []
|
|
@@ -1202,12 +1175,12 @@ export class GaeaApp {
|
|
|
1202
1175
|
return
|
|
1203
1176
|
}
|
|
1204
1177
|
}
|
|
1205
|
-
console.warn(`[GaeaApp]
|
|
1178
|
+
console.warn(`[GaeaApp] 鏈壘鍒版捣濉? ${name}`)
|
|
1206
1179
|
};
|
|
1207
1180
|
|
|
1208
1181
|
/**
|
|
1209
|
-
*
|
|
1210
|
-
* @param {Object} item - { jsonUrl: tileset.json
|
|
1182
|
+
* 鍔犺浇鍊炬枩鎽勫奖 3D Tiles
|
|
1183
|
+
* @param {Object} item - { jsonUrl: tileset.json鍦板潃, tilName?: 鍚嶇О, height?: 楂樺害鍋忕Щ, isInitLoad?: 鏄惁鍒濆鍖栧姞杞?}
|
|
1211
1184
|
*/
|
|
1212
1185
|
add3DTiles = (item) => {
|
|
1213
1186
|
const tilesetUrl = typeof item === 'string' ? item : item.jsonUrl
|
|
@@ -1234,45 +1207,43 @@ export class GaeaApp {
|
|
|
1234
1207
|
if (name) {
|
|
1235
1208
|
this._tilesetMap[name] = tileset
|
|
1236
1209
|
}
|
|
1237
|
-
console.log('[GaeaApp] 3D Tiles
|
|
1210
|
+
console.log('[GaeaApp] 3D Tiles 宸插姞杞?', name || tilesetUrl, height ? `楂樺害: ${height}` : '', enabledClip ? '(瑁佸壀宸插惎鐢?' : '')
|
|
1238
1211
|
return tileset
|
|
1239
1212
|
};
|
|
1240
1213
|
|
|
1241
|
-
// ----
|
|
1214
|
+
// ---- 鍊炬枩鎸栨柟 ----
|
|
1242
1215
|
|
|
1243
1216
|
/**
|
|
1244
|
-
*
|
|
1245
|
-
* @param {
|
|
1246
|
-
* @param {
|
|
1247
|
-
* @
|
|
1248
|
-
* @returns {boolean} 是否成功
|
|
1217
|
+
* 鏍规嵁澶氳竟褰㈠潗鏍囪鍓湴褰紙鍊炬枩鎸栨柟锛? * @param {Array<{x: number, y: number, z: number}>} pointList - 澶氳竟褰㈤《鐐瑰潗鏍囨暟缁?[{x: 绾害, y: 缁忓害, z: 楂樼▼}, ...]
|
|
1218
|
+
* @param {number} height - 瑁佸壀娣卞害/楂樺害
|
|
1219
|
+
* @param {Function} [callback] - 瀹屾垚鍚庣殑鍥炶皟鍑芥暟锛屾帴鏀?_Holeitem
|
|
1220
|
+
* @returns {boolean} 鏄惁鎴愬姛
|
|
1249
1221
|
* @example
|
|
1250
1222
|
* app.editTerrainTool([
|
|
1251
1223
|
* { x: 27.2205, y: 120.456, z: 10 },
|
|
1252
1224
|
* { x: 27.2210, y: 120.458, z: 10 },
|
|
1253
1225
|
* { x: 27.2195, y: 120.458, z: 10 }
|
|
1254
|
-
* ], 50, (item) => { console.log('
|
|
1226
|
+
* ], 50, (item) => { console.log('鎸栨柟瀹屾垚', item) })
|
|
1255
1227
|
*/
|
|
1256
1228
|
editTerrainTool = (pointList, height, callback) => {
|
|
1257
1229
|
if (!pointList || pointList.length === 0) {
|
|
1258
|
-
console.warn('[GaeaApp] editTerrainTool: pointList
|
|
1230
|
+
console.warn('[GaeaApp] editTerrainTool: pointList 涓嶈兘涓虹┖')
|
|
1259
1231
|
return false
|
|
1260
1232
|
}
|
|
1261
1233
|
|
|
1262
1234
|
const Position = pointList.map(point => new Gaea.Vector3(point.x, point.y, point.z))
|
|
1263
1235
|
|
|
1264
|
-
//
|
|
1265
|
-
const originPoint = pointList.map(p => Gaea.GaeaMath.SphericalToCartesianDeg(new Gaea.Vector3(p.x, p.y, p.z)))
|
|
1236
|
+
// 缁忕含搴?鈫?绗涘崱灏斿潗鏍? const originPoint = pointList.map(p => Gaea.GaeaMath.SphericalToCartesianDeg(new Gaea.Vector3(p.x, p.y, p.z)))
|
|
1266
1237
|
|
|
1267
|
-
//
|
|
1238
|
+
// 鍚敤 QueryServer
|
|
1268
1239
|
Gaea.QueryServer.Instance.Enable = true
|
|
1269
1240
|
|
|
1270
|
-
//
|
|
1241
|
+
// 娓呮棫鎸栨柟
|
|
1271
1242
|
if (this._holeItem) {
|
|
1272
1243
|
Gaea.ExcavationManager.Instance.RemoveItem(this._holeItem)
|
|
1273
1244
|
}
|
|
1274
1245
|
|
|
1275
|
-
//
|
|
1246
|
+
// 鍒涘缓鎸栨柟瀵硅薄 (鍧愭爣鐐? 鎻掑€艰窛绂? 娣卞害, UV缂╂斁, 鏄惁娉曠嚎鏉愯川, 鏄惁闇€瑕乪dge)
|
|
1276
1247
|
this._holeItem = Gaea.ExcavationManager.Instance.CreateItem(originPoint, 100, height, 100, true, true)
|
|
1277
1248
|
Gaea.ExcavationManager.Instance.ExposureLength = 0
|
|
1278
1249
|
Gaea.ExcavationManager.Instance.AddItem(this._holeItem)
|
|
@@ -1285,7 +1256,7 @@ export class GaeaApp {
|
|
|
1285
1256
|
Gaea.QueryServer.Instance.ClipBox = box
|
|
1286
1257
|
}
|
|
1287
1258
|
|
|
1288
|
-
console.log('[GaeaApp]
|
|
1259
|
+
console.log('[GaeaApp] 鎸栨柟宸叉墽琛?', `娣卞害: ${height}`, `椤剁偣鏁? ${pointList.length}`)
|
|
1289
1260
|
|
|
1290
1261
|
setTimeout(() => {
|
|
1291
1262
|
if (typeof callback === 'function') {
|
|
@@ -1295,7 +1266,7 @@ export class GaeaApp {
|
|
|
1295
1266
|
};
|
|
1296
1267
|
|
|
1297
1268
|
/**
|
|
1298
|
-
*
|
|
1269
|
+
* 杩樺師鍦板舰锛堟竻闄ゆ墍鏈夋寲鏂规晥鏋滐級
|
|
1299
1270
|
*/
|
|
1300
1271
|
restoreTerrain = () => {
|
|
1301
1272
|
if (this._holeItem) {
|
|
@@ -1308,27 +1279,26 @@ export class GaeaApp {
|
|
|
1308
1279
|
Gaea.QueryServer.Instance.ClipBox.QueueFree()
|
|
1309
1280
|
Gaea.QueryServer.Instance.ClipBox = null
|
|
1310
1281
|
}
|
|
1311
|
-
console.log('[GaeaApp]
|
|
1282
|
+
console.log('[GaeaApp] 鍦板舰宸茶繕鍘?)
|
|
1312
1283
|
};
|
|
1313
1284
|
|
|
1314
1285
|
/**
|
|
1315
|
-
*
|
|
1316
|
-
* @example
|
|
1286
|
+
* 鐩戝惉鐢诲竷榧犳爣鐐瑰嚮锛岃幏鍙栫偣鍑讳綅缃殑缁忕含搴﹀潗鏍? * @example
|
|
1317
1287
|
* app.addMouseClick((pos) => {
|
|
1318
|
-
* console.log('
|
|
1288
|
+
* console.log('鐐瑰嚮浣嶇疆:', pos) // { x: 绾害, y: 缁忓害, z: 楂樼▼ }
|
|
1319
1289
|
* })
|
|
1320
1290
|
*/
|
|
1321
1291
|
addMouseClick = (callback) => {
|
|
1322
1292
|
const canvas = document.getElementById('canvas')
|
|
1323
1293
|
if (!canvas) {
|
|
1324
|
-
console.warn('[GaeaApp] addMouseClick: canvas
|
|
1294
|
+
console.warn('[GaeaApp] addMouseClick: canvas 鍏冪礌鏈壘鍒?)
|
|
1325
1295
|
return
|
|
1326
1296
|
}
|
|
1327
1297
|
canvas.addEventListener('mousedown', (event) => {
|
|
1328
1298
|
const result = Gaea.GaeaMath.ProjectPosition(new Gaea.Vector2(event.offsetX, event.offsetY))
|
|
1329
1299
|
const lonlat = Gaea.GaeaMath.CartesianToSphericalDeg(result)
|
|
1330
1300
|
const pos = { x: lonlat.x, y: lonlat.y, z: lonlat.z }
|
|
1331
|
-
console.log('[GaeaApp]
|
|
1301
|
+
console.log('[GaeaApp] 鐐瑰嚮浣嶇疆:', pos)
|
|
1332
1302
|
if (typeof callback === 'function') {
|
|
1333
1303
|
callback(pos)
|
|
1334
1304
|
}
|
|
@@ -1336,17 +1306,17 @@ export class GaeaApp {
|
|
|
1336
1306
|
};
|
|
1337
1307
|
|
|
1338
1308
|
/**
|
|
1339
|
-
*
|
|
1340
|
-
* @param {string} name -
|
|
1341
|
-
* @returns {object} GLTFElement
|
|
1309
|
+
* 鑾峰彇宸插姞杞界殑妯″瀷鍏冪礌
|
|
1310
|
+
* @param {string} name - 妯″瀷鍚嶇О
|
|
1311
|
+
* @returns {object} GLTFElement 鎴?null
|
|
1342
1312
|
*/
|
|
1343
1313
|
getModel = (name) => {
|
|
1344
1314
|
return this._gltfElements[name] || null
|
|
1345
1315
|
};
|
|
1346
1316
|
|
|
1347
1317
|
/**
|
|
1348
|
-
*
|
|
1349
|
-
* @param {string} name -
|
|
1318
|
+
* 鑾峰彇妯″瀷褰撳墠鐘舵€侊紙浣嶇疆銆佹棆杞€佺缉鏀撅級
|
|
1319
|
+
* @param {string} name - 妯″瀷鍚嶇О
|
|
1350
1320
|
* @returns {object|null} { position, rotate, scale, visible }
|
|
1351
1321
|
*/
|
|
1352
1322
|
getModelInfo = (name) => {
|
|
@@ -1361,72 +1331,68 @@ export class GaeaApp {
|
|
|
1361
1331
|
};
|
|
1362
1332
|
|
|
1363
1333
|
/**
|
|
1364
|
-
*
|
|
1365
|
-
* @param {
|
|
1366
|
-
* @param {object} position - { x: 纬度, y: 经度, z: 高程 }
|
|
1334
|
+
* 璁剧疆妯″瀷浣嶇疆锛堢粡绾害 + 楂樼▼锛? * @param {string} name - 妯″瀷鍚嶇О
|
|
1335
|
+
* @param {object} position - { x: 绾害, y: 缁忓害, z: 楂樼▼ }
|
|
1367
1336
|
*/
|
|
1368
1337
|
setModelPosition = (name, position) => {
|
|
1369
1338
|
const el = this._gltfElements[name]
|
|
1370
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1339
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1371
1340
|
el.GeographyPosition = new Gaea.Vector3(position.x, position.y, position.z)
|
|
1372
1341
|
};
|
|
1373
1342
|
|
|
1374
1343
|
/**
|
|
1375
|
-
*
|
|
1376
|
-
* @param {string} name -
|
|
1344
|
+
* 璁剧疆妯″瀷鏃嬭浆
|
|
1345
|
+
* @param {string} name - 妯″瀷鍚嶇О
|
|
1377
1346
|
* @param {number[]} rotate - [pitch, yaw, roll]
|
|
1378
1347
|
*/
|
|
1379
1348
|
setModelRotation = (name, rotate) => {
|
|
1380
1349
|
const el = this._gltfElements[name]
|
|
1381
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1350
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1382
1351
|
el.TiltHeadingBank = new Gaea.Vector3(rotate[0], rotate[1], rotate[2])
|
|
1383
1352
|
};
|
|
1384
1353
|
|
|
1385
1354
|
/**
|
|
1386
|
-
*
|
|
1387
|
-
* @param {string} name -
|
|
1355
|
+
* 璁剧疆妯″瀷缂╂斁
|
|
1356
|
+
* @param {string} name - 妯″瀷鍚嶇О
|
|
1388
1357
|
* @param {number[]} size - [sx, sy, sz]
|
|
1389
1358
|
*/
|
|
1390
1359
|
setModelScale = (name, size) => {
|
|
1391
1360
|
const el = this._gltfElements[name]
|
|
1392
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1361
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1393
1362
|
el.Root.Scale = new Gaea.Vector3(size[0], size[1], size[2])
|
|
1394
1363
|
};
|
|
1395
1364
|
|
|
1396
1365
|
/**
|
|
1397
|
-
*
|
|
1398
|
-
* @param {string} name - 模型名称
|
|
1366
|
+
* 璁剧疆妯″瀷鍙鎬? * @param {string} name - 妯″瀷鍚嶇О
|
|
1399
1367
|
* @param {boolean} visible
|
|
1400
1368
|
*/
|
|
1401
1369
|
setModelVisible = (name, visible) => {
|
|
1402
1370
|
const el = this._gltfElements[name]
|
|
1403
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1371
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1404
1372
|
el.Root.Visible = visible
|
|
1405
1373
|
};
|
|
1406
1374
|
|
|
1407
1375
|
/**
|
|
1408
|
-
*
|
|
1409
|
-
* @param {string} name - 模型名称
|
|
1376
|
+
* 绉婚櫎妯″瀷锛堝弬鑰?ht_3dview removeGltf锛? * @param {string} name - 妯″瀷鍚嶇О
|
|
1410
1377
|
*/
|
|
1411
1378
|
removeGltf = (name) => {
|
|
1412
1379
|
const el = this._gltfElements[name]
|
|
1413
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1380
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1414
1381
|
Gaea.World.Instance.RenderableObjectList.Remove(el)
|
|
1415
1382
|
delete this._gltfElements[name]
|
|
1416
1383
|
delete this._gltfCfgMap[name]
|
|
1417
1384
|
};
|
|
1418
1385
|
|
|
1419
1386
|
/**
|
|
1420
|
-
*
|
|
1421
|
-
* @param {
|
|
1422
|
-
* @param {
|
|
1423
|
-
* @param {object} options.position - { x: 纬度, y: 经度, z: 高程 }
|
|
1387
|
+
* 淇敼妯″瀷閰嶇疆锛堜綅缃?鏃嬭浆/缂╂斁涓€璧疯缃紝鍙傝€?ht_3dview updateElementPosition锛? * @param {object} options
|
|
1388
|
+
* @param {string} options.name - 妯″瀷鍚嶇О
|
|
1389
|
+
* @param {object} options.position - { x: 绾害, y: 缁忓害, z: 楂樼▼ }
|
|
1424
1390
|
* @param {number[]} [options.rotate] - [pitch, yaw, roll]
|
|
1425
1391
|
* @param {number[]} [options.size] - [sx, sy, sz]
|
|
1426
1392
|
*/
|
|
1427
1393
|
updateElementPosition = ({ name, position, rotate, size }) => {
|
|
1428
1394
|
const el = this._gltfElements[name]
|
|
1429
|
-
if (!el) { console.warn(`[GaeaApp]
|
|
1395
|
+
if (!el) { console.warn(`[GaeaApp] 妯″瀷 "${name}" 鏈壘鍒癭); return }
|
|
1430
1396
|
if (position) {
|
|
1431
1397
|
el.GeographyPosition = new Gaea.Vector3(position.x, position.y, position.z)
|
|
1432
1398
|
}
|
|
@@ -1439,11 +1405,8 @@ export class GaeaApp {
|
|
|
1439
1405
|
};
|
|
1440
1406
|
|
|
1441
1407
|
/**
|
|
1442
|
-
*
|
|
1443
|
-
*
|
|
1444
|
-
* @param {function} cb - (pos: {x,y,z}) => void
|
|
1445
|
-
* @returns {function} 调用可取消监听
|
|
1446
|
-
*/
|
|
1408
|
+
* 娣诲姞榧犳爣绉诲姩鐩戝惉锛堝弬鑰?ht_3dview addMouseMove锛屼娇鐢?Gaea 寮曟搸浜嬩欢锛? * 鍥炶皟杩斿洖褰撳墠榧犳爣鎵€鍦ㄤ綅缃殑缁忕含搴﹀潗鏍? * @param {function} cb - (pos: {x,y,z}) => void
|
|
1409
|
+
* @returns {function} 璋冪敤鍙彇娑堢洃鍚? */
|
|
1447
1410
|
addMouseMove = (cb = null) => {
|
|
1448
1411
|
const handle = Gaea.World.Instance.OnMouseMove((p, b) => {
|
|
1449
1412
|
const screenpos = new Gaea.Vector2(p.x, p.y)
|
|
@@ -1460,7 +1423,7 @@ export class GaeaApp {
|
|
|
1460
1423
|
};
|
|
1461
1424
|
|
|
1462
1425
|
/**
|
|
1463
|
-
*
|
|
1426
|
+
* 绉婚櫎榧犳爣绉诲姩鐩戝惉
|
|
1464
1427
|
*/
|
|
1465
1428
|
removeMouseMove = () => {
|
|
1466
1429
|
if (this._mouseMoveHandle) {
|
|
@@ -1470,15 +1433,12 @@ export class GaeaApp {
|
|
|
1470
1433
|
};
|
|
1471
1434
|
|
|
1472
1435
|
/**
|
|
1473
|
-
*
|
|
1474
|
-
* 回调返回点击位置的经纬度坐标
|
|
1436
|
+
* 娣诲姞榧犳爣鎶捣鐩戝惉锛堝弬鑰?ht_3dview锛屼娇鐢?Gaea 寮曟搸 OnMouseUp 浜嬩欢锛? * 鍥炶皟杩斿洖鐐瑰嚮浣嶇疆鐨勭粡绾害鍧愭爣
|
|
1475
1437
|
* @param {function} cb - (pos: {x,y,z}) => void
|
|
1476
|
-
* @returns {function}
|
|
1477
|
-
*/
|
|
1438
|
+
* @returns {function} 璋冪敤鍙彇娑堢洃鍚? */
|
|
1478
1439
|
addMouseUp = (cb = null) => {
|
|
1479
1440
|
const handle = Gaea.World.Instance.OnMouseUp((p, b) => {
|
|
1480
|
-
if (b !== 1) return //
|
|
1481
|
-
const screenpos = new Gaea.Vector2(p.x, p.y)
|
|
1441
|
+
if (b !== 1) return // 浠呭乏閿? const screenpos = new Gaea.Vector2(p.x, p.y)
|
|
1482
1442
|
const spacepos = Gaea.GaeaMath.ProjectPosition(screenpos)
|
|
1483
1443
|
const latlonalt = Gaea.GaeaMath.CartesianToSphericalDeg(spacepos)
|
|
1484
1444
|
const pos = { x: latlonalt.x, y: latlonalt.y, z: latlonalt.z }
|
|
@@ -1492,7 +1452,7 @@ export class GaeaApp {
|
|
|
1492
1452
|
};
|
|
1493
1453
|
|
|
1494
1454
|
/**
|
|
1495
|
-
*
|
|
1455
|
+
* 绉婚櫎榧犳爣鎶捣鐩戝惉
|
|
1496
1456
|
*/
|
|
1497
1457
|
removeMouseUp = () => {
|
|
1498
1458
|
if (this._mouseUpHandle) {
|
|
@@ -1502,11 +1462,9 @@ export class GaeaApp {
|
|
|
1502
1462
|
};
|
|
1503
1463
|
|
|
1504
1464
|
/**
|
|
1505
|
-
*
|
|
1506
|
-
* 点击地图后回调返回坐标,自动取消监听
|
|
1465
|
+
* 浜や簰寮忔嬀鍙栧潗鏍囷紙鐐瑰嚮鍦板浘鑾峰彇缁忕含搴︼紝鍙傝€?ht_3dview 閫夋嫨鍧愭爣娴佺▼锛? * 鐐瑰嚮鍦板浘鍚庡洖璋冭繑鍥炲潗鏍囷紝鑷姩鍙栨秷鐩戝惉
|
|
1507
1466
|
* @param {function} cb - (pos: {x,y,z}) => void
|
|
1508
|
-
* @returns {function}
|
|
1509
|
-
*/
|
|
1467
|
+
* @returns {function} 璋冪敤鍙彇娑堟嬀鍙? */
|
|
1510
1468
|
pickPosition = (cb) => {
|
|
1511
1469
|
const cancel = this.addMouseUp((pos) => {
|
|
1512
1470
|
cancel()
|
|
@@ -1516,10 +1474,9 @@ export class GaeaApp {
|
|
|
1516
1474
|
};
|
|
1517
1475
|
|
|
1518
1476
|
/**
|
|
1519
|
-
*
|
|
1477
|
+
* 浜や簰寮忔嬀鍙栨ā鍨嬶紝杩斿洖妯″瀷淇℃伅
|
|
1520
1478
|
* @param {function} callback - (modelInfo) => void
|
|
1521
|
-
* @returns {function}
|
|
1522
|
-
*/
|
|
1479
|
+
* @returns {function} 璋冪敤鍙彇娑堟嬀鍙? */
|
|
1523
1480
|
pickModel = (callback) => {
|
|
1524
1481
|
const canvas = document.getElementById('canvas')
|
|
1525
1482
|
if (!canvas) return () => {}
|
|
@@ -1541,8 +1498,7 @@ export class GaeaApp {
|
|
|
1541
1498
|
};
|
|
1542
1499
|
|
|
1543
1500
|
/**
|
|
1544
|
-
*
|
|
1545
|
-
* @returns {Array<{name: string, url: string, position?: object}>}
|
|
1501
|
+
* 鑾峰彇鎵€鏈夊彲閫夋ā鍨嬪垪琛紙鐢ㄤ簬闈㈡澘涓嬫媺閫夋嫨锛屽弬鑰?ht_3dview gaeaData.gltfList锛? * @returns {Array<{name: string, url: string, position?: object}>}
|
|
1546
1502
|
*/
|
|
1547
1503
|
getGltfList = () => {
|
|
1548
1504
|
return Object.values(this._gltfCfgMap).map(cfg => ({
|
|
@@ -1552,12 +1508,10 @@ export class GaeaApp {
|
|
|
1552
1508
|
};
|
|
1553
1509
|
|
|
1554
1510
|
/**
|
|
1555
|
-
*
|
|
1556
|
-
* 新增模型到场景并记录到配置表
|
|
1511
|
+
* 鍔犺浇鐢ㄦ埛鑷畾涔夋ā鍨嬶紙鍙傝€?ht_3dview addGltf锛? * 鏂板妯″瀷鍒板満鏅苟璁板綍鍒伴厤缃〃
|
|
1557
1512
|
* @param {object} cfg
|
|
1558
|
-
* @param {string} cfg.name -
|
|
1559
|
-
* @param {
|
|
1560
|
-
* @param {object} cfg.position - { x: 纬度, y: 经度, z: 高程 }
|
|
1513
|
+
* @param {string} cfg.name - 妯″瀷瀹炰緥鍚嶏紙涓嶈兘閲嶅锛? * @param {string} cfg.url - 妯″瀷 URL
|
|
1514
|
+
* @param {object} cfg.position - { x: 绾害, y: 缁忓害, z: 楂樼▼ }
|
|
1561
1515
|
* @param {number[]} cfg.rotate - [pitch, yaw, roll]
|
|
1562
1516
|
* @param {number[]} cfg.size - [sx, sy, sz]
|
|
1563
1517
|
* @param {boolean} [cfg.show=true]
|
|
@@ -1567,10 +1521,10 @@ export class GaeaApp {
|
|
|
1567
1521
|
addGltf = async (cfg) => {
|
|
1568
1522
|
const { name, url, position, rotate, size, show = true, enablePick = true } = cfg;
|
|
1569
1523
|
if (!name || !url || !position || !rotate || !size) {
|
|
1570
|
-
console.warn('[GaeaApp] addGltf:
|
|
1524
|
+
console.warn('[GaeaApp] addGltf: 缂哄皯蹇呰鍙傛暟', cfg);
|
|
1571
1525
|
return null;
|
|
1572
1526
|
}
|
|
1573
|
-
//
|
|
1527
|
+
// 璁板綍鍒伴厤缃〃锛屼緵鍚庣画闈㈡澘缂栬緫
|
|
1574
1528
|
this._gltfCfgMap[name] = {
|
|
1575
1529
|
name, url, position: { ...position }, rotate: [...rotate], size: [...size],
|
|
1576
1530
|
show, enablePick, isUserAdd: true
|
|
@@ -1583,25 +1537,21 @@ export class GaeaApp {
|
|
|
1583
1537
|
};
|
|
1584
1538
|
|
|
1585
1539
|
/**
|
|
1586
|
-
*
|
|
1587
|
-
* @param {number}
|
|
1588
|
-
* @param {number}
|
|
1589
|
-
* @param {number} [
|
|
1590
|
-
* @param {number} [
|
|
1591
|
-
* @param {number} [
|
|
1592
|
-
* @param {number} [yaw=0] - 偏航角
|
|
1593
|
-
*/
|
|
1540
|
+
* 鏍规嵁缁忕含搴﹂鍒版寚瀹氫綅缃? * @param {number} lat - 绾害
|
|
1541
|
+
* @param {number} lng - 缁忓害
|
|
1542
|
+
* @param {number} [z=0] - 鍦伴潰楂樼▼
|
|
1543
|
+
* @param {number} [alt=500] - 鐩告満楂樺害
|
|
1544
|
+
* @param {number} [pitch=0] - 淇话瑙掞紝榛樿 0锛堝瀭鐩翠刊瑙嗭級锛岃礋鍊煎悜鍓嶅€炬枩
|
|
1545
|
+
* @param {number} [yaw=0] - 鍋忚埅瑙? */
|
|
1594
1546
|
flyToPosition = (lat, lng, z = 0, alt = 500, pitch = 0, yaw = 0) => {
|
|
1595
1547
|
this.SetPosition(`${lat},${lng},${z},${alt},${pitch},${yaw}`)
|
|
1596
1548
|
};
|
|
1597
1549
|
|
|
1598
|
-
// ----
|
|
1550
|
+
// ---- 娌跨嚎椋炶 ----
|
|
1599
1551
|
|
|
1600
1552
|
/**
|
|
1601
|
-
*
|
|
1602
|
-
* @param {
|
|
1603
|
-
* @param {Object} options - 飞行配置(height/step/duration/xrotation/lockEye/minZoom/maxZoom)
|
|
1604
|
-
* @returns {Promise} 飞行完成后 resolve
|
|
1553
|
+
* 娌跨嚎椋炶 - 鐩告満娌胯矾寰勮嚜鍔ㄩ琛? * @param {Array} lineData - 璺緞鐐规暟缁勶紝姣忎釜鐐?{x: 绾害, y: 缁忓害, z?: 楂樺害}
|
|
1554
|
+
* @param {Object} options - 椋炶閰嶇疆锛坔eight/step/duration/xrotation/lockEye/minZoom/maxZoom锛? * @returns {Promise} 椋炶瀹屾垚鍚?resolve
|
|
1605
1555
|
*/
|
|
1606
1556
|
flyAlongPath = async (lineData, options = {}) => {
|
|
1607
1557
|
const opts = {
|
|
@@ -1616,8 +1566,8 @@ export class GaeaApp {
|
|
|
1616
1566
|
};
|
|
1617
1567
|
|
|
1618
1568
|
if (!lineData || lineData.length < 2) {
|
|
1619
|
-
console.error('flyAlongPath:
|
|
1620
|
-
return Promise.reject(new Error('
|
|
1569
|
+
console.error('flyAlongPath: 鑷冲皯闇€瑕?涓矾寰勭偣');
|
|
1570
|
+
return Promise.reject(new Error('鑷冲皯闇€瑕?涓矾寰勭偣'));
|
|
1621
1571
|
}
|
|
1622
1572
|
|
|
1623
1573
|
try {
|
|
@@ -1666,29 +1616,28 @@ export class GaeaApp {
|
|
|
1666
1616
|
|
|
1667
1617
|
return new Promise((resolve) => {
|
|
1668
1618
|
this._flyAnimationPlayer.PlayWithCallback('flyPathAnimation', Gaea.CallbackType.AnimatioFinished, () => {
|
|
1669
|
-
console.log('
|
|
1619
|
+
console.log('娌跨嚎椋炶鍔ㄧ敾鎾斁瀹屾垚');
|
|
1670
1620
|
resolve();
|
|
1671
1621
|
});
|
|
1672
1622
|
});
|
|
1673
1623
|
} catch (error) {
|
|
1674
|
-
console.error('flyAlongPath
|
|
1624
|
+
console.error('flyAlongPath 鍚姩澶辫触:', error);
|
|
1675
1625
|
this._cleanupFlyResources();
|
|
1676
1626
|
return Promise.reject(error);
|
|
1677
1627
|
}
|
|
1678
1628
|
};
|
|
1679
1629
|
|
|
1680
|
-
/**
|
|
1630
|
+
/** 鍋滄娌跨嚎椋炶 */
|
|
1681
1631
|
stopFlyAlongPath = () => {
|
|
1682
1632
|
try {
|
|
1683
|
-
// Godot AnimationPlayer.Stop(reset:bool)
|
|
1684
|
-
if (this._flyAnimationPlayer) this._flyAnimationPlayer.Stop(false);
|
|
1633
|
+
// Godot AnimationPlayer.Stop(reset:bool)锛屽弬鏁版槸甯冨皵鑰岄潪鍔ㄧ敾鍚? if (this._flyAnimationPlayer) this._flyAnimationPlayer.Stop(false);
|
|
1685
1634
|
} catch (error) {
|
|
1686
|
-
console.error('
|
|
1635
|
+
console.error('鍋滄椋炶澶辫触:', error);
|
|
1687
1636
|
}
|
|
1688
1637
|
this._cleanupFlyResources();
|
|
1689
1638
|
};
|
|
1690
1639
|
|
|
1691
|
-
/**
|
|
1640
|
+
/** 娓呯悊椋炶鐩稿叧璧勬簮 */
|
|
1692
1641
|
_cleanupFlyResources = () => {
|
|
1693
1642
|
try {
|
|
1694
1643
|
if (this._flyAnimationPlayer) {
|
|
@@ -1703,11 +1652,11 @@ export class GaeaApp {
|
|
|
1703
1652
|
Gaea.World.Instance.CameraController.LockedEntity = null;
|
|
1704
1653
|
this._flyAnimation = null;
|
|
1705
1654
|
} catch (error) {
|
|
1706
|
-
console.error('
|
|
1655
|
+
console.error('娓呯悊椋炶璧勬簮澶辫触:', error);
|
|
1707
1656
|
}
|
|
1708
1657
|
};
|
|
1709
1658
|
|
|
1710
|
-
/**
|
|
1659
|
+
/** 鐩告満澶嶄綅鍒伴粯璁よ瑙?*/
|
|
1711
1660
|
cameraReset = () => {
|
|
1712
1661
|
this._cleanupFlyResources();
|
|
1713
1662
|
const pos = this.config.defaultCameraPosition;
|
|
@@ -1715,14 +1664,13 @@ export class GaeaApp {
|
|
|
1715
1664
|
};
|
|
1716
1665
|
|
|
1717
1666
|
/**
|
|
1718
|
-
*
|
|
1719
|
-
* @param {string} opts.method - 'textImage' | 'styled' | 'imageOnly'
|
|
1667
|
+
* 娣诲姞灞忓箷鍥炬爣锛堝弬鑰?ht_3dview 涓夌鍒涘缓鏂瑰紡锛? * @param {string} opts.method - 'textImage' | 'styled' | 'imageOnly'
|
|
1720
1668
|
*/
|
|
1721
1669
|
addScreenIcon({ name, text, imgUrl, position, method = 'textImage', offset = [0, 0], visibleRange = [10, 50000], anchorType = 6, drawLine = false, onClick, type = null, category = null, divId: externalDivId, elementName, elementChildrenIndex } = {}) {
|
|
1722
1670
|
const safeId = name.replace(/[^a-zA-Z0-9\u4e00-\u9fa5]/g, '_');
|
|
1723
1671
|
const divId = externalDivId || 'gaea-icon-' + safeId;
|
|
1724
1672
|
|
|
1725
|
-
//
|
|
1673
|
+
// 濡傛灉鏄閮ㄤ紶鍏ョ殑 divId锛岀洿鎺ヤ娇鐢ㄥ凡鏈夌殑 DOM 鍏冪礌
|
|
1726
1674
|
let container;
|
|
1727
1675
|
if (externalDivId) {
|
|
1728
1676
|
container = document.getElementById(externalDivId);
|
|
@@ -1772,8 +1720,7 @@ export class GaeaApp {
|
|
|
1772
1720
|
|
|
1773
1721
|
} // end else (externalDivId)
|
|
1774
1722
|
|
|
1775
|
-
//
|
|
1776
|
-
if (category) {
|
|
1723
|
+
// 鎵撳垎绫绘爣璁帮紝鐢ㄤ簬鎸夌被鍒樉闅? if (category) {
|
|
1777
1724
|
container.classList.add('gaea-cat-' + category);
|
|
1778
1725
|
}
|
|
1779
1726
|
|
|
@@ -1782,15 +1729,14 @@ export class GaeaApp {
|
|
|
1782
1729
|
}
|
|
1783
1730
|
|
|
1784
1731
|
container.style.position = 'absolute';
|
|
1785
|
-
container.style.zIndex = '
|
|
1732
|
+
container.style.zIndex = '1';
|
|
1786
1733
|
container.style.pointerEvents = 'auto';
|
|
1787
1734
|
container.style.cursor = 'pointer';
|
|
1788
1735
|
|
|
1789
|
-
//
|
|
1790
|
-
container.addEventListener('click', (e) => {
|
|
1736
|
+
// 鍦?DOM 涓婄粦鐐瑰嚮浜嬩欢锛圙aea ScreenGUIElement 鐨?OnHitElement 瀵?DOM 鍨嬪浘鏍囦笉鐢熸晥锛? container.addEventListener('click', (e) => {
|
|
1791
1737
|
e.stopPropagation();
|
|
1792
1738
|
e.preventDefault();
|
|
1793
|
-
console.log('[GaeaApp]
|
|
1739
|
+
console.log('[GaeaApp] 鍥炬爣鐐瑰嚮:', name);
|
|
1794
1740
|
if (onClick) { onClick(name, { text, position }); }
|
|
1795
1741
|
else if (position) { this.flyToNode({ position }); }
|
|
1796
1742
|
});
|
|
@@ -1815,7 +1761,7 @@ export class GaeaApp {
|
|
|
1815
1761
|
screen.EnablePick = true;
|
|
1816
1762
|
if (visibleRange.length) screen.VisibleRange = new Gaea.Vector2(visibleRange[0], visibleRange[1]);
|
|
1817
1763
|
|
|
1818
|
-
//
|
|
1764
|
+
// 濡傛灉鏈?elementName锛屽皢鍥炬爣鎸傚埌 GLTF 妯″瀷瀛愯妭鐐逛笂锛堜綅缃敱鐖惰妭鐐瑰喅瀹氾級
|
|
1819
1765
|
if (elementName && elementChildrenIndex !== undefined) {
|
|
1820
1766
|
const el = this._gltfElements?.[elementName];
|
|
1821
1767
|
console.log('[GaeaApp] addScreenIcon element:', elementName, 'el:', !!el, 'childrenIndex:', elementChildrenIndex);
|
|
@@ -1832,8 +1778,7 @@ export class GaeaApp {
|
|
|
1832
1778
|
return screen;
|
|
1833
1779
|
}
|
|
1834
1780
|
}
|
|
1835
|
-
//
|
|
1836
|
-
console.warn('[GaeaApp] elementName/childIndex 未找到,使用 position 回退:', elementName, elementChildrenIndex);
|
|
1781
|
+
// 瀛愯妭鐐规湭鎵惧埌锛屽洖閫€鍒扮粷瀵逛綅缃? console.warn('[GaeaApp] elementName/childIndex 鏈壘鍒帮紝浣跨敤 position 鍥為€€:', elementName, elementChildrenIndex);
|
|
1837
1782
|
}
|
|
1838
1783
|
|
|
1839
1784
|
screen.GeographyPosition = new Gaea.Vector3(position.x, position.y, position.z || 0);
|
|
@@ -1844,7 +1789,7 @@ export class GaeaApp {
|
|
|
1844
1789
|
return screen;
|
|
1845
1790
|
}
|
|
1846
1791
|
|
|
1847
|
-
/**
|
|
1792
|
+
/** 鏍规嵁鍏ㄥ眬鍥炬爣鍙鎬х姸鎬侊紙_markersVisible锛夊簲鐢ㄥ崟涓浘鏍囨樉闅?*/
|
|
1848
1793
|
_applyMarkerVisibility(screenItem) {
|
|
1849
1794
|
if (this._markersVisible) return;
|
|
1850
1795
|
screenItem.element.ForceSetVisible(false);
|
|
@@ -1853,30 +1798,28 @@ export class GaeaApp {
|
|
|
1853
1798
|
if (el) el.style.display = 'none';
|
|
1854
1799
|
}
|
|
1855
1800
|
|
|
1856
|
-
/**
|
|
1801
|
+
/** 璁板綍褰撳墠瑙嗚锛岃繑鍥?URI 瀛楃涓?*/
|
|
1857
1802
|
favorite() {
|
|
1858
1803
|
return Gaea.GaeaCamera.ConvertBy(Gaea.World.Instance.DefaultCamera).Favorite();
|
|
1859
1804
|
}
|
|
1860
1805
|
|
|
1861
|
-
/**
|
|
1806
|
+
/** 瀹氫綅鍒板凡璁板綍鐨勮瑙?URI */
|
|
1862
1807
|
favoritePosition(uri) {
|
|
1863
1808
|
Gaea.World.Instance.DefaultCamera.GotoFavorite(uri);
|
|
1864
1809
|
}
|
|
1865
1810
|
|
|
1866
1811
|
/**
|
|
1867
|
-
*
|
|
1812
|
+
* 娣诲姞鐐逛綅鏍囪鍒?3D 鍦板浘
|
|
1868
1813
|
* @param {Object} opts
|
|
1869
|
-
* @param {string} opts.name -
|
|
1870
|
-
* @param {
|
|
1871
|
-
* @param {number} opts.
|
|
1872
|
-
* @param {number} opts.
|
|
1873
|
-
* @param {
|
|
1874
|
-
* @param {
|
|
1875
|
-
* @param {
|
|
1876
|
-
* @param {
|
|
1877
|
-
* @param {
|
|
1878
|
-
* @param {string} [opts.category] - 分类标识(用于图层树显隐控制)
|
|
1879
|
-
* @returns {Gaea.ScreenGUIElement} screen 元素
|
|
1814
|
+
* @param {string} opts.name - 鍞竴鏍囪瘑鍚? * @param {string} [opts.text] - 鏄剧ず鏂囨湰
|
|
1815
|
+
* @param {number} opts.lat - 绾害
|
|
1816
|
+
* @param {number} opts.lng - 缁忓害
|
|
1817
|
+
* @param {number} [opts.z=0] - 楂樺害
|
|
1818
|
+
* @param {string} [opts.imgUrl] - 鍥炬爣鍦板潃
|
|
1819
|
+
* @param {'textImage'|'styled'|'imageOnly'} [opts.method='textImage'] - 鏄剧ず鏍峰紡
|
|
1820
|
+
* @param {Array<number>} [opts.offset=[0,0]] - 灞忓箷鍋忕Щ
|
|
1821
|
+
* @param {Function} [opts.onClick] - 鐐瑰嚮鍥炶皟
|
|
1822
|
+
* @param {string} [opts.category] - 鍒嗙被鏍囪瘑锛堢敤浜庡浘灞傛爲鏄鹃殣鎺у埗锛? * @returns {Gaea.ScreenGUIElement} screen 鍏冪礌
|
|
1880
1823
|
*/
|
|
1881
1824
|
addMarker({ name, text, lat, lng, z = 0, imgUrl, method = 'textImage', offset = [0, 0], onClick, category } = {}) {
|
|
1882
1825
|
return this.addScreenIcon({
|
|
@@ -1887,7 +1830,7 @@ export class GaeaApp {
|
|
|
1887
1830
|
method,
|
|
1888
1831
|
offset,
|
|
1889
1832
|
onClick: (clickedName, data) => {
|
|
1890
|
-
//
|
|
1833
|
+
// 娲惧彂鍏ㄥ眬鑷畾涔変簨浠讹紝鐖剁粍浠跺彲閫氳繃 document.addEventListener 鐩戝惉
|
|
1891
1834
|
document.dispatchEvent(new CustomEvent('gaea-marker-click', {
|
|
1892
1835
|
detail: { name: clickedName, text: data.text, position: data.position, category },
|
|
1893
1836
|
bubbles: true
|
|
@@ -1899,7 +1842,7 @@ export class GaeaApp {
|
|
|
1899
1842
|
})
|
|
1900
1843
|
}
|
|
1901
1844
|
|
|
1902
|
-
// ----
|
|
1845
|
+
// ---- 寮曟搸鍔ㄧ敾鏂规硶 ----
|
|
1903
1846
|
|
|
1904
1847
|
hiddenScreenWithClass(className) {
|
|
1905
1848
|
const els = document.querySelectorAll(className);
|
|
@@ -1940,15 +1883,15 @@ export class GaeaApp {
|
|
|
1940
1883
|
if (details.length) {
|
|
1941
1884
|
details.forEach(item => { html += `<div class="daba-tooltip-item">${item}</div>`; });
|
|
1942
1885
|
} else {
|
|
1943
|
-
html = '<div class="daba-tooltip-item"
|
|
1886
|
+
html = '<div class="daba-tooltip-item">鏆傛棤璇︽儏</div>';
|
|
1944
1887
|
}
|
|
1945
1888
|
return `<div class="daba-tooltip-title">${name} - ${label}</div>${html}`;
|
|
1946
1889
|
}
|
|
1947
1890
|
|
|
1948
|
-
/**
|
|
1891
|
+
/** 鏂潰鏁版嵁鐐瑰嚮澶勭悊 */
|
|
1949
1892
|
_onSecDataClick(name, data) {
|
|
1950
1893
|
const sectionModel = this._gltfElements?.[name];
|
|
1951
|
-
const tourModelName = name + '
|
|
1894
|
+
const tourModelName = name + '娓歌妯″瀷';
|
|
1952
1895
|
const tourModel = this._gltfElements?.[tourModelName];
|
|
1953
1896
|
|
|
1954
1897
|
document.dispatchEvent(new CustomEvent('gaea-icon-click', {
|
|
@@ -1961,8 +1904,7 @@ export class GaeaApp {
|
|
|
1961
1904
|
return;
|
|
1962
1905
|
}
|
|
1963
1906
|
|
|
1964
|
-
//
|
|
1965
|
-
if (!document.getElementById('gaea-sec-styles')) {
|
|
1907
|
+
// 棣栨鐐瑰嚮鏂潰鏃舵敞鍏ユ爣绛炬牱寮? if (!document.getElementById('gaea-sec-styles')) {
|
|
1966
1908
|
const style = document.createElement('style');
|
|
1967
1909
|
style.id = 'gaea-sec-styles';
|
|
1968
1910
|
style.textContent = `
|
|
@@ -1990,20 +1932,17 @@ export class GaeaApp {
|
|
|
1990
1932
|
this.updateElementPosition({ element: tourModel, position: gltfCfg.position, rotate: gltfCfg.rotate, size: gltfCfg.size });
|
|
1991
1933
|
}
|
|
1992
1934
|
|
|
1993
|
-
// this.RemoveVts({ vtsName: '
|
|
1994
|
-
//
|
|
1995
|
-
document.dispatchEvent(new CustomEvent('gaea-hide-layertree', { bubbles: true }));
|
|
1935
|
+
// this.RemoveVts({ vtsName: '娌挎郸娴峰宸ョ▼鑼冨洿绾? });
|
|
1936
|
+
// 閫氱煡闅愯棌鍥惧眰鏍? document.dispatchEvent(new CustomEvent('gaea-hide-layertree', { bubbles: true }));
|
|
1996
1937
|
this.FlyOver(() => {
|
|
1997
1938
|
this.hiddenScreenWithClass('.waterLevel');
|
|
1998
1939
|
this.hiddenScreenWithClass('.damScreen');
|
|
1999
1940
|
|
|
2000
1941
|
this.gltfPlayer(sectionModel, { x: 0, y: 44, z: 0 }, 1).then(() => {
|
|
2001
|
-
//
|
|
2002
|
-
this._raisedSection = sectionModel;
|
|
1942
|
+
// 璁板綍宸插崌璧风殑鏂潰妯″瀷锛屼緵閲嶇疆鏃剁缉鍥? this._raisedSection = sectionModel;
|
|
2003
1943
|
if (tourModel) {
|
|
2004
1944
|
this.lockedModesSwitch(true, tourModel, [-10, 50, 0], [50, 50]);
|
|
2005
|
-
//
|
|
2006
|
-
document.dispatchEvent(new CustomEvent('gaea-sec-locked', { detail: { name }, bubbles: true }));
|
|
1945
|
+
// 閿佸畾妯″瀷鍚庡啀閫氱煡鏄剧ず鏂潰婊氬姩鏉? document.dispatchEvent(new CustomEvent('gaea-sec-locked', { detail: { name }, bubbles: true }));
|
|
2007
1946
|
}
|
|
2008
1947
|
|
|
2009
1948
|
if (!this._secIsClickArr.includes(name)) {
|
|
@@ -2021,9 +1960,9 @@ export class GaeaApp {
|
|
|
2021
1960
|
const entryLabel = typeof value === 'object' && value.label ? value.label : String(value);
|
|
2022
1961
|
let cls, imgUrl, offset;
|
|
2023
1962
|
if (hasNumber(entryLabel)) {
|
|
2024
|
-
cls = 'waterLevel'; offset = [0, -54]; imgUrl = '/image/labelImg
|
|
1963
|
+
cls = 'waterLevel'; offset = [0, -54]; imgUrl = '/image/labelImg/姘翠綅.png';
|
|
2025
1964
|
} else {
|
|
2026
|
-
cls = 'damScreen'; offset = [0, -19]; imgUrl = '/image/labelImg
|
|
1965
|
+
cls = 'damScreen'; offset = [0, -19]; imgUrl = '/image/labelImg/宸﹁竟.png';
|
|
2027
1966
|
}
|
|
2028
1967
|
const divid = this._createSecLabel(entryLabel, cls, imgUrl, {
|
|
2029
1968
|
onMouseEnter: (e) => {
|
|
@@ -2056,12 +1995,12 @@ export class GaeaApp {
|
|
|
2056
1995
|
this.hiddenScreenWithClass('.gaea-iconscreen');
|
|
2057
1996
|
this.hiddenScreenWithClass('.gaea-locationLineStyle');
|
|
2058
1997
|
this.hiddenScreenWithClass('.gaea-iconGif');
|
|
2059
|
-
}).catch(err => console.warn('[GaeaApp]
|
|
1998
|
+
}).catch(err => console.warn('[GaeaApp] 鏂潰鍔ㄧ敾澶辫触:', err.message));
|
|
2060
1999
|
});
|
|
2061
2000
|
this.SetPosition(data.favorite || `${data.position.x},${data.position.y},${data.position.z},${data.position.z + 500},0,0`);
|
|
2062
2001
|
}
|
|
2063
2002
|
|
|
2064
|
-
/**
|
|
2003
|
+
/** 椋炶缁撴潫鍥炶皟 */
|
|
2065
2004
|
FlyOver(callback) {
|
|
2066
2005
|
const camera = Gaea.World.Instance.DefaultCamera;
|
|
2067
2006
|
camera.OnFlyOverCallBack(() => {
|
|
@@ -2069,15 +2008,15 @@ export class GaeaApp {
|
|
|
2069
2008
|
});
|
|
2070
2009
|
}
|
|
2071
2010
|
|
|
2072
|
-
/** GLTF
|
|
2011
|
+
/** GLTF 妯″瀷骞崇Щ鍔ㄧ敾 */
|
|
2073
2012
|
gltfPlayer = (element, targetPos, time = 5) => {
|
|
2074
2013
|
return new Promise((resolve, reject) => {
|
|
2075
2014
|
if (!element || !element.TranslateObjectLocal) {
|
|
2076
|
-
reject(new Error('
|
|
2015
|
+
reject(new Error('鏃犳晥鐨勫厓绱犲璞★細缂哄皯 TranslateObjectLocal 鏂规硶'));
|
|
2077
2016
|
return;
|
|
2078
2017
|
}
|
|
2079
2018
|
if (!targetPos || typeof targetPos.x !== 'number' || typeof targetPos.y !== 'number' || typeof targetPos.z !== 'number') {
|
|
2080
|
-
reject(new Error('
|
|
2019
|
+
reject(new Error('鏃犳晥鐨勭洰鏍囦綅缃細蹇呴』鍖呭惈鏁板瓧绫诲瀷鐨?x/y/z 灞炴€?));
|
|
2081
2020
|
return;
|
|
2082
2021
|
}
|
|
2083
2022
|
const frameRate = 60;
|
|
@@ -2114,12 +2053,12 @@ export class GaeaApp {
|
|
|
2114
2053
|
};
|
|
2115
2054
|
moveStep();
|
|
2116
2055
|
} catch (error) {
|
|
2117
|
-
reject(new Error(
|
|
2056
|
+
reject(new Error(`鍔ㄧ敾鎵ц鍑洪敊锛?{error.message}`));
|
|
2118
2057
|
}
|
|
2119
2058
|
});
|
|
2120
2059
|
};
|
|
2121
2060
|
|
|
2122
|
-
/**
|
|
2061
|
+
/** 閿佸畾/瑙i攣鐩告満瑙嗚鍒版ā鍨?*/
|
|
2123
2062
|
lockedModesSwitch = (mode, element, Offset3D = [0, 1.1, 0], MinMaxZoom3D = [1.1, 1.1], LockEye = false) => {
|
|
2124
2063
|
if (mode) {
|
|
2125
2064
|
const ev = new Gaea.EntityView();
|
|
@@ -2133,8 +2072,7 @@ export class GaeaApp {
|
|
|
2133
2072
|
return ev;
|
|
2134
2073
|
} else {
|
|
2135
2074
|
Gaea.World.Instance.CameraController.LockedEntity = null;
|
|
2136
|
-
//
|
|
2137
|
-
this._screenIconList.forEach(item => {
|
|
2075
|
+
// 瑙i攣鏃舵仮澶嶉潪鏂潰鍥炬爣鐨勮嚜鍔ㄥ彲瑙? this._screenIconList.forEach(item => {
|
|
2138
2076
|
if (!item.type && this._markersVisible) {
|
|
2139
2077
|
item.element.UseAutoVisible();
|
|
2140
2078
|
item.element.EnablePick = true;
|
|
@@ -2143,7 +2081,7 @@ export class GaeaApp {
|
|
|
2143
2081
|
}
|
|
2144
2082
|
};
|
|
2145
2083
|
|
|
2146
|
-
/**
|
|
2084
|
+
/** 淇敼妯″瀷浣嶇疆/鏃嬭浆 */
|
|
2147
2085
|
updateElementPosition = ({ element, position, rotate, size }) => {
|
|
2148
2086
|
element.GeographyPosition = new Gaea.Vector3(position.x, position.y, position.z);
|
|
2149
2087
|
if (rotate?.length > 0) {
|
|
@@ -2151,14 +2089,14 @@ export class GaeaApp {
|
|
|
2151
2089
|
}
|
|
2152
2090
|
};
|
|
2153
2091
|
|
|
2154
|
-
/**
|
|
2092
|
+
/** 绉婚櫎 VTS 鐭㈤噺鍥惧眰 */
|
|
2155
2093
|
RemoveVts = ({ vtsName }) => {
|
|
2156
2094
|
Gaea.World.Instance.DefaultVectorPyramidTileSet.RemoveImageStore(
|
|
2157
2095
|
Gaea.WMTSVectorStore.ConvertBy(Gaea.World.Instance.DefaultVectorPyramidTileSet.GetImageStore(vtsName))
|
|
2158
2096
|
);
|
|
2159
2097
|
};
|
|
2160
2098
|
|
|
2161
|
-
/** GLTF
|
|
2099
|
+
/** GLTF 杞ㄨ抗鍔ㄧ敾鎾斁锛堢敤浜庢柇闈㈡父瑙堬級 */
|
|
2162
2100
|
gtlfAnimationPlayer = (trackList, animationConfig, element) => {
|
|
2163
2101
|
element.GeographyPosition = new Gaea.Vector3(trackList[0].x, trackList[0].y, trackList[0].z);
|
|
2164
2102
|
const { animationName, animationType, animationPlaySpeed } = animationConfig;
|
|
@@ -2185,7 +2123,7 @@ export class GaeaApp {
|
|
|
2185
2123
|
return animationPlayer;
|
|
2186
2124
|
};
|
|
2187
2125
|
|
|
2188
|
-
/**
|
|
2126
|
+
/** 鐜粫椋炶 */
|
|
2189
2127
|
FlyAroundPoint = (element, targetAngle, time, callbacks = {}) => {
|
|
2190
2128
|
const { onStart = () => {}, onUpdate = () => {}, onComplete = () => {} } = callbacks;
|
|
2191
2129
|
if (!targetAngle || !element) { onComplete(null); return; }
|
|
@@ -2207,7 +2145,7 @@ export class GaeaApp {
|
|
|
2207
2145
|
tween.start();
|
|
2208
2146
|
};
|
|
2209
2147
|
|
|
2210
|
-
/**
|
|
2148
|
+
/** 鍚姩 TWEEN 鏇存柊寰幆锛堥娆¤皟鐢ㄦ椂鍚姩锛?*/
|
|
2211
2149
|
_startTweenLoop() {
|
|
2212
2150
|
if (this._tweenLoopStarted) return;
|
|
2213
2151
|
this._tweenLoopStarted = true;
|
|
@@ -2218,7 +2156,7 @@ export class GaeaApp {
|
|
|
2218
2156
|
requestAnimationFrame(animate);
|
|
2219
2157
|
}
|
|
2220
2158
|
|
|
2221
|
-
/**
|
|
2159
|
+
/** 鎻愬彇绱㈠紩鍖洪棿鐨?pos 鏁扮粍锛岃捣濮?鐩爣鏃跺弽搴?*/
|
|
2222
2160
|
getPosArrayBetweenIndexes(list, currentIdx, targetIdx) {
|
|
2223
2161
|
if (!Array.isArray(list) || currentIdx < 0 || targetIdx < 0 ||
|
|
2224
2162
|
currentIdx >= list.length || targetIdx >= list.length) {
|
|
@@ -2232,22 +2170,20 @@ export class GaeaApp {
|
|
|
2232
2170
|
return result;
|
|
2233
2171
|
}
|
|
2234
2172
|
|
|
2235
|
-
/**
|
|
2173
|
+
/** 瀹ゅ唴娓歌鍒濆鍖栵細闅愯棌鍥炬爣 + 閿佸畾娓歌妯″瀷 */
|
|
2236
2174
|
initModelTour(modelName, direction = [-0.5, 0, 0]) {
|
|
2237
|
-
//
|
|
2238
|
-
this._screenIconList.forEach(item => {
|
|
2175
|
+
// 闅愯棌鎵€鏈夊睆骞曞浘鏍? this._screenIconList.forEach(item => {
|
|
2239
2176
|
item.element.ForceSetVisible(false);
|
|
2240
2177
|
item.element.EnablePick = false;
|
|
2241
2178
|
});
|
|
2242
2179
|
this.hiddenScreenWithClass('.gaea-locationLineStyle');
|
|
2243
2180
|
this.hiddenScreenWithClass('.gaea-iconscreen');
|
|
2244
2181
|
this.hiddenScreenWithClass('.gaea-iconGif');
|
|
2245
|
-
//
|
|
2246
|
-
document.dispatchEvent(new CustomEvent('gaea-hide-layertree', { bubbles: true }));
|
|
2182
|
+
// 闅愯棌鍥惧眰鏍? document.dispatchEvent(new CustomEvent('gaea-hide-layertree', { bubbles: true }));
|
|
2247
2183
|
|
|
2248
|
-
const tourModel = this._gltfElements?.[`${modelName}
|
|
2184
|
+
const tourModel = this._gltfElements?.[`${modelName}娓歌妯″瀷`];
|
|
2249
2185
|
if (!tourModel) {
|
|
2250
|
-
console.warn('[GaeaApp]
|
|
2186
|
+
console.warn('[GaeaApp] 娓歌妯″瀷鏈壘鍒?', modelName);
|
|
2251
2187
|
return null;
|
|
2252
2188
|
}
|
|
2253
2189
|
this._currentTourModel = tourModel;
|
|
@@ -2256,7 +2192,7 @@ export class GaeaApp {
|
|
|
2256
2192
|
return tourModel;
|
|
2257
2193
|
}
|
|
2258
2194
|
|
|
2259
|
-
/**
|
|
2195
|
+
/** 瀹ゅ唴娓歌璺緞鑺傜偣鐐瑰嚮锛氭部璺緞绉诲姩 + 杞ご */
|
|
2260
2196
|
tourNodeClick(positionList, index) {
|
|
2261
2197
|
const tourModel = this._currentTourModel;
|
|
2262
2198
|
if (!tourModel) return;
|
|
@@ -2265,7 +2201,7 @@ export class GaeaApp {
|
|
|
2265
2201
|
const currentPosList = this.getPosArrayBetweenIndexes(positionList, currentIdx, index);
|
|
2266
2202
|
const time = 2 * (currentPosList.length - 1);
|
|
2267
2203
|
this.gtlfAnimationPlayer(currentPosList, {
|
|
2268
|
-
animationName:
|
|
2204
|
+
animationName: `鍔ㄧ敾${index}`, animationType: 'time', animationPlaySpeed: time, animationLoop: false,
|
|
2269
2205
|
}, tourModel);
|
|
2270
2206
|
const status = currentIdx > index ? 'out' : 'in';
|
|
2271
2207
|
this._currentTourIndexPos = index;
|
|
@@ -2286,7 +2222,7 @@ export class GaeaApp {
|
|
|
2286
2222
|
}, time * 1000);
|
|
2287
2223
|
}
|
|
2288
2224
|
|
|
2289
|
-
/**
|
|
2225
|
+
/** 閫氳繃 URL 鍔犺浇璧勬簮 */
|
|
2290
2226
|
LoadResourceFromUrl = (url, name) => {
|
|
2291
2227
|
return new Promise((resolve, reject) => {
|
|
2292
2228
|
Gaea.GaeaResourceLoader.Instance.LoadResourceFromUrl1(url, name, (code, msg) => {
|
|
@@ -2296,22 +2232,20 @@ export class GaeaApp {
|
|
|
2296
2232
|
});
|
|
2297
2233
|
};
|
|
2298
2234
|
|
|
2299
|
-
/**
|
|
2235
|
+
/** 娣诲姞鍗曚釜鐐瑰浘鏍?*/
|
|
2300
2236
|
addPointIcon = async (options = {}) => {
|
|
2301
2237
|
const { lat, lng, alt = 0, iconSize = 500, enablePick = true } = options;
|
|
2302
2238
|
if (lat == null || lng == null) {
|
|
2303
|
-
console.error('addPointIcon: lat
|
|
2239
|
+
console.error('addPointIcon: lat 鍜?lng 涓嶈兘涓虹┖');
|
|
2304
2240
|
return null;
|
|
2305
2241
|
}
|
|
2306
|
-
//
|
|
2307
|
-
// 换新名可强制重新下载注册,避免命中旧的无效缓存
|
|
2308
|
-
const resName = 'pointIconV3.res';
|
|
2242
|
+
// 璧勬簮鍚嶅甫鐗堟湰鍙凤細npm 鍖呮棭鏈熼檮甯︾殑 1111.res 涓嶅畬鏁达紝浼氳寮曟搸鎸夊悕缂撳瓨杩涙寔涔呭寲鏂囦欢绯荤粺锛? // 鎹㈡柊鍚嶅彲寮哄埗閲嶆柊涓嬭浇娉ㄥ唽锛岄伩鍏嶅懡涓棫鐨勬棤鏁堢紦瀛? const resName = 'pointIconV3.res';
|
|
2309
2243
|
if (!this._pointIconLoaded) {
|
|
2310
2244
|
const resUrl = `${this.config.serveLocal}/1111.res?v=3`;
|
|
2311
2245
|
try {
|
|
2312
2246
|
await this.LoadResourceFromUrl(resUrl, resName);
|
|
2313
2247
|
} catch (e) {
|
|
2314
|
-
console.error('addPointIcon:
|
|
2248
|
+
console.error('addPointIcon: 鍔犺浇 .res 鍥炬爣鏂囦欢澶辫触');
|
|
2315
2249
|
return null;
|
|
2316
2250
|
}
|
|
2317
2251
|
this._pointIconLoaded = true;
|
|
@@ -2335,7 +2269,7 @@ export class GaeaApp {
|
|
|
2335
2269
|
return element;
|
|
2336
2270
|
};
|
|
2337
2271
|
|
|
2338
|
-
/**
|
|
2272
|
+
/** 娓呴櫎鎵€鏈夌偣鍥炬爣 */
|
|
2339
2273
|
clearPointIcons = () => {
|
|
2340
2274
|
if (this._pointIconElements && this._pointIconElements.length > 0) {
|
|
2341
2275
|
this._pointIconElements.forEach
|
|
@@ -2345,17 +2279,17 @@ export class GaeaApp {
|
|
|
2345
2279
|
this.clearTyphoonRoute();
|
|
2346
2280
|
};
|
|
2347
2281
|
|
|
2348
|
-
/**
|
|
2282
|
+
/** 鍔犺浇鍙伴璺嚎锛氬垱寤哄浘鏍囧苟娌胯矾寰勮繍鍔紙鐐逛綅鏁扮粍 [{lat,lng,alt}]锛?*/
|
|
2349
2283
|
addTyphoonRoute = async (pointList = [], options = {}) => {
|
|
2350
2284
|
const { animationPlaySpeed = 20, animationLoop = true } = options;
|
|
2351
2285
|
this.clearTyphoonRoute();
|
|
2352
2286
|
if (!pointList || pointList.length < 2) {
|
|
2353
|
-
console.warn('addTyphoonRoute:
|
|
2287
|
+
console.warn('addTyphoonRoute: 鑷冲皯闇€瑕?涓偣浣?);
|
|
2354
2288
|
return;
|
|
2355
2289
|
}
|
|
2356
2290
|
const element = await this.addPointIcon({ lat: pointList[0].lat, lng: pointList[0].lng, alt: pointList[0].alt || 0 });
|
|
2357
2291
|
if (!element) {
|
|
2358
|
-
console.error('addTyphoonRoute:
|
|
2292
|
+
console.error('addTyphoonRoute: 鍒涘缓鍥炬爣澶辫触');
|
|
2359
2293
|
return;
|
|
2360
2294
|
}
|
|
2361
2295
|
if (this._pointIconElements) {
|
|
@@ -2405,7 +2339,7 @@ export class GaeaApp {
|
|
|
2405
2339
|
return { element };
|
|
2406
2340
|
};
|
|
2407
2341
|
|
|
2408
|
-
/**
|
|
2342
|
+
/** 娓呴櫎鍙伴璺嚎 */
|
|
2409
2343
|
clearTyphoonRoute = () => {
|
|
2410
2344
|
this._typhoonCancelled = true;
|
|
2411
2345
|
if (this._typhoonTimer) { clearTimeout(this._typhoonTimer); this._typhoonTimer = null; }
|
|
@@ -2415,44 +2349,42 @@ export class GaeaApp {
|
|
|
2415
2349
|
}
|
|
2416
2350
|
};
|
|
2417
2351
|
|
|
2418
|
-
/**
|
|
2352
|
+
/** 鏄剧ず鎵€鏈夊睆骞曟爣璁?*/
|
|
2419
2353
|
showAllMarkers = () => {
|
|
2420
2354
|
this._markersVisible = true;
|
|
2421
2355
|
this._screenIconList.forEach(item => {
|
|
2422
|
-
//
|
|
2356
|
+
// 璺宠繃琚殣钘忓垎绫荤殑鏍囪
|
|
2423
2357
|
if (this._hiddenCategories.has(item.category)) return
|
|
2424
2358
|
item.element.UseAutoVisible()
|
|
2425
2359
|
item.element.EnablePick = true
|
|
2426
|
-
//
|
|
2360
|
+
// 鍚屾鏄剧ず DOM 鍏冪礌
|
|
2427
2361
|
const el = document.getElementById(item.element.DivID)
|
|
2428
2362
|
if (el) el.style.display = ''
|
|
2429
2363
|
})
|
|
2430
2364
|
};
|
|
2431
2365
|
|
|
2432
|
-
/**
|
|
2366
|
+
/** 闅愯棌鎵€鏈夊睆骞曟爣璁?*/
|
|
2433
2367
|
hideAllMarkers = () => {
|
|
2434
2368
|
this._markersVisible = false;
|
|
2435
2369
|
this._screenIconList.forEach(item => {
|
|
2436
2370
|
item.element.ForceSetVisible(false)
|
|
2437
2371
|
item.element.EnablePick = false
|
|
2438
|
-
//
|
|
2372
|
+
// 鍚屾闅愯棌 DOM 鍏冪礌
|
|
2439
2373
|
const el = document.getElementById(item.element.DivID)
|
|
2440
2374
|
if (el) el.style.display = 'none'
|
|
2441
2375
|
})
|
|
2442
2376
|
};
|
|
2443
2377
|
|
|
2444
|
-
// ----
|
|
2378
|
+
// ---- 姘撮潰鍔犺浇 ----
|
|
2445
2379
|
|
|
2446
2380
|
/**
|
|
2447
|
-
*
|
|
2381
|
+
* 鍔犺浇姘撮潰
|
|
2448
2382
|
* @param {Object} opts
|
|
2449
|
-
* @param {string} opts.gltfUrl - GLTF
|
|
2450
|
-
* @param {Object} opts.Position - { x:
|
|
2451
|
-
* @param {Array<number>} opts.rotate - [tilt, heading, bank]
|
|
2452
|
-
* @param {Array<number>} opts.scale - [sx, sy, sz]
|
|
2453
|
-
* @param {Array<number>} [opts.colorDeep=[0,157,187]] -
|
|
2454
|
-
* @param {number} [opts.flowSpeed=0.1] - 流速
|
|
2455
|
-
*/
|
|
2383
|
+
* @param {string} opts.gltfUrl - GLTF 妯″瀷璺緞
|
|
2384
|
+
* @param {Object} opts.Position - { x: 绾害, y: 缁忓害, z: 楂樼▼ }
|
|
2385
|
+
* @param {Array<number>} opts.rotate - [tilt, heading, bank] 鏃嬭浆瑙掑害
|
|
2386
|
+
* @param {Array<number>} opts.scale - [sx, sy, sz] 缂╂斁
|
|
2387
|
+
* @param {Array<number>} [opts.colorDeep=[0,157,187]] - 娣辨按鍖洪鑹?[r, g, b]锛?-255锛? * @param {number} [opts.flowSpeed=0.1] - 娴侀€? */
|
|
2456
2388
|
addWaterHandle = async ({
|
|
2457
2389
|
gltfUrl, Position, rotate, scale,
|
|
2458
2390
|
colorDeep = [0, 157, 187],
|
|
@@ -2482,26 +2414,22 @@ export class GaeaApp {
|
|
|
2482
2414
|
Gaea.World.Instance.SetMtlColor(material, 'color_shallow', new Gaea.Color(0 / 255, 157 / 255, 187 / 255, 1))
|
|
2483
2415
|
Gaea.World.Instance.SetMtlColor(material, 'color_deep', new Gaea.Color(colorDeep[0] / 255, colorDeep[1] / 255, colorDeep[2] / 255, 1))
|
|
2484
2416
|
Gaea.World.Instance.SetMtlFloat(material, 'transparency_clarity', 0)
|
|
2485
|
-
Gaea.World.Instance.SetMtlFloat(material, "transparency_refraction", 0); //
|
|
2486
|
-
Gaea.World.Instance.SetMtlFloat(material, "foam_amount", 0.8); // 气泡大小
|
|
2417
|
+
Gaea.World.Instance.SetMtlFloat(material, "transparency_refraction", 0); // 鎶樺皠搴? Gaea.World.Instance.SetMtlFloat(material, "foam_amount", 0.8); // 姘旀场澶у皬
|
|
2487
2418
|
})
|
|
2488
2419
|
|
|
2489
2420
|
Gaea.World.Instance.RenderableObjectList.AddLast(element)
|
|
2490
2421
|
return element
|
|
2491
2422
|
};
|
|
2492
2423
|
|
|
2493
|
-
// ----
|
|
2424
|
+
// ---- 寮€闂ㄥ姩鐢?----
|
|
2494
2425
|
|
|
2495
2426
|
/**
|
|
2496
|
-
*
|
|
2497
|
-
* @param {Object}
|
|
2498
|
-
* @param {Object}
|
|
2499
|
-
* @param {Object}
|
|
2500
|
-
* @param {
|
|
2501
|
-
* @param {number}
|
|
2502
|
-
* @param {Object} Door - 门旋转角度 { x, y, z }
|
|
2503
|
-
* @param {number} floor - 门在模型树中的层级索引
|
|
2504
|
-
*/
|
|
2427
|
+
* 妯″瀷缂撳姩鍔ㄧ敾锛堢缉鏀?浣嶇Щ/鏃嬭浆锛? * @param {Object} element - GLTF 鍏冪礌
|
|
2428
|
+
* @param {Object} Scale - 鐩爣缂╂斁 { x, y, z }
|
|
2429
|
+
* @param {Object} Position - 鐩爣浣嶇疆 { x, y, z }
|
|
2430
|
+
* @param {Object} translation - 妯″瀷鐩稿浣嶇Щ { x, y, z }
|
|
2431
|
+
* @param {number} time - 鍔ㄧ敾鏃堕棿锛坢s锛? * @param {Object} Door - 闂ㄦ棆杞搴?{ x, y, z }
|
|
2432
|
+
* @param {number} floor - 闂ㄥ湪妯″瀷鏍戜腑鐨勫眰绾х储寮? */
|
|
2505
2433
|
tweentest = (element, Scale = {}, Position = {}, translation = {}, time, Door = {}, floor = 0) => {
|
|
2506
2434
|
const { Tween, Easing } = window.TWEEN
|
|
2507
2435
|
|
|
@@ -2561,15 +2489,14 @@ export class GaeaApp {
|
|
|
2561
2489
|
}
|
|
2562
2490
|
};
|
|
2563
2491
|
|
|
2564
|
-
// ----
|
|
2492
|
+
// ---- 妯″瀷鍐呯疆鍔ㄧ敾 ----
|
|
2565
2493
|
|
|
2566
2494
|
/**
|
|
2567
|
-
*
|
|
2568
|
-
* @param {
|
|
2569
|
-
* @param {string} opts.
|
|
2570
|
-
* @param {
|
|
2571
|
-
* @param {
|
|
2572
|
-
* @param {boolean} [opts.isReversePlay=false] - 是否反向播放
|
|
2495
|
+
* 鎵ц妯″瀷鍐呯疆鍔ㄧ敾锛堝寮€闂?鍏抽椄鍔ㄧ敾锛? * @param {Object} opts
|
|
2496
|
+
* @param {string} opts.animationPath - 鍔ㄧ敾璺緞锛屽 '娌挎郸姘撮椄/AnimationPlayer'
|
|
2497
|
+
* @param {string} opts.animationName - 鍔ㄧ敾鍚嶇О锛屽 '寮€闂?
|
|
2498
|
+
* @param {number} [opts.speed=1.0] - 鍔ㄧ敾閫熷害
|
|
2499
|
+
* @param {boolean} [opts.isReversePlay=false] - 鏄惁鍙嶅悜鎾斁
|
|
2573
2500
|
*/
|
|
2574
2501
|
executeModelAnimation = ({ animationPath, animationName, speed = 1.0, isReversePlay = false }) => {
|
|
2575
2502
|
const node = Gaea.World.Instance.GetNode(animationPath)
|