开启监听事件
js
CloudApi.SuperAPI("Monitor", (data) => {
const jsonObject = JSON.parse(data)
if (jsonObject.CallBackType === "DrawMeshData") { // 例如 :DrawMeshData --> 获取绘制信息
console.log(jsonObject);
}
});
功能描述
触发对应事件,返回信息
数据描述
data ---> JSON字符串 ---> 使用 JSON.parse()
获取绘制数据 data.CallBackType 值为 'DrawMeshData'
json{ "CallBackType": "DrawMeshData", "CoordType": 0, "Points": [ { "Coord": "119.265842,27.043766", "Height": "10" }, { "Coord": "119.266342,27.043766", "Height": "10" }, { "Coord": "119.266542,27.044066", "Height": "10" }, { "Coord": "119.266542,27.044366", "Height": "10" }, { "Coord": "119.266542,27.044666", "Height": "10" } ] }
可视域绘制数据返回 data.CallBackType 值为 'VisualFieldDrawData'
json{ "CallBackType": "VisualFieldDrawData", "Id": "2", "CoordType": 0, "Coord": "119.265842,27.043766", "Height": 20, "Yaw": 60, //偏航角角度 "FieldOfView": 80, "MaxDistance": 150 }
路径绘制数据返回 data.CallBackType 值为 'LinearPathDrawData'
json{ "CallBackType": "LinearPathDrawData", "Id": "2", "CoordType": 0, "Points": [ { "Coord": "119.265842,27.043766", "Height": 10 }, { "Coord": "119.266342,27.043766", "Height": 10 }, { "Coord": "119.266542,27.044066", "Height": 10 }, { "Coord": "119.266542,27.044366", "Height": 10 }, { "Coord": "119.266542,27.044666", "Height": 10 } ], "Color": "FF0000", "Width": "20", "Type": "History"//两种类型:Arrow(箭头流动) History(历史路径) }
获取其定义路径漫游点返回值 data.CallBackType 值为 'ResBrowsesPath'
json{ "CallBackType": "ResBrowsesPath", "FixedPointList":[ { "Pos": "X=8975.778 Y=13374.975 Z=2468.980"//世界坐标 "Roa": "P=0.000000 Y=0.000000 R=0.000000",//姿态欧拉角 "InterpType": "0",//漫游点位插值类型 "Name": "西路口",//漫游点位名称 "DriverTime": "2",//漫游行驶时间 "StopTime": "0",//漫游停留时间 "RoaTime":"0.5"//漫游点旋转时间 }, { "Pos": "X=13210.778 Y=13374.975 Z=2468.980", "Roa": "P=-3.334642 Y=86.550865 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=13217.386 Y=13484.590 Z=2462.582", "Roa": "P=0.455615 Y=89.202835 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=13248.776 Y=15739.310 Z=2480.509", "Roa": "P=0.455615 Y=89.202835 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=13029.097 Y=15746.606 Z=2471.115", "Roa": "P=-2.447380 Y=178.097244 R=-0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=12510.739 Y=15663.777 Z=1899.067", "Roa": "P=-52.989155 Y=175.971741 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=12510.739 Y=15663.777 Z=1899.067", "Roa": "P=-3.424923 Y=-90.582016 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" }, { "Pos": "X=12506.278 Y=15224.582 Z=1872.781", "Roa": "P=-3.424923 Y=-90.582016 R=0.000000", "InterpType": "0", "Name": "", "DriverTime": "2", "StopTime": "0", "RoaTime":"0.5" } ] }
添加自定义路径漫游点返回值 data.CallBackType 值为 'ResViewPoint'
json{ "CallBackType": "ResViewPoint", "Index": "1",//漫游点索引 "Name": "西路口",//漫游点名称 "DriverTime": "1",//漫游行驶时间 "StopTime": "1",//漫游停留时间 "RoaTime": "0.5",//漫游点旋转时间 }
区域周界绘制数据返回值 data.CallBackType 值为 'OutLineDrawData'
json{ "CallBackType": "OutLineDrawData", "Id": "2", "CoordType": 0, "Points": [ { "Coord": "119.265842,27.043766", "Height": 10 }, { "Coord": "119.266342,27.043766", "Height": 10 }, { "Coord": "119.266542,27.044066", "Height": 10 }, { "Coord": "119.266542,27.044366", "Height": 10 }, { "Coord": "119.266542,27.044666", "Height": 10 } ], "Color": "FF0000", "Height": 20, "Type": 1//1,2,3,4 }
获取当前视点信息返回值 data.CallBackType 值为 'GetViewPointData'
json{ "CallBackType": "GetViewPointData", "Coord": "119.265842,27.043766", "Pitch": 30, "Yaw" : 10, "ArmDistance":20000 }
获取鼠标位置视点信息返回值 data.CallBackType 值为 'GetMousePointData'
json{ "CallBackType": "GetMousePointData", "Coord": "119.265842,27.043766", "Height": "10" //单位:m }
绘制剖切数据返回值 data.CallBackType 值为 'SectioningDrawData'
json{ "CallBackType": "SectioningDrawData", "Id": "00001", "SectioningHeight":10,//剖切高度(m) "OffsetHeight":10,//中心点偏移高度(m) "CoordType": 1, "AreaPoints":[ { "Coord":"-272160.0,308130.0", "Height":3.5 }, { "Coord":"-282930.0,308720.0", "Height":3.5 }, { "Coord":"-282530.0,300210.0", "Height":3.5 }, { "Coord":"-272270.0,300700.0", "Height":3.5 } ] }