| | |
| | | ArrayList<ArrayList<NavigateNode>> list = new ArrayList<>(); |
| | | ArrayList<NavigateNode> data = new ArrayList<>(); |
| | | String direction = mapList.get(0).getDirection();//行走方向 |
| | | for (NavigateNode mapNode : mapList) { |
| | | |
| | | for (int i = 0; i < mapList.size(); i++) { |
| | | NavigateNode mapNode = mapList.get(i); |
| | | boolean isInflectionPoint = mapNode.getIsInflectionPoint(); |
| | | data.add(mapNode); |
| | | if (isInflectionPoint) { |
| | |
| | | list.add(data);//添加某一段数据 |
| | | direction = mapNode.getDirection();//更新行走方向 |
| | | data = new ArrayList<>(); |
| | | data.add(mapNode);//将拐点的终点,更新成下一段命令的起点坐标 |
| | | }else { |
| | | //直行线路 |
| | | mapNode.setDirection(direction);//设置行走方向 |
| | |
| | | /** |
| | | * 获取当前路径总行走距离 |
| | | */ |
| | | public static Integer getCurrentPathAllDistance(ArrayList<NavigateNode> path) { |
| | | public static Integer getCurrentPathAllDistance(List<NavigateNode> path) { |
| | | if (path.size() == 1) { |
| | | //路径只有一条数据,则直接返回行走距离 |
| | | return path.get(0).getMoveDistance(); |