路径图层对象 PathLayer
路径图层对象操作是用于控制云渲染路径图层对象操作的工具, 该工具的主要功能包括:
- 删除层中的某个对象
- 获取图层下所有对象
- 设置图层显隐
- 获取图层显隐状态
- 根据GUID获取路径对象
- 添加路径对象
我们将提供详细的使用指南和功能说明,帮助用户更好地使用该工具。
删除层中的某个对象 | remove
- 说明:删除层中的某个对象
我们可以调用 PathLayer
上面的 remove
方法来删除层中的某个对象。
- 参数说明
Name | Type | Description |
---|---|---|
obj | Path | Path对象 |
调用示例:
ts
const pathManager = await cloud.getPathManager()
const list = await pathManager.getAllLayer()
const pathLayer = list[0] // 保证数组不为0
const list1 = await pathLayer.getPaths()
const obj1 = list1[0]
await pathLayer.remove(obj1)
const pathManager = await cloud.getPathManager()
const list = await pathManager.getAllLayer()
const pathLayer = list[0] // 保证数组不为0
const list1 = await pathLayer.getPaths()
const obj1 = list1[0]
await pathLayer.remove(obj1)
获取图层下所有对象 | getPaths
- 说明:获取图层下所有对象
我们可以调用 PathLayer
上面的 getPaths
方法来获取图层下所有对象。
调用示例:
ts
pathManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
var list1 = await pathLayer.getPaths();
pathManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
var list1 = await pathLayer.getPaths();
设置图层显隐 | show
- 说明:设置图层显隐
我们可以调用 PathLayer
上面的 show
方法来设置图层显隐。
- 参数说明
| Name | Type | | :------ | :------ | :------ | | bshow
| boolean
| 值为true表示显示,值为false表示隐藏 |
调用示例:
ts
const pathManager = await cloud.getPathManager()
const layers = await pathManager.getAllLayer()
const layer = layers[0]
const bshow = true
layer.show(bshow)
const pathManager = await cloud.getPathManager()
const layers = await pathManager.getAllLayer()
const layer = layers[0]
const bshow = true
layer.show(bshow)
获取图层显隐状态 | isShow
- 说明:获取图层显隐状态
我们可以调用 PathLayer
上面的 isShow
方法来获取图层显隐状态。
调用示例:
ts
const pathManager = await cloud.getPathManager()
const list = await pathManager.getAllLayer()
const pathLayer = list[0] // 保证数组不为0
const state = await pathLayer.isShow()
const pathManager = await cloud.getPathManager()
const list = await pathManager.getAllLayer()
const pathLayer = list[0] // 保证数组不为0
const state = await pathLayer.isShow()
根据GUID获取路径 | get3DElementByGUID
- 说明:根据GUID获取路径
我们可以调用 PathLayer
上面的 get3DElementByGUID
方法来根据GUID获取路径。
- 参数说明
Name | Type | Description |
---|---|---|
pathGuid | string | 路径的guid |
调用示例:
ts
pathManager = await cloud.getPathManager();
var layerlist = await pathManager.getAllLayer();
var layer = layerlist[0];
var pathGuid = "72";
var path = await layer.get3DElementByGUID(pathGuid)
pathManager = await cloud.getPathManager();
var layerlist = await pathManager.getAllLayer();
var layer = layerlist[0];
var pathGuid = "72";
var path = await layer.get3DElementByGUID(pathGuid)
路径添加 | addPath
- 说明:添加路径对象
我们可以调用 PathManager
上面的 addPath
方法来添加路径。
- 参数说明
Name | Type | Description |
---|---|---|
args | any[] | 不定数量的参数 |
调用示例:
ts
//方式一:
geometryManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
const pathMaterial: PathMaterial = {
diffuse: '0x6495ED00', //路径颜色
speed: 0, //纹理流速
diffuseTexture: 'advance_arrow', //纹理,可选填值:默认值:""、default、advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等
};
const bottons = [];
// bottons.push(new LonLatAlt(45.8719157700, -25.3248080505, -28.5463268571));
// bottons.push(new LonLatAlt(44.3180958674, -16.8577567936, -11.6302664680));
// bottons.push(new LonLatAlt(49.3905476282, -12.2034499855, -53.0519158412));
bottons.push(new Vector3(0, 0, 0));
bottons.push(new Vector3(5, 0, 5));
bottons.push(new Vector3(10, 0, 0.5));
bottons.push(new Vector3(15, 0, 0.8));
bottons.push(new Vector3(20, 0, 1));
bottons.push(new Vector3(30, 0, 0.5));
const pathGeo: PathGeometry = {
vertexes: bottons, //多线段的顶点
lineWidth: 0.10000000149011612, //多段线的线宽
};
var path = await pathLayer.addPath(pathMaterial, pathGeo);
//方式二:
geometryManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
const param = {
Material: {
Diffuse:"0xFF00FF00",
DiffuseTexture: 'advance_arrow',
UVAnimation: {
x: 0.02,
y: 0
}
},
Params:
{
LineWidth: 0.10000000149011612, //多段线的线宽
TextureRate: 1.0, //线的纹理率(一般来说不变)
WHRatio: 2.0, // 纹理图片宽高比
SmoothnessOfCorners: 'middle', // 'high'、'middle'、low
Vertexes: //多线段的顶点
[
[
15.625022888183594,
0.0099849095568060875,
29.745611190795898,
],
[
37.157989501953125,
0.010088586248457432,
28.169088363647461,
],
[
36.95220947265625,
0.010002888739109039,
16.018711090087891,
],
[
27.902980804443359,
0.0099409837275743484,
14.839985847473145,
],
[
20.155799865722656,
0.0099557051435112953,
24.936176300048828,
],
],
},
type: '.primt',
}
var path = await pathLayer.addPath(param);
//方式一:
geometryManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
const pathMaterial: PathMaterial = {
diffuse: '0x6495ED00', //路径颜色
speed: 0, //纹理流速
diffuseTexture: 'advance_arrow', //纹理,可选填值:默认值:""、default、advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等
};
const bottons = [];
// bottons.push(new LonLatAlt(45.8719157700, -25.3248080505, -28.5463268571));
// bottons.push(new LonLatAlt(44.3180958674, -16.8577567936, -11.6302664680));
// bottons.push(new LonLatAlt(49.3905476282, -12.2034499855, -53.0519158412));
bottons.push(new Vector3(0, 0, 0));
bottons.push(new Vector3(5, 0, 5));
bottons.push(new Vector3(10, 0, 0.5));
bottons.push(new Vector3(15, 0, 0.8));
bottons.push(new Vector3(20, 0, 1));
bottons.push(new Vector3(30, 0, 0.5));
const pathGeo: PathGeometry = {
vertexes: bottons, //多线段的顶点
lineWidth: 0.10000000149011612, //多段线的线宽
};
var path = await pathLayer.addPath(pathMaterial, pathGeo);
//方式二:
geometryManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
const param = {
Material: {
Diffuse:"0xFF00FF00",
DiffuseTexture: 'advance_arrow',
UVAnimation: {
x: 0.02,
y: 0
}
},
Params:
{
LineWidth: 0.10000000149011612, //多段线的线宽
TextureRate: 1.0, //线的纹理率(一般来说不变)
WHRatio: 2.0, // 纹理图片宽高比
SmoothnessOfCorners: 'middle', // 'high'、'middle'、low
Vertexes: //多线段的顶点
[
[
15.625022888183594,
0.0099849095568060875,
29.745611190795898,
],
[
37.157989501953125,
0.010088586248457432,
28.169088363647461,
],
[
36.95220947265625,
0.010002888739109039,
16.018711090087891,
],
[
27.902980804443359,
0.0099409837275743484,
14.839985847473145,
],
[
20.155799865722656,
0.0099557051435112953,
24.936176300048828,
],
],
},
type: '.primt',
}
var path = await pathLayer.addPath(param);