if( waypoints.contains(node)){
graphics.setColor( Color.BLACK );
}
Object obj = node.getObject();
if( obj instanceof Point ){
Point point = (Point) obj;
java.awt.Point pixel = context.worldToPixel( point.getCoordinate() );
graphics.fillOval(pixel.x-2, pixel.y-2, 5, 5 );
}
if( waypoints.contains(node)){
graphics.setColor( Color.LIGHT_GRAY );
}
}
Collection<Edge> edges = graph.getEdges();
graphics.setColor( Color.DARK_GRAY );
for( Edge edge : edges ){
Object obj = edge.getObject();
if( path.contains(edge)){
graphics.setColor( Color.BLACK );
graphics.setLineWidth(3);
}
Node start = edge.getNodeA();
Node end = edge.getNodeB();
Point startPoint = (Point) start.getObject();
Point endPoint = (Point) end.getObject();
java.awt.Point startPixel = context.worldToPixel( startPoint.getCoordinate() );
java.awt.Point endPixel = context.worldToPixel( endPoint.getCoordinate() );
graphics.drawLine(startPixel.x, startPixel.y, endPixel.x, endPixel.y);
double angle = Angle.angle(startPoint.getCoordinate(), endPoint.getCoordinate());
double dx = Math.cos( angle+0.1 );
double dy = Math.sin( angle+0.1 );
graphics.drawLine(
endPixel.x, endPixel.y,
(int)(endPixel.x - (10.0*dx)),