public Shape forwardShape(Shape shape){
  PathIterator pi=shape.getPathIterator(null);
  double[] coords=new double[6];
  Point2D world=new Point2D.Double();
  Point2D world2=new Point2D.Double();
  Point2D world3=new Point2D.Double();
  Point screen=new Point();
  Point screen2=new Point();
  Point screen3=new Point();
  GeneralPath path=new GeneralPath(GeneralPath.WIND_EVEN_ODD);
  while (!pi.isDone()) {
    int type=pi.currentSegment(coords);
    world.setLocation(coords[0],coords[1]);
    forward(world,screen);
    if (type == PathIterator.SEG_MOVETO) {
      path.moveTo(screen.x,screen.y);
    }
 else     if (type == PathIterator.SEG_LINETO) {
      path.lineTo(screen.x,screen.y);
    }
 else     if (type == PathIterator.SEG_CLOSE) {
      path.closePath();
    }
 else {
      world2.setLocation(coords[2],coords[3]);
      forward(world2,screen2);
      if (type == PathIterator.SEG_QUADTO) {
        path.quadTo(screen.x,screen.y,screen2.x,screen2.y);
      }
 else       if (type == PathIterator.SEG_CUBICTO) {
        world3.setLocation(coords[4],coords[5]);
        forward(world3,screen3);
        path.curveTo(screen.x,screen.y,screen2.x,screen2.y,screen3.x,screen3.y);
      }
    }
    pi.next();
  }
  return path;
}

public Shape forwardShape ( Shape shape ) { PathIterator pi = shape . getPathIterator ( null ) ; double [ ] coords = new double [ 6 ] ; Point2D world = new Point2D . Double ( ) ; Point2D world2 = new Point2D . Double ( ) ; Point2D world3 = new Point2D . Double ( ) ; Point screen = new Point ( ) ; Point screen2 = new Point ( ) ; Point screen3 = new Point ( ) ; GeneralPath path = new GeneralPath ( GeneralPath . WIND_EVEN_ODD ) ; while ( ! pi . isDone ( ) ) { int type = pi . currentSegment ( coords ) ; world . setLocation ( coords [ 0 ] , coords [ 1 ] ) ; forward ( world , screen ) ; if ( type == PathIterator . SEG_MOVETO ) { path . moveTo ( screen . x , screen . y ) ; } else if ( type == PathIterator . SEG_LINETO ) { path . lineTo ( screen . x , screen . y ) ; } else if ( type == PathIterator . SEG_CLOSE ) { path . closePath ( ) ; } else { world2 . setLocation ( coords [ 2 ] , coords [ 3 ] ) ; forward ( world2 , screen2 ) ; if ( type == PathIterator . SEG_QUADTO ) { path . quadTo ( screen . x , screen . y , screen2 . x , screen2 . y ) ; } else if ( type == PathIterator . SEG_CUBICTO ) { world3 . setLocation ( coords [ 4 ] , coords [ 5 ] ) ; forward ( world3 , screen3 ) ; path . curveTo ( screen . x , screen . y , screen2 . x , screen2 . y , screen3 . x , screen3 . y ) ; } } pi . next ( ) ; } return path ; }
simple shape projection , doesn ' t take into account what kind of lines should be drawn between shape points , assumes they should be 2d lines as rendered in 2d space , not interpolated for accuracy as great circle / rhumb lines on a globe . .
