Exemplo n.º 1
0
  /** use a simple speed/time decision to decide if it's possible to navigate a route */
  public void decideAchievableRoute(CoreRoute r) {
    if (!r.isPossible() || !(r instanceof StraightRoute)) return;
    StraightRoute route = (StraightRoute) r;

    double distance = route.getDistance();
    double elapsed = route.getElapsedTime();
    double speed = distance / elapsed;

    SpeedRange speedR = _states.get(0).getSpeed();
    if (speedR != null && !speedR.allows(speed)) {
      route.setImpossible();
      return;
    }

    double thisC = route.getCourse();
    CourseRange courseR = _states.get(0).getCourse();
    if (courseR != null && !courseR.allows(thisC)) {
      route.setImpossible();
      return;
    }

    // examine the scaled polygons to see if this candidate route passes
    // through all of them.
    decideScaledPolygons(route);
  }