Skip to content
导览

Class: Packer

打散模型场景操作数据包装类

Details

全部加载,区域加载,树分支加载,逻辑树加载等

Hierarchy

  • Callable

    Packer

Methods

fullLoadAsync

fullLoadAsync(): Promise<null | string>

Details

全部加载,异步加载,加载完毕后触发回调确认加载完毕

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.fullLoadAsync()
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.fullLoadAsync()

Returns

Promise<null | string>

返回创建的加载任务的guid,后续回调时亦以此guid作为标识


areaLoad

areaLoad(box): Promise<string>

Details

区域加载

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const box = {
  min: { x: 0, y: 0, z: 0 },
  max: { x: 100, y: 100, z: 100 }
}
packer.areaLoad(box)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const box = {
  min: { x: 0, y: 0, z: 0 },
  max: { x: 100, y: 100, z: 100 }
}
packer.areaLoad(box)

Parameters

NameTypeDescription
boxBox3Box3数据类型,此参数为加载区域

Returns

Promise<string>

返回创建的加载任务的guid,后续回调时亦以此guid作为标识


treeBranchLoad

treeBranchLoad(branchids): Promise<string[]>

Details

树分支加载(异步加载),加载完后时候触发回调

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pIds=[{
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }]
packer.treeBranchLoad(pId)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pIds=[{
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }]
packer.treeBranchLoad(pId)

Parameters

NameTypeDescription
branchidsPackerLoadId[]PackerLoadId 数据类型,参考样式:[{treeId:1,nodeId:7454555414454555}]

Returns

Promise<string[]>

返回创建的加载任务的guid,传入每一个对象会独立创建一个任务,后续回调时亦以此guid作为标识


treeBranchLoadSync

treeBranchLoadSync(Treeids): Promise<string[]>

Details

树分支加载(同步),会同时创建实树节点

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
packer.treeBranchLoadSync(pId)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
packer.treeBranchLoadSync(pId)

Parameters

NameTypeDescription
TreeidsPackerLoadIdPackerLoadId 数据类型,参考样式:[{treeId:1,nodeId:7454555414454555}]

Returns

Promise<string[]>

对于每一个对象,如果成功则返回执行任务的guid,失败则返回空字符串


loadLogicTree

loadLogicTree(treeid): Promise<ModelLoadedInfo[]>

Details

逻辑树加载同步

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
let Nodes = packer.loadLogicTree(pId)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
let Nodes = packer.loadLogicTree(pId)

Parameters

NameTypeDescription
treeidPackerLoadIdPackerLoadId 数据类型,参考样式:[{treeId:1,nodeId:7454555414454555}]

Returns

Promise<ModelLoadedInfo[]>

返回加载的节点数组


loadLogicTreeAsync

loadLogicTreeAsync(treeid): Promise<string[]>

Details

逻辑树加载异步,会触发加载回调

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
packer.loadLogicTreeAsync(pId)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
const pId={
    treeId: Number(tree.value),
    nodeId: BigInt(node.value),
  }
packer.loadLogicTreeAsync(pId)

Parameters

NameTypeDescription
treeidPackerLoadIdPackerLoadId 数据类型,参考样式:[{treeId:1,nodeId:7454555414454555}]

Returns

Promise<string[]>

返回创建的加载任务的guid,传入每一个对象会独立创建一个任务,后续回调时亦以此guid作为标识


unloadModelByGuid

unloadModelByGuid(guid): Promise<boolean>

Details

根据节点guid卸载模型

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.unloadModelByGuid(guid)
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.unloadModelByGuid(guid)

Parameters

NameTypeDescription
guidstring节点(node或者vnode)的guid String数据类型

Returns

Promise<boolean>

成功(或node不存在)返回true,失败返回false


unloadAllModel

unloadAllModel(): Promise<boolean>

Details

卸载当前packer内加载的所有模型

Examples

调用示例:

js
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.unloadAllModel()
const destructure = await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
packer.unloadAllModel()

Returns

Promise<boolean>

成功返回true,失败返回false


getLogicTreeInfoList

