if (bestRoute == null) { OMPoint point = new RedPoint(start.x, start.y, 5); toDraw.add(point); point = new RedPoint(end.x, end.y, 5); toDraw.add(point);  return null; }  if (drawResults) { OMPoint point = new YellowPoint(start.x, start.y, 10); toDraw.add(point); point = new YellowPoint(end.x, end.y, 10); toDraw.add(point); }  newPoints = new ArrayList(); populatePointsAndSegments(bestRoute, newPoints, segments);  if (drawResults) { Point last = null; Point first = null; for (Iterator iter = newPoints.iterator(); iter.hasNext();) { Point pt = (Point) iter.next(); if (last != null) { OMLine line = new BlueLine(last.x, last.y, pt.x, pt.y); toDraw.add(line); } if (first == null) first = pt; last = pt; }   OMLine line = new YellowLine(start.x, start.y, first.x, first.y, 10); toDraw.add(line); line = new YellowLine(last.x, last.y, end.x, end.y, 10); toDraw.add(line); }
newPoints = displayPathOnRoad(start, end, bestRoute, segments);
    public List getPathOnRoad(Point start, Point end, List segments) {        List newPoints;        try {            Route bestRoute = getRouteBetweenPoints(start, end);            if (bestRoute == null) {                OMPoint point = new RedPoint(start.x, start.y, 5);                toDraw.add(point);                point = new RedPoint(end.x, end.y, 5);                toDraw.add(point);                return null;            }            if (drawResults) {                OMPoint point = new YellowPoint(start.x, start.y, 10);                toDraw.add(point);                point = new YellowPoint(end.x, end.y, 10);                toDraw.add(point);            }            newPoints = new ArrayList();            populatePointsAndSegments(bestRoute, newPoints, segments);            if (drawResults) {                Point last = null;                Point first = null;                for (Iterator iter = newPoints.iterator(); iter.hasNext();) {                    Point pt = (Point) iter.next();                    if (last != null) {                        OMLine line = new BlueLine(last.x, last.y, pt.x, pt.y);                        toDraw.add(line);                    }                    if (first == null)                        first = pt;                    last = pt;                }                // draw line from start to beginning intersection                OMLine line = new YellowLine(start.x, start.y, first.x, first.y, 10);                toDraw.add(line);                line = new YellowLine(last.x, last.y, end.x, end.y, 10);                toDraw.add(line);            }        } catch (Exception e) {            logger.warning("Got exception " + e);            e.printStackTrace();            return null;        }        return newPoints;    }