| | |
| | | |
| | | import java.io.BufferedReader; |
| | | import java.io.InputStreamReader; |
| | | import java.util.*; |
| | | import java.util.ArrayList; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * A*算法使用工具 |
| | |
| | | } |
| | | |
| | | //判断当前节点到下一个节点是否为拐点 |
| | | public HashMap<String,Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) { |
| | | public HashMap<String, Object> searchInflectionPoint(NavigateNode currentNode, NavigateNode fatherNode, NavigateNode nextNode) { |
| | | HashMap<String, Object> map = new HashMap<>(); |
| | | map.put("result", false);//是否为拐点,true:拐点,false:直线 |
| | | // 第一个点或直线点 |
| | |
| | | if (currentNode.getX() - fatherNode.getX() > 0) { |
| | | //大于0,方向top |
| | | direction = "top"; |
| | | }else { |
| | | } else { |
| | | //小于0,方向bottom |
| | | direction = "bottom"; |
| | | } |
| | |
| | | if (currentNode.getY() - fatherNode.getY() > 0) { |
| | | //大于0,方向left |
| | | direction = "left"; |
| | | }else { |
| | | } else { |
| | | //小于0,方向right |
| | | direction = "right"; |
| | | } |