new RealTimePath(map, options)
实时路径仿真类构造函数
Parameters:
| Name | Type | Description | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
map |
Glodon.CIMCube | CIMCube实例 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
options |
Object | 实时路径仿真配置参数
Properties
|
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";
}
模型开始渲染时触发
realTimePath.on("featureRendered", function(param) {
const featureID = param.featureID;
const properties = realTimePath.getFeaturesProperties(featureID);
console.log(featureID, properties);
});
featuresModel.off("featureRendered");
模型销毁时触发
realTimePath.on("featureDisposed", function(param) {
const featureID = param.featureID;
const model = param.model;
console.log(featureID, model);
});
realTimePath.off("featureDisposed");
模型移动时触发
const featuresModel = realTimePath.getFeatureModel(featureID);
featuresModel.on("featureMoved", function(param) {
const featureID = param.featureID;
const cartographicDegrees = param.cartographicDegrees;
const properties = param.properties;
console.log(featureID, cartographicDegrees, properties);
});
featuresModel.off("featureMoved");
模型属性改变时触发
const featuresModel = realTimePath.getFeatureModel(featureID);
featuresModel.on("propertiesChanged", function(param) {
const featureID = param.featureID;
const properties = param.properties;
console.log(featureID, properties);
});
featuresModel.off("propertiesChanged");
Extends
Members
-
canSelected
-
是否可选中
Methods
-
addEventListener(type, listener [, thisArg])
-
在此事件派发器上添加事件监听.
Parameters:
Name Type Argument Description typestring 事件类型. listenerfunction 事件监听器. thisArgObject <optional>
事件监听器的this指针(可选). - Inherited From:
- Overrides:
Returns:
调用时将删除此事件侦听器的函数.- Type
- function
-
clearFeaturesModel(deleteFeatureID)
-
清除实时路径模型与数据
Parameters:
Name Type Description deleteFeatureIDstring featureID,空的场合清除所有实时路径模型与数据 -
conversionFramePathData(data)
-
转换的实时路径数据
Parameters:
Name Type Description dataJSON 实时路径数据 Returns:
转换后的实时路径数据- Type
- JSON
-
dispatchEvent(event)
-
在此事件派发器上派发事件.
Parameters:
Name Type Description eventObject 待派发的事件. - Inherited From:
- Overrides:
-
dispose()
-
释放资源
-
fire(event)
-
语法糖. fire == dispatchEvent
Parameters:
Name Type Description eventObject 待派发的事件. - Inherited From:
- Overrides:
-
getAllFeaturesModel()
-
获取所有实时路径模型
Returns:
所有实时路径模型- Type
- Object
-
getFeatureModel(featureID)
-
获取实时路径模型
Parameters:
Name Type Description featureIDstring featureID Returns:
实时路径模型- Type
- RealTimePathEntity
-
getFeaturesProperties(featureID)
-
获取模型实时属性
Parameters:
Name Type Description featureIDstring featureID Returns:
模型实时属性- Type
- Object
-
hasEventListener(type [, listener])
-
检查此事件派发器上是否存在事件监听,如果不传递事件监听器,则判断是否存在指定事件类型的事件监听.
Parameters:
Name Type Argument Description typestring 事件类型 listenerfunction <optional>
事件监听器(可选). - Inherited From:
- Overrides:
Returns:
是否存在指定类型及指定事件监听器的事件监听.- Type
- boolean
-
off(type [, listener])
-
语法糖. off == removeEventListeners|removeEventListener
Parameters:
Name Type Argument Description typestring 事件类型. listenerfunction <optional>
事件监听器(可选). - Inherited From:
- Overrides:
-
on(type, listener [, thisArg])
-
语法糖. on == addEventListener
Parameters:
Name Type Argument Description typestring 事件类型. listenerfunction 事件监听器. thisArgObject <optional>
事件监听器的this指针(可选). - Inherited From:
- Overrides:
Returns:
调用时将删除此事件侦听器的函数.- Type
- function
-
removeEventListener(type, listener)
-
从此事件派发器上删除指定事件监听.
Parameters:
Name Type Description typestring 事件类型. listenerfunction 事件监听器. - Inherited From:
- Overrides:
-
removeEventListeners(type)
-
从此事件派发器上删除事件监听,如果不提供事件类型,则删除全部事件监听.
Parameters:
Name Type Description typestring 事件类型. - Inherited From:
- Overrides:
-
showPathByPolylines(featureID, opt)
-
显示实时漫游线 (debugger用)
Parameters:
Name Type Description featureIDstring 实时路径featureID optObject 漫游线参数 Properties
Name Type Description lineTypenumber 漫游线类型,默认3;连线效果类型 0:实线|1:发光线|2:虚线|3:动态线 durationnumber 漫游线持续时间,默认5 lineWidthnumber 漫游线宽度,默认20 lineColorstring 漫游线颜色,默认#00C6FF imagestring 漫游线图片 maskLengthnumber 漫游线图片长度,默认25 -
updatePaths(options)
-
更新实时路径漫游数据
Parameters:
Name Type Description optionsObject 实时路径数据参数 Properties
Name Type Argument Default Description featuresPathObject feature实时路径数据 Properties
Name Type Description featureIDstring featureID {featureID}.modelIdstring modelId {featureID}.positionPositionFragment 智能体位置数据 {featureID}.animationNameAnimationFragment 智能体动画数据 {featureID}.propertiesObject 智能体属性列表; fpsnumber <optional>
10 模拟帧率,默认10 startRealTimenumber <optional>
0 模拟开始时间,默认0 replacenumber <optional>
false 数据是否全替换,默认false autoCompletenumber <optional>
true replace为false场合,前次模拟数据自动执行完成;默认true