Skip to content
导览

Class: WallManager

围栏管理类

Details

添加围栏对象、根据图层名删除图层、清除图层、根据图层名获取图层对象、获取所有图层等

Examples

js
const wallManager = await cloud.getWallManager()   // 在CreateApp时调用
const wallManager = await cloud.getWallManager()   // 在CreateApp时调用

Hierarchy

  • Callable

    WallManager

Methods

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[]


addWallEffect

addWallEffect(...args): null | Promise<Wall>

Details

添加围栏对象

Examples

js
const wallManager = await cloud.getWallManager()
   const param = {
     layerName: 'wall', //图层名
     Material: { // 选填
         BumpMode: 0,  //凹凸模式
         MaterialType: 0,  //材质类型
         Metallic: 0.5, // 金属光泽度
         NormalOrBumpScale: 1.0, // 凸起比例
         Roughness: 0.5, // 粗糙度
         Diffuse: '0XFF00FF00', //漫反射颜色
         //可选填值:Planarity、Gradient、red、Stroke、yellow
         DiffuseTexture: 'Planarity',  //纹理
     },
     TextureRate: 1.0, //线的纹理率(一般来说不变),选填
     Height: 3,  //围栏高度 选填
     IsStretch: true, //围栏纹理是否拉伸 选填
     Speed: 0.02,  //围栏纹理速度值 选填
     IsTangentWallEffectDir: true, //围栏效果运动方向是否是沿着路径的切线方向  选填
     IsReverseWallEffect:false,  //围栏效果运动是否是逆时针  选填
     IsShow:true,  //围栏是否显示值  选填
     UVRepeatUNum: 6.0,  //表示纹理在u轴重复数 选填
     UVRepeatVNum: 2.0,  //表示纹理在v轴重复数 选填
     BottomOutline: //围栏底部的顶点
     [
         [
         15.625022888183594,
         0.0099849095568060875,
         29.745611190795898,
         ],
         [
         37.157989501953125,
         0.010088586248457432,
         28.169088363647461,
         ],
         [
         36.95220947265625,
         0.010002888739109039,
         16.018711090087891,
         ],
         [
         27.902980804443359,
         0.0099409837275743484,
         14.839985847473145,
         ],
     ],
     type: '.primt',
   }
await wallManager.addWallEffect(param);
const wallManager = await cloud.getWallManager()
   const param = {
     layerName: 'wall', //图层名
     Material: { // 选填
         BumpMode: 0,  //凹凸模式
         MaterialType: 0,  //材质类型
         Metallic: 0.5, // 金属光泽度
         NormalOrBumpScale: 1.0, // 凸起比例
         Roughness: 0.5, // 粗糙度
         Diffuse: '0XFF00FF00', //漫反射颜色
         //可选填值:Planarity、Gradient、red、Stroke、yellow
         DiffuseTexture: 'Planarity',  //纹理
     },
     TextureRate: 1.0, //线的纹理率(一般来说不变),选填
     Height: 3,  //围栏高度 选填
     IsStretch: true, //围栏纹理是否拉伸 选填
     Speed: 0.02,  //围栏纹理速度值 选填
     IsTangentWallEffectDir: true, //围栏效果运动方向是否是沿着路径的切线方向  选填
     IsReverseWallEffect:false,  //围栏效果运动是否是逆时针  选填
     IsShow:true,  //围栏是否显示值  选填
     UVRepeatUNum: 6.0,  //表示纹理在u轴重复数 选填
     UVRepeatVNum: 2.0,  //表示纹理在v轴重复数 选填
     BottomOutline: //围栏底部的顶点
     [
         [
         15.625022888183594,
         0.0099849095568060875,
         29.745611190795898,
         ],
         [
         37.157989501953125,
         0.010088586248457432,
         28.169088363647461,
         ],
         [
         36.95220947265625,
         0.010002888739109039,
         16.018711090087891,
         ],
         [
         27.902980804443359,
         0.0099409837275743484,
         14.839985847473145,
         ],
     ],
     type: '.primt',
   }
await wallManager.addWallEffect(param);

方式二: 参数: layerName 图层名 参数: wallAttr 围栏效果属性信息 参数: wallGeo 围栏几何体信息

Examples

js
const wallManager = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
   diffuse: '0XfFff0000',  //围栏颜色
   speed: 0,   //纹理流速
   isStretch: false, //围栏纹理是否拉伸
   isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
   diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
 const wallGeo: WallGeometry = {
   bottomOutline: bottons,  //围栏底部的顶点
   height: 10,  //围栏高度
};
await cloud.wallManager.addWallEffect(layerName, wallAttr, wallGeo);
const wallManager = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
   diffuse: '0XfFff0000',  //围栏颜色
   speed: 0,   //纹理流速
   isStretch: false, //围栏纹理是否拉伸
   isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
   diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
 const wallGeo: WallGeometry = {
   bottomOutline: bottons,  //围栏底部的顶点
   height: 10,  //围栏高度
};
await cloud.wallManager.addWallEffect(layerName, wallAttr, wallGeo);

Parameters

