Skip to content
导览

Class: PathManager

路径管理类

Details

添加路径、获取所有图层对象、通过图层名获取图层对象、批量移除图层、设置绘制完成回调函数、根据url批量添加路径等

Examples

js
const pathManager = await cloud.getPathManager()   // 在CreateApp时调用
const pathManager = await cloud.getPathManager()   // 在CreateApp时调用

Hierarchy

Properties

pSceneManager

pSceneManager: SceneManager

Inherited from

GeometryManager.pSceneManager

Methods

setCancelCallback

setCancelCallback(fn): void

Details

设置绘制完成的回调函数

Examples

js
async function CallBack( GeometryObject | null) {
console.warn(GeometryObject)
}
geometryManager = await cloud.getGeometryManager();
await geometryManager.setCancelCallback(CallBack);
async function CallBack( GeometryObject | null) {
console.warn(GeometryObject)
}
geometryManager = await cloud.getGeometryManager();
await geometryManager.setCancelCallback(CallBack);

Parameters

NameTypeDescription
fn(object: null | GeometryObject) => void函数对象,参数为Node|null,返回值为void

Returns

void

Inherited from

GeometryManager.setCancelCallback


getNodesParam

getNodesParam(params): Promise<any>

获取叶子节点基本体参数(叶子节点下面挂载的是基本体才可以)

Examples

js
let arr:Array<LeafNodeParam>=[];
const param: LeafNodeParam=
{
 LeafNodeGuid:node.guid
}
arr.push(param)
let geometryManager = await cloud.getGeometryManager();
let info =await geometryManager.getNodesParam(arr)
let arr:Array<LeafNodeParam>=[];
const param: LeafNodeParam=
{
 LeafNodeGuid:node.guid
}
arr.push(param)
let geometryManager = await cloud.getGeometryManager();
let info =await geometryManager.getNodesParam(arr)

Parameters

NameTypeDescription
paramsLeafNodeParam[]参数数组

Returns

Promise<any>

Inherited from

GeometryManager.getNodesParam


getAllLayer

getAllLayer(): Promise<PathLayer[]>

Details

获取所有图层对象

Examples

js
pathManager = await cloud.getPathManager()
await pathManager.getAllLayer();
pathManager = await cloud.getPathManager()
await pathManager.getAllLayer();

Returns

Promise<PathLayer[]>

PathLayer数组

Overrides

GeometryManager.getAllLayer


getLayerByLayerName

getLayerByLayerName(laylerName): Promise<PathLayer>

Details

获取图层对象通过图层名

Examples

js
pathManager = await cloud.getPathManager()
await pathManager.getLayerByLayerName('path');
pathManager = await cloud.getPathManager()
await pathManager.getLayerByLayerName('path');

Parameters

NameTypeDescription
laylerNamestring图层名

Returns

Promise<PathLayer>

图层对象

Overrides

GeometryManager.getLayerByLayerName


removeLayers

removeLayers(layers): Promise<boolean>

Details

批量移除图层

Examples

js
pathManager = await cloud.getPathManager()
var layers =  await pathManager.getAllLayer();
await pathManager.removeLayers(layers);
pathManager = await cloud.getPathManager()
var layers =  await pathManager.getAllLayer();
await pathManager.removeLayers(layers);

Parameters

NameTypeDescription
layersPathLayer[]PathLayer数组

Returns

Promise<boolean>


isVector3Array

isVector3Array(array): array is Vector3[]

类型保护函数:判断是否为 Vector3 数组

Parameters

NameType
arrayany

Returns

array is Vector3[]


isLonLatAltArray

isLonLatAltArray(array): array is LonLatAlt[]

类型保护函数:判断是否为 LonLatAlt 数组

Parameters

NameType
arrayany

Returns

array is LonLatAlt[]


addPath

addPath(...args): null | Promise<Path>

Details

添加路径(成员函数接受不定数量的参数)

Examples

js
const pathManager = await cloud.getPathManager()
 const param = {
   layerName: 'path',
   Material: {
       "BumpMode" : 0,
       "MaterialType" : 0,
       "Metallic" : 0.5, //金属光泽度
       "NormalOrBumpScale" : 1.0, //凸起比例
       "Roughness" : 0.5, //粗糙度
       "Diffuse":0x6495ED00, //颜色(ARGB)
       "DiffuseTexture":"Semicircle_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',
 }
await pathManager.addPath(param)
const pathManager = await cloud.getPathManager()
 const param = {
   layerName: 'path',
   Material: {
       "BumpMode" : 0,
       "MaterialType" : 0,
       "Metallic" : 0.5, //金属光泽度
       "NormalOrBumpScale" : 1.0, //凸起比例
       "Roughness" : 0.5, //粗糙度
       "Diffuse":0x6495ED00, //颜色(ARGB)
       "DiffuseTexture":"Semicircle_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',
 }
await pathManager.addPath(param)

使用方式二: 参数: layerName 图层名 参数: pathMaterial 路径材质信息 参数: pathGeo 路径几何体信息

Examples

js
const pathManager = await cloud.getPathManager()
const layerName = 'path';
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, //多段线的线宽
};
await pathManager.addPath(layerName, pathMaterial, pathGeo);
const pathManager = await cloud.getPathManager()
const layerName = 'path';
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, //多段线的线宽
};
await pathManager.addPath(layerName, pathMaterial, pathGeo);

Parameters

NameTypeDescription
...argsany[]不定数量的参数

Returns

null | Promise<Path>

路径对象

使用方式一:

  • 参数: Params 格式json 格式为:{ layerName: 'path', 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', }

addPathByUrl

addPathByUrl(url): Promise<Path[]>

根据url批量添加路径

Example

调用示例:

ts
var pathManager = await cloud.getPathManager()
await pathManager.addPathByUrl(url)
var pathManager = await cloud.getPathManager()
await pathManager.addPathByUrl(url)

Parameters

NameTypeDescription
urlstring路径数据来源url地址 数据格式: { "paths":[ { "layerName": 'path', "Material": { "DiffuseTexture": "Stroke_arrow", "UVAnimation": { "x": 0.02, "y": 0, }, "MaterialType":0, "Metallic":0.5, "NormalOrBumpScale":1.0, "Roughness":0.5, }, "Params": { // 多段线 "LineWidth": 0.5, // 多段线的线宽 "TextureRate": 1.0, // 线的纹理率(一般来说不变) "WHRatio": 2.0, // 纹理图片宽高比 "SmoothnessOfCorners": "middle", // 多线段的顶点 "Vertexes": [ [0, 0, 0], [15, 0, 15], [25, 0, 15.5], [30, 0, 15], [40, 0, 16], [50, 0, 21], [60, 0, 16], ], VertexesByLLA: [ //多线段的顶点(利用经纬高表示坐标),Vertexes与VertexesByLLA二选一即可 [0.0001755172, 0.0002241050, 0.0001931777], [0.0003718209, 0.0001381862, 0.0000832407], [0.0003389351, 0.0000478652, 0.0001034047], ], }, "type": ".primt", }, { "layerName": 'path', //图层名 "Material": { //材质(选填) "Diffuse":"0XFF00FF00", //路径颜色 "DiffuseTexture": 'advance_arrow', //纹理:advance_arrow、light_arrow、Semicircle_arrow、combination_arrow等 "UVAnimation": { "x": 0.02,//x方向 "y": 0, //y方向 }, "MaterialType":0, //材质类型(选填) "Metallic":0.5, //金属性(选填) "NormalOrBumpScale":1.0, //法线或凹凸比例(选填) "Roughness":0.5, //粗糙度(选填) }, "Params": { // 多段线 "LineWidth": 0.5, // 多段线的线宽 "TextureRate": 1.0, // 线的纹理率(一般来说不变)(选填) "WHRatio": 2.0, // 纹理图片宽高比(选填) "SmoothnessOfCorners": "middle",// 拐角平滑程度:'high'、'middle'、'low'(选填) // 多线段的顶点 "Vertexes": [ [0, 0, 0], [-15, 0, 15], [-25, 0, 15.5], [-30, 0, 15], [-40, 0, 16], [-50, 0, 21], [-60, 0, 16], ], VertexesByLLA: [ //多线段的顶点(利用经纬高表示坐标),Vertexes与VertexesByLLA二选一即可 [0.0001755172, 0.0002241050, 0.0001931777], [0.0003718209, 0.0001381862, 0.0000832407], [0.0003389351, 0.0000478652, 0.0001034047], ], }, "type": ".primt", } ] }

Returns

Promise<Path[]>