PathIteratorの内容を表示する

PathIterator pi;

double[] points = new double[6];
while(!pi.isDone()){
    int type = pi.currentSegment(points);
    switch(type){
        case PathIterator.SEG_MOVETO:
            System.out.printf("move:(%.2f, %.2f)%n", points[0], points[1]);
            break;
        case PathIterator.SEG_LINETO:
            System.out.printf("line:(%.2f, %.2f)%n", points[0], points[1]);
            break;
        case PathIterator.SEG_CUBICTO:
            System.out.printf("cubic:(%.2f, %.2f) (%.2f, %.2f) (%.2f, %.2f) %n", 
                    points[0], points[1], points[2], points[3], points[4], points[5]);
            break;
        case PathIterator.SEG_QUADTO:
            System.out.printf("quad:(%.2f, %.2f) (%.2f, %.2f)%n",
                    points[0], points[1], points[2], points[3]);
            break;
        case PathIterator.SEG_CLOSE:
            System.out.printf("close%n");
            break;
        default:
            System.out.println("その他:" + type);
    }
    pi.next();
}