Class: RealTimePath

Glodon.CIMCube.Simulation. RealTimePath

实时路径仿真类,用于模拟实时路径规划和导航

new RealTimePath(map, options)

实时路径仿真类构造函数
Parameters:
Name Type Description
map Glodon.CIMCube CIMCube实例
options Object 实时路径仿真配置参数
Properties
Name Type Description
deviceModelList Array 模型列表参数
Properties
Name Type Description
modelId string 模型id
url string 模型url
scale number 模型大小,默认1
animation object 模型启动的骨骼动画,默认为所有动画启动
Properties
Name Type Description
enable bool 模型启动的骨骼动画,默认为所有动画启动
name string 模型启动指定动画
speedup number 关键帧动画速度,默认2
show bool 模型显示隐藏,默认true
rotation Array 模型自转,不影响其视角,默认[0,0,0] [roll,pitch,heading]
phongLighting bool 是否使用一般的光照模型(冯氏光照),默认为false
alpha number 透明度,默认1
luminanceAtZenith number 亮度,默认0.2
hue number 颜色的色相 (H)SB,默认0.0;值范围:-PI~PI
saturation number 颜色的饱和度 H(S)B,默认1.0;值范围:0~2
brightness number 颜色的明度 HS(B),默认1.0;值范围:0~2
gamma number 伽马值,默认为:1;值范围:0~2
contrast number 对比度,默认为:1
metallicRoughnessFactor Array 金属度|粗糙度调整;建议用在白膜上,会替换材质中原本金属度|粗糙度; 例:[0.5,0.5]; 取值范围:0~1
doubleSided Boolean 图层是否使用双面材质, 会覆盖数据属性, 默认为false
shadowMode ShadowMode 阴影模式,默认为 ShadowMode.ENABLED
silhouetteColor Color 描边颜色,默认为rgba(255,255,255,0.3)
silhouetteSize number 描边宽度,默认1
modelIdCallBack function 模型id回调函数,用于根据模型id获取模型
animationNameCallBack function 动画名称回调函数,用于根据动画名称获取动画
clampToTerrain number 适用于无高程数据场景的模型贴地仿真功能,默认关闭(false)。该功能性能消耗极高,仅建议在数据体量较小时使用。
Example
modelIdCallBack: function(indices, attribute) {
         // 设备属性值转换为模型ID,理论值通过服务请求获取对应列表
         const index = indices.indexOf("aoc_class_name");
         if(index == -1) return undefined;
         const attributeValue = attribute[index];
         if(attributeValue == "Excavator") {
             return "excavator";
         } else if(attributeValue == "dumper") {
             return "dumper";
         }
         return "modelId";
     },
     animationNameCallBack: function(indices, attribute) {
         // 设备属性值转换为动画名称,理论值通过服务请求获取对应列表
         const index = indices.indexOf("state");
         if(index == -1) return undefined;
         const attributeValue = attribute[index];
         if(attributeValue == "RETURN") {
             return "RETURN";
         } else if(attributeValue == "GO") {
             return "GO";
         }
         return "animationName";
     },

Extends

Methods


addEventListener(type, listener [, thisArg])

在此事件派发器上添加事件监听.
Parameters:
Name Type Argument Description
type string 事件类型.
listener function 事件监听器.
thisArg Object <optional>
事件监听器的this指针(可选).
Inherited From:
Overrides:
Returns:
调用时将删除此事件侦听器的函数.
Type
function

clearFeaturesModel()

清除实时路径模型与数据

conversionFramePathData(data)

转换的实时路径数据
Parameters:
Name Type Description
data JSON 实时路径数据
Returns:
转换后的实时路径数据
Type
JSON

dispatchEvent(event)

在此事件派发器上派发事件.
Parameters:
Name Type Description
event Object 待派发的事件.
Inherited From:
Overrides:

dispose()

释放资源

getFeaturesModel(featureID)

获取实时路径模型
Parameters:
Name Type Description
featureID string 实时路径featureID

hasEventListener(type [, listener])

检查此事件派发器上是否存在事件监听,如果不传递事件监听器,则判断是否存在指定事件类型的事件监听.
Parameters:
Name Type Argument Description
type string 事件类型
listener function <optional>
事件监听器(可选).
Inherited From:
Overrides:
Returns:
是否存在指定类型及指定事件监听器的事件监听.
Type
boolean

on()

语法糖. on == addEventListener off == removeEventListeners|removeEventListener fire == dispatchEvent
Inherited From:
Overrides:

removeEventListener(type, listener)

从此事件派发器上删除指定事件监听.
Parameters:
Name Type Description
type string 事件类型.
listener function 事件监听器.
Inherited From:
Overrides:

removeEventListeners(type)

从此事件派发器上删除事件监听,如果不提供事件类型,则删除全部事件监听.
Parameters:
Name Type Description
type string 事件类型.
Inherited From:
Overrides:

showPathByPolylines(featureID, opt)

显示实时漫游线 (debugger用)
Parameters:
Name Type Description
featureID string 实时路径featureID
opt Object 漫游线参数
Properties
Name Type Description
lineType number 漫游线类型,默认3;连线效果类型 0:实线|1:发光线|2:虚线|3:动态线
duration number 漫游线持续时间,默认5
lineWidth number 漫游线宽度,默认20
lineColor string 漫游线颜色,默认#00C6FF
image string 漫游线图片
maskLength number 漫游线图片长度,默认25

updatePaths(options)

更新实时路径漫游数据
Parameters:
Name Type Description
options Object 实时路径数据参数
Properties
Name Type Argument Default Description
featuresPath Object feature实时路径数据
Properties
Name Type Description
featureID string featureID
{featureID}.modelId string modelId
{featureID}.data Array 轨迹数据
Properties
Name Type Description
lon number 位置经度lon
lat number 位置纬度lat
height number 位置高度height
timeStamp number 时间戳,默认为0
animationName string 模型骨骼动画切换;非必要值;
replace number <optional>
false 数据是否全替换,默认false
fps number <optional>
10 模拟速度,默认10
startRealTime number <optional>
0 模拟开始时间,默认0