getLogicTreeInfoList(packerid): Promise<LogicTreeListInfo[]>

获取logic_list表中packerid相关的信息

Examples

调用示例:

  • typescript
  • let packerid = 1;
  • let destructure = await cloud.getDestructureLoadManager();
  • const packer = await destructure.openR3D(url)
  • let info = await packer.getLogicTreeInfoList(packerid);
  • [{
  • treeId : 1 ,
  • treeName : dms_pbs_cw,
  • treeTable : t_pk1_logictree1,
  • treeDesc :f2cc2c2f-202403191522
  • }]

Parameters

NameType
packeridnumber

Returns

Promise<LogicTreeListInfo[]>

返回logic_tree信息数组,信息组包括treeId,treeName,treeTable,treeDesc


getGuidBySnowId

getGuidBySnowId(snowIds): Promise<string[]>

Details

通过节点snowId获取对应guid

Examples

调用示例:

js
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pId = [{ treeId : 1, snowId: "7175755915972939776"},{treeId : 1, snowId: "7175755914637541420"}];
let guid = await packer.getGuidByNodeId(pId);
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pId = [{ treeId : 1, snowId: "7175755915972939776"},{treeId : 1, snowId: "7175755914637541420"}];
let guid = await packer.getGuidByNodeId(pId);

Parameters

NameType
snowIdsGetGuidParam[]

Returns

Promise<string[]>

返回guids[]


getSnowIdByGuid

getSnowIdByGuid(guids): Promise<string[]>

Details

通过节点guid获取对应snowId

Examples

调用示例:

js
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pGuid =  [{ treeId : 1, guid: "3c245ebe281c429aa1b1cccae36bdc80"},{treeId : 1, guid: "3842797ee109b61008d13f162235b783"}];
let pid = await packer.getSnowIdByGuid(pGuid);
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pGuid =  [{ treeId : 1, guid: "3c245ebe281c429aa1b1cccae36bdc80"},{treeId : 1, guid: "3842797ee109b61008d13f162235b783"}];
let pid = await packer.getSnowIdByGuid(pGuid);

Parameters

NameType
guidsGetSnowParam[]

Returns

Promise<string[]>

返回snowids


getLocalBoxBySnowId

getLocalBoxBySnowId(snowIds): Promise<string[]>

Details

通过节点snowId获取对应包围盒

Examples

调用示例:

js
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pId = [{ treeId : 1, snowId: "7180507561921278090"},{treeId : 1, snowId: "7180507561921278099"}];
let guid = await packer.getLocalBoxBySnowId(pId);
{"7180507561921278090":{
     "Boundbox":{"max_x":118.3,"max_y":19.530000000000001,"max_z":90.099999999999994,
                 "min_x":112.0,"min_y":18.800000000000001,"min_z":82.950000000000003}},
"7180507561921278099":{
     "Boundbox":{"max_x":112.0,"max_y":19.530000000000001,"max_z":90.099999999999994,
     "min_x":105.7,"min_y":18.800000000000001,"min_z":82.950000000000003}}
"7980507561921278126":{
     "msg-error": "the snowId is no exist in dataBase"}}
let destructure =await cloud.getDestructureLoadManager();
const packer = await destructure.openR3D(url)
let pId = [{ treeId : 1, snowId: "7180507561921278090"},{treeId : 1, snowId: "7180507561921278099"}];
let guid = await packer.getLocalBoxBySnowId(pId);
{"7180507561921278090":{
     "Boundbox":{"max_x":118.3,"max_y":19.530000000000001,"max_z":90.099999999999994,
                 "min_x":112.0,"min_y":18.800000000000001,"min_z":82.950000000000003}},
"7180507561921278099":{
     "Boundbox":{"max_x":112.0,"max_y":19.530000000000001,"max_z":90.099999999999994,
     "min_x":105.7,"min_y":18.800000000000001,"min_z":82.950000000000003}}
"7980507561921278126":{
     "msg-error": "the snowId is no exist in dataBase"}}

Parameters

NameType
snowIdsGetGuidParam[]

Returns

Promise<string[]>

返回guids[]