NameTypeDescription
...argsany[]不定数量的参数 方式一: 参数: 格式json 格式为:{ layerName: 'wall', //图层名 Material: { // 选填 BumpMode: 0, //凹凸模式 MaterialType: 0, //材质类型 Metallic: 0.5, // 金属光泽度 NormalOrBumpScale: 1.0, // 凸起比例 Roughness: 0.5, // 粗糙度 Diffuse: '0XFF00FF00', //漫反射颜色 //可选填值:Planarity、Gradient、red、Stroke、yellow DiffuseTexture: 'Planarity', //纹理 }, TextureRate: 1.0, //线的纹理率(一般来说不变),选填 Height: 3, //围栏高度 选填 IsStretch: true, //围栏纹理是否拉伸 选填 Speed: 0.02, //围栏纹理速度值 选填 IsTangentWallEffectDir: true, //围栏效果运动方向是否是沿着路径的切线方向 选填 IsReverseWallEffect:false, //围栏效果运动是否是逆时针 选填 IsShow:true, //围栏是否显示值 选填 UVRepeatUNum: 6.0, //表示纹理在u轴重复数 选填 UVRepeatVNum: 2.0, //表示纹理在v轴重复数 选填 BottomOutline: //围栏底部的顶点 [ [ 15.625022888183594, 0.0099849095568060875, 29.745611190795898, ], [ 37.157989501953125, 0.010088586248457432, 28.169088363647461, ], ], type: '.primt', }

Returns

null | Promise<Wall>

围栏对象


addWallEffect_new

addWallEffect_new(layerName, wallAttr, wallGeo): Promise<Wall>

Details

添加围栏对象

Examples

js
const wallManager = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
   diffuse: '0XfFff0000',  //围栏颜色
   speed: 0,   //纹理流速
   isStretch: false, //围栏纹理是否拉伸
   isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
   diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
 const wallGeo: WallGeometry = {
   bottomOutline: bottons,  //围栏底部的顶点
   height: 10,  //围栏高度
};
await cloud.wallManager.addWallEffect(layerName, wallAttr, wallGeo);
const wallManager = await cloud.getWallManager();
const layerName = 'wall';
const wallAttr: WallEffectAttr = {
   diffuse: '0XfFff0000',  //围栏颜色
   speed: 0,   //纹理流速
   isStretch: false, //围栏纹理是否拉伸
   isTangentWallEffectDir: true,  //围栏效果运动方向是否是沿着路径的切线方向
   diffuseTexture: 'yellow',  //纹理,可选填值:Planarity、Gradient、red、Stroke、yellow
};
const bottons = [];
bottons.push(new Vector3(256.787, 0.6, 356.222));
bottons.push(new Vector3(289.689, 0.681, 355.693));
bottons.push(new Vector3(285.741, 0.7, 331.082));
bottons.push(new Vector3(256.787, 0.6, 356.222));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
// bottons.push(new LonLatAlt(0.0026023211, 0.0031952462, 0.6972457329));
// bottons.push(new LonLatAlt(0.0025668529, 0.0029741609, 0.7148046494));
// bottons.push(new LonLatAlt(0.0023067557, 0.0031999990, 0.6151075792));
 const wallGeo: WallGeometry = {
   bottomOutline: bottons,  //围栏底部的顶点
   height: 10,  //围栏高度
};
await cloud.wallManager.addWallEffect(layerName, wallAttr, wallGeo);

Parameters

NameTypeDescription
layerNamestring图层名
wallAttrWallEffectAttr围栏效果属性信息
wallGeoWallGeometry围栏几何体信息

Returns

Promise<Wall>

围栏对象


removeLayer

removeLayer(layerName): Promise<any>

Details

根据图层名删除图层

Examples

js
wallManager = await cloud.getWallManager()
var layers =  await wallManager.getAllLayers();
await wallManager.removeLayer(layers[0].getName());
wallManager = await cloud.getWallManager()
var layers =  await wallManager.getAllLayers();
await wallManager.removeLayer(layers[0].getName());

Parameters

NameTypeDescription
layerNamestring图层名

Returns

Promise<any>


clearLayers

clearLayers(): Promise<any>

Details

清除图层

Examples

js
wallManager = await cloud.getWallManager()
await wallManager.clearLayers();
wallManager = await cloud.getWallManager()
await wallManager.clearLayers();

Returns

Promise<any>


getLayer

getLayer(layerName): Promise<WallLayer>

Details

根据图层名获取图层对象

Examples

js
wallManager = await cloud.getWallManager()
await wallManager.getLayer("wall");
wallManager = await cloud.getWallManager()
await wallManager.getLayer("wall");

Parameters

NameTypeDescription
layerNamestring图层名

Returns

Promise<WallLayer>

围栏图层对象


getAllLayers

getAllLayers(): Promise<WallLayer[]>

Details

获取所有图层对象

Examples

js
wallManager = await cloud.getWallManager()
await wallManager.getAllLayers();
wallManager = await cloud.getWallManager()
await wallManager.getAllLayers();

Returns

Promise<WallLayer[]>

wallLayer数组