protected void populatePointsAndSegments(Route bestRoute,List newPoints,List segments){
  Projection proj=getProjection();
  Intersection origin=bestRoute.getOriginIntersection();
  if (logger.isLoggable(Level.INFO))   logger.info("adding " + bestRoute.roads.length + " new roads.");
  Road road=null;
  Intersection from=origin, to=null;
  Set loopSet=new HashSet();
  if (doLoopCheck)   loopSet.add(origin);
  Set ptSet=new HashSet();
  for (int i=0; i < bestRoute.roads.length; i++) {
    road=bestRoute.roads[i];
    if (!from.equals(road.getFirstIntersection()) && !from.equals(road.getSecondIntersection())) {
      logger.severe("huh? " + from + " is not an intersection on road "+ road);
    }
    Point pt=createPoint((Point)proj.forward(from.getLocation(),new Point()));
    if (doLoopCheck) {
      if (ptSet.contains(pt)) {
        logger.warning("pt set has duplicate at " + pt);
      }
      ptSet.add(pt);
    }
    newPoints.add(pt);
    to=road.getOtherIntersection(from);
    if (doLoopCheck) {
      if (loopSet.contains(to)) {
        logger.warning("road has a cycle at " + to);
      }
      loopSet.add(to);
    }
    boolean reverse=from.equals(road.getSecondIntersection());
    Segment path=getPathSegment(proj,road,reverse);
    if (logger.isLoggable(Level.INFO))     logger.info("created path " + path);
    segments.add(path);
    from=to;
  }
  if (to != null) {
    Point pt=createPoint((Point)proj.forward(to.getLocation(),new Point()));
    if (ptSet.contains(pt)) {
      logger.warning("pt set has duplicate at " + pt);
    }
    newPoints.add(pt);
    if (logger.isLoggable(Level.INFO))     logger.info(" now " + newPoints.size() + " points and "+ segments.size()+ " segments.");
  }
}

protected void populatePointsAndSegments ( Route bestRoute , List newPoints , List segments ) { Projection proj = getProjection ( ) ; Intersection origin = bestRoute . getOriginIntersection ( ) ; if ( logger . isLoggable ( Level . INFO ) ) logger . info ( "adding " + bestRoute . roads . length + " new roads." ) ; Road road = null ; Intersection from = origin , to = null ; Set loopSet = new HashSet ( ) ; if ( doLoopCheck ) loopSet . add ( origin ) ; Set ptSet = new HashSet ( ) ; for ( int i = 0 ; i < bestRoute . roads . length ; i ++ ) { road = bestRoute . roads [ i ] ; if ( ! from . equals ( road . getFirstIntersection ( ) ) && ! from . equals ( road . getSecondIntersection ( ) ) ) { logger . severe ( "huh? " + from + " is not an intersection on road " + road ) ; } Point pt = createPoint ( ( Point ) proj . forward ( from . getLocation ( ) , new Point ( ) ) ) ; if ( doLoopCheck ) { if ( ptSet . contains ( pt ) ) { logger . warning ( "pt set has duplicate at " + pt ) ; } ptSet . add ( pt ) ; } newPoints . add ( pt ) ; to = road . getOtherIntersection ( from ) ; if ( doLoopCheck ) { if ( loopSet . contains ( to ) ) { logger . warning ( "road has a cycle at " + to ) ; } loopSet . add ( to ) ; } boolean reverse = from . equals ( road . getSecondIntersection ( ) ) ; Segment path = getPathSegment ( proj , road , reverse ) ; if ( logger . isLoggable ( Level . INFO ) ) logger . info ( "created path " + path ) ; segments . add ( path ) ; from = to ; } if ( to != null ) { Point pt = createPoint ( ( Point ) proj . forward ( to . getLocation ( ) , new Point ( ) ) ) ; if ( ptSet . contains ( pt ) ) { logger . warning ( "pt set has duplicate at " + pt ) ; } newPoints . add ( pt ) ; if ( logger . isLoggable ( Level . INFO ) ) logger . info ( " now " + newPoints . size ( ) + " points and " + segments . size ( ) + " segments." ) ; } }
iterates over route , populating points and segments lists . worries about sequence order of from and to points , i . e . end of one road should be the start of the next . this is not guaranteed by the route , so we have to check .
