Пример #1
0
 @Override
 public int getWeightFromXYToXY(Area area, Point2D start, Point2D end) {
   int dstlength = ((int) start.distance(end)) / MoveConstants.DIVISION_UNIT;
   if (area instanceof Building || !area.isBlockadesDefined()) return dstlength;
   ReachablityState rs = Reachablity.isReachable((Road) area, start, end);
   switch (rs) {
     case Close:
       return MoveConstants.UNREACHABLE_COST_FOR_GRAPH_WEIGTHING;
     case FoggyClose:
       return dstlength * 5;
     case FoggyOpen:
       return dstlength * 2;
     default:
       return dstlength;
   }
 }
Пример #2
0
 @Override
 public int getWeightToXY(Area area, Edge edge, Point2D dst) {
   int dstlength = ((int) edge.getMidPoint().distance(dst)) / MoveConstants.DIVISION_UNIT;
   if (area instanceof Building || !area.isBlockadesDefined()) return dstlength;
   ReachablityState rs = Reachablity.isReachable((Road) area, edge, dst);
   switch (rs) {
     case Close:
       return MoveConstants.UNREACHABLE_COST_FOR_GRAPH_WEIGTHING;
     case FoggyClose:
       //			return dstlength * 2;
     case FoggyOpen:
     case Open:
     default:
       return dstlength;
   }
 }