1. getShortestPath
获取最短路径
1.1. 参数说明:
名称 | 说明 | 类型 | 是否必填 | 示例 |
---|---|---|---|---|
key | 路网key | string | Y | "R123" |
start | 起点坐标 (模型局部坐标) | number[] | Y | [1000,2000,3000] |
end | 终点坐标 (模型局部坐标) | number[] | Y | [1000,2000,3000] |
type | 路网类型 | string | N | "topo" |
返回值说明 | 类型 | 示例 |
---|---|---|
Promise | <Promise<{}, {}>> | NULL |
1.2. 调用方式:
/**
* 获取最短路径
* @function getShortestPath
* @param {string} key 路网key
* @param {array} start 起点坐标 (模型局部坐标)
* @param {array} end 终点坐标 (模型局部坐标)
* @param {string} type 路网类型,默认topo
* @return {Promise} 初始化完成触发then,出错触发catch,参数为对象,code标记状态
* 成功示例:{
code: "success",
data: {
routeKey: key,
points: data.data
},
start,
end
}
* 失败示例:{
code: "error",
detail: err,
start,
end
}
*/
roadNet.getShortestPath('R123456789', [
1000,
2000,
3000
], [
4000,
5000,
6000
], "topo");