Class: PathLayer
路径图层对象类
Details
获取图层下所有对象、根据GUID获取路径对象、添加路径对象等
Hierarchy
↳
PathLayer
Methods
remove
▸ remove(obj
): Promise
<any
>
Details
删除层中的某个对象
Examples
js
geometryManager = await cloud.getGeometryManager()
var list = await geometryManager.getAllLayer();
var geomLayer = list[0]; //保证数组不为0
var list1 = await geomLayer.getGeometryObjects();
var obj1 = list1[0];
await geomLayer.remove(obj1);
geometryManager = await cloud.getGeometryManager()
var list = await geometryManager.getAllLayer();
var geomLayer = list[0]; //保证数组不为0
var list1 = await geomLayer.getGeometryObjects();
var obj1 = list1[0];
await geomLayer.remove(obj1);
Parameters
Name | Type | Description |
---|---|---|
obj | GeometryObject | GeometryObject对象 |
Returns
Promise
<any
>
无
Inherited from
show
▸ show(bshow
): Promise
<any
>
Details
设置图层显隐
Examples
js
geometryManager= await cloud.getGeometryManager()
var layers= await geometryManager.getAllLayer();
var layer = layers[0];
var bshow = true;
layer.show(bshow);
geometryManager= await cloud.getGeometryManager()
var layers= await geometryManager.getAllLayer();
var layer = layers[0];
var bshow = true;
layer.show(bshow);
Parameters
Name | Type | Description |
---|---|---|
bshow | boolean | 显隐的状态 |
Returns
Promise
<any
>
无
Inherited from
isShow
▸ isShow(): Promise
<boolean
>
Details
获取图层显隐状态
Examples
js
geometryManager = await cloud.getGeometryManager()
var list = await geometryManager.getAllLayer();
var geomLayer = list[0]; //保证数组不为0
var state = await geomLayer.isShow();
geometryManager = await cloud.getGeometryManager()
var list = await geometryManager.getAllLayer();
var geomLayer = list[0]; //保证数组不为0
var state = await geomLayer.isShow();
Returns
Promise
<boolean
>
返回显隐状态
Inherited from
getPaths
▸ getPaths(): Promise
<Path
[]>
Details
获取图层下所有对象
Examples
js
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();
Returns
Promise
<Path
[]>
Path数组
isVector3Array
▸ isVector3Array(array
): array is Vector3[]
类型保护函数:判断是否为 Vector3 数组
Parameters
Name | Type |
---|---|
array | any |
Returns
array is Vector3[]
isLonLatAltArray
▸ isLonLatAltArray(array
): array is LonLatAlt[]
类型保护函数:判断是否为 LonLatAlt 数组
Parameters
Name | Type |
---|---|
array | any |
Returns
array is LonLatAlt[]
addPath
▸ addPath(...args
): null
| Promise
<Path
>
Details
添加对象
Examples
js
geometryManager= await cloud.getPathManager()
var list = await pathManager.getAllLayer();
var pathLayer = list[0]; //保证数组不为0
const param = {
Material: { //材质
Diffuse:"0xFF00FF00", //路径颜色
DiffuseTexture: 'advance_arrow', //纹理:advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等
UVAnimation: { //纹理移动速率
x: 0.02,//x方向
y: 0 //y方向
}
},
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 param = {
Material: { //材质
Diffuse:"0xFF00FF00", //路径颜色
DiffuseTexture: 'advance_arrow', //纹理:advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等
UVAnimation: { //纹理移动速率
x: 0.02,//x方向
y: 0 //y方向
}
},
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);
方拾二:
- 参数: pathMaterial 路径材质信息 参数: pathGeo 路径几何体信息
Examples
js
const pathManager = await cloud.getPathManager()
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 layerlist = await pathManager.getAllLayer();
var layer = layerlist[0];
await layer.addPath(pathMaterial, pathGeo);
const pathManager = await cloud.getPathManager()
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 layerlist = await pathManager.getAllLayer();
var layer = layerlist[0];
await layer.addPath(pathMaterial, pathGeo);
Parameters
Name | Type | Description |
---|---|---|
...args | any [] | 不定数量的参数 方式一: 参数:Params 格式json 格式为:{ Material: { "BumpMode" : 0, "MaterialType" : 0, "Metallic" : 0.5, //金属光泽度 "NormalOrBumpScale" : 1.0, //凸起比例 "Roughness" : 0.5, //粗糙度 "Diffuse":0x6495ED00, //颜色(ARGB) //DiffuseTexture值为:""、default、advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等 "DiffuseTexture":"", //贴图纹理 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, ], ], }, type: '.primt', } |
Returns
null
| Promise
<Path
>
Path对象
get3DElementByGUID
▸ get3DElementByGUID(PathGuid
): Promise
<Path
>
Details
根据GUID获取路径
Example
js
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)
Parameters
Name | Type | Description |
---|---|---|
PathGuid | string | 字符串类型 路径的guid |
Returns
Promise
<Path
>
返回Path对象