Class: WlkxModelManager
wlkx加载管理类
Details
加载卸载wlkx模型
Examples
ts
const wlkxModelManager = await cloud.getWlkxModelManager(); // 在CreateApp时调用
const wlkxModelManager = await cloud.getWlkxModelManager(); // 在CreateApp时调用
Hierarchy
Callable
↳
WlkxModelManager
Methods
loadModel
▸ loadModel(model
): Promise
<number
[]>
Details
传入url或本地文件绝对路径, 加载模型
Examples
调用示例:
js
const translation = new Vector3(320, 0, 0);
const eulerAngle = new Euler(0, 0, 0);
const scaling = new Vector3(1, 1, 1);
const trans = new Transform(translation, eulerAngle, scaling);
const info = {
color: '00ff00',
transparency: 100,
};
const gcsTrans = new GCSTransform(new LonLatAlt(112,32,20));
const wlkx = [
{
path: 'http://192.168.41.35:8083/WLKX-CS/New2CC.wlkx',
type: "default",
trans: trans,
gcsTrans:gcsTrans,
//appearance: info,
},
]
wlkx_1 = await cloud.wlkxModelManager.loadModel(wlkx);
console.log(wlkx_1);
const translation = new Vector3(320, 0, 0);
const eulerAngle = new Euler(0, 0, 0);
const scaling = new Vector3(1, 1, 1);
const trans = new Transform(translation, eulerAngle, scaling);
const info = {
color: '00ff00',
transparency: 100,
};
const gcsTrans = new GCSTransform(new LonLatAlt(112,32,20));
const wlkx = [
{
path: 'http://192.168.41.35:8083/WLKX-CS/New2CC.wlkx',
type: "default",
trans: trans,
gcsTrans:gcsTrans,
//appearance: info,
},
]
wlkx_1 = await cloud.wlkxModelManager.loadModel(wlkx);
console.log(wlkx_1);
Parameters
Name | Type | Description |
---|---|---|
model | WlkxLoadInfo [] | WlkxLoadInfo类型的数组 |
Returns
Promise
<number
[]>
模型的唯一标识,按照输入的列表顺序输出
unLoadModel
▸ unLoadModel(keyList
): void
Details
卸载模型
Examples
调用示例:
ts
cloud.wlkxModelManager.unLoadModel([1])
cloud.wlkxModelManager.unLoadModel([1])
Parameters
Name | Type | Description |
---|---|---|
keyList | number [] | 加载模型返回的模型key值 |
Returns
void
setModelLoadFinished
▸ setModelLoadFinished(fn
): void
Details
设置模型加载完毕的回调函数
Examples
调用示例:
ts
function LoadFinished(re: WlkxLoadedInfo) {
(window as any).root = re
console.log(re)
}
cloud.wlkxModelManager.setModelLoadFinished(LoadFinished)
function LoadFinished(re: WlkxLoadedInfo) {
(window as any).root = re
console.log(re)
}
cloud.wlkxModelManager.setModelLoadFinished(LoadFinished)
Parameters
Name | Type | Description |
---|---|---|
fn | (loadedInfo : WlkxLoadedInfo []) => void | 回调函数,loadedInfo指模型加载的结果 |
Returns
void
getAllHistoricalWlkx
▸ getAllHistoricalWlkx(): Promise
<WlkxLoadedInfo
[]>
Details
获取已经加载完成的模型
Examples
调用示例:
js
const ret = await cloud.wlkxModelManager.getAllHistoricalWlkx()
const ret = await cloud.wlkxModelManager.getAllHistoricalWlkx()
Returns
Promise
<WlkxLoadedInfo
[]>
WlkxLoadedInfo数组