java.awt.geom

Interface PathIterator

Known Implementing Classes:
FlatteningPathIterator, PolylineShapeIterator

public interface PathIterator

The PathIterator interface provides the mechanism for objects that implement the Shape interface to return the geometry of their boundary by allowing a caller to retrieve the path of that boundary a segment at a time. This interface allows these objects to retrieve the path of their boundary a segment at a time by using 1st through 3rd order Bézier curves, which are lines and quadratic or cubic Bézier splines.

Multiple subpaths can be expressed by using a "MOVETO" segment to create a discontinuity in the geometry to move from the end of one subpath to the beginning of the next.

Each subpath can be closed manually by ending the last segment in the subpath on the same coordinate as the beginning "MOVETO" segment for that subpath or by using a "CLOSE" segment to append a line segment from the last point back to the first. Be aware that manually closing an outline as opposed to using a "CLOSE" segment to close the path might result in different line style decorations being used at the end points of the subpath. For example, the BasicStroke object uses a line "JOIN" decoration to connect the first and last points if a "CLOSE" segment is encountered, whereas simply ending the path on the same coordinate as the beginning coordinate results in line "CAP" decorations being used at the ends.

See Also:
Shape, BasicStroke

Field Summary

static int
SEG_CLOSE
The segment type constant that specifies that the preceding subpath should be closed by appending a line segment back to the point corresponding to the most recent SEG_MOVETO.
static int
SEG_CUBICTO
The segment type constant for the set of 3 points that specify a cubic parametric curve to be drawn from the most recently specified point.
static int
SEG_LINETO
The segment type constant for a point that specifies the end point of a line to be drawn from the most recently specified point.
static int
SEG_MOVETO
The segment type constant for a point that specifies the starting location for a new subpath.
static int
SEG_QUADTO
The segment type constant for the pair of points that specify a quadratic parametric curve to be drawn from the most recently specified point.
static int
WIND_EVEN_ODD
The winding rule constant for specifying an even-odd rule for determining the interior of a path.
static int
WIND_NON_ZERO
The winding rule constant for specifying a non-zero rule for determining the interior of a path.

Method Summary

int
currentSegment(double[] coords)
Returns the coordinates and type of the current path segment in the iteration.
int
currentSegment(float[] coords)
Returns the coordinates and type of the current path segment in the iteration.
int
getWindingRule()
Returns the winding rule for determining the interior of the path.
boolean
isDone()
Tests if the iteration is complete.
void
next()
Moves the iterator to the next segment of the path forwards along the primary direction of traversal as long as there are more points in that direction.

Field Details

SEG_CLOSE

public static final int SEG_CLOSE
The segment type constant that specifies that the preceding subpath should be closed by appending a line segment back to the point corresponding to the most recent SEG_MOVETO.
Field Value:
4
Usages and Demos :

View More Examples of PathIterator.SEG_CLOSE
   1:                     break;
   2:                 case PathIterator.SEG_CLOSE:
   3:                     break;
   4:                 default:
   5:                     fail();

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_CLOSE:
   3:                 break;
   4:             case PathIterator.SEG_QUADTO:
   5:             case PathIterator.SEG_CUBICTO:

View Full Code Here
   1:         break;
   2:       case PathIterator.SEG_CLOSE :
   3:         sum += Math.sqrt((x1-xstart)*(x1-xstart)+(y1-ystart)*(y1-ystart));
   4:         xstart = x1;
   5:         ystart = y1;

View Full Code Here
   1:                     break;
   2:                 case PathIterator.SEG_CLOSE:
   3:                     segList.add(new Point2D.Double(aPoint.getX(),aPoint.getY()));
   4:                     break;
   5:             }

View Full Code Here
   1:             if (_done) {
   2:                 return PathIterator.SEG_CLOSE;
   3:             } else {
   4:         ...
   5:             if (_done) {
   6:                 return PathIterator.SEG_CLOSE;
   7:             } else {
   8:                 coords[0] = (float) this._coords[0];
   9:                 coords[1] = (float) this._coords[1];

View Full Code Here

SEG_CUBICTO

public static final int SEG_CUBICTO
The segment type constant for the set of 3 points that specify a cubic parametric curve to be drawn from the most recently specified point. The curve is interpolated by solving the parametric control equation in the range (t=[0..1]) using the most recently specified (current) point (CP), the first control point (P1), the second control point (P2), and the final interpolated control point (P3). The parametric control equation for this curve is:
          P(t) = B(3,0)*CP + B(3,1)*P1 + B(3,2)*P2 + B(3,3)*P3
          0 <= t <= 1

        B(n,m) = mth coefficient of nth degree Bernstein polynomial
               = C(n,m) * t^(m) * (1 - t)^(n-m)
        C(n,m) = Combinations of n things, taken m at a time
               = n! / (m! * (n-m)!)
 
This form of curve is commonly known as a Bézier curve.
Field Value:
3
Usages and Demos :

View More Examples of PathIterator.SEG_CUBICTO
   1:                     break;
   2:                 case PathIterator.SEG_CUBICTO:
   3:                     n = 3;
   4:         ...
   5:                 case 1:
   6:                     assertEquals(type, PathIterator.SEG_CUBICTO);
   7:                     assertEquals(ff[4], 50f, 0.01f);
   8:                     assertEquals(ff[4], 100f, 0.01f);
   9:                     break;

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_CUBICTO:
   3:                 n = 6;
   4:                 break;
   5:             default:

View Full Code Here
   1:             case PathIterator.SEG_QUADTO:
   2:             case PathIterator.SEG_CUBICTO:
   3:             default:
   4:                 throw new Error();
   5:             }

View Full Code Here
   1:       
   2:       case PathIterator.SEG_CUBICTO:
   3:         cubicTo( coords[0], coords[1], 
   4:              coords[2], coords[3],
   5:              coords[4], coords[5] );

View Full Code Here
   1:                 case PathIterator.SEG_LINETO:
   2:                 case PathIterator.SEG_CUBICTO:
   3:                     h1 = coords[0];
   4:                     v1 = coords[1];
   5:                     drawLine(h0, v0, h1, v1);

View Full Code Here

SEG_LINETO

public static final int SEG_LINETO
The segment type constant for a point that specifies the end point of a line to be drawn from the most recently specified point.
Field Value:
1
Usages and Demos :

View More Examples of PathIterator.SEG_LINETO
   1:                 case PathIterator.SEG_MOVETO:
   2:                 case PathIterator.SEG_LINETO:
   3:                     n = 1;
   4:                     break;
   5:                 case PathIterator.SEG_QUADTO:

View Full Code Here
   1:             case PathIterator.SEG_MOVETO:
   2:             case PathIterator.SEG_LINETO:
   3:                 n = 2;
   4:                 break;
   5:             case PathIterator.SEG_QUADTO:

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_LINETO:
   3:                 appendPoint(points, seg[0], seg[1]);
   4:                 break;
   5:             case PathIterator.SEG_CLOSE:

View Full Code Here
   1:       switch(it.currentSegment(coord)) {
   2:       case PathIterator.SEG_LINETO :
   3:         sum += Math.sqrt((x1-coord[0])*(x1-coord[0])+(y1-coord[1])*(y1-coord[1]));
   4:         x1 = coord[0];
   5:         y1 = coord[1];

View Full Code Here
   1:                     break;
   2:                 case PathIterator.SEG_LINETO:
   3:                     segList.add(new Point2D.Double(pts[0],pts[1]));                    
   4:                     break;
   5:                 case PathIterator.SEG_CLOSE:

View Full Code Here

SEG_MOVETO

public static final int SEG_MOVETO
The segment type constant for a point that specifies the starting location for a new subpath.
Field Value:
0
Usages and Demos :

View More Examples of PathIterator.SEG_MOVETO
   1:             {
   2:                 case PathIterator.SEG_MOVETO:
   3:                 case PathIterator.SEG_LINETO:
   4:         ...
   5:                 case 0:
   6:                     assertEquals(type, PathIterator.SEG_MOVETO);
   7:                     assertEquals(ff[0], 100f, 0.01f);
   8:                     assertEquals(ff[1], 50f, 0.01f);
   9:                     break;

View Full Code Here
   1:             switch (t1) {
   2:             case PathIterator.SEG_MOVETO:
   3:             case PathIterator.SEG_LINETO:
   4:                 n = 2;
   5:                 break;

View Full Code Here
   1:             switch(segType){
   2:             case PathIterator.SEG_MOVETO:
   3:                 appendPoint(points, seg[0], seg[1]);
   4:                 break;
   5:             case PathIterator.SEG_LINETO:

View Full Code Here
   1:         break;
   2:       case PathIterator.SEG_MOVETO :
   3:         x1 = coord[0];
   4:         y1 = coord[1];
   5:         ystart = y1;

View Full Code Here
   1:             switch (segType) {
   2:                 case PathIterator.SEG_MOVETO:
   3:                     aPoint.setLocation(pts[0],pts[1]);
   4:                     segList.add(new Point2D.Double(pts[0],pts[1]));
   5:                     break;

View Full Code Here

SEG_QUADTO

public static final int SEG_QUADTO
The segment type constant for the pair of points that specify a quadratic parametric curve to be drawn from the most recently specified point. The curve is interpolated by solving the parametric control equation in the range (t=[0..1]) using the most recently specified (current) point (CP), the first control point (P1), and the final interpolated control point (P2). The parametric control equation for this curve is:
          P(t) = B(2,0)*CP + B(2,1)*P1 + B(2,2)*P2
          0 <= t <= 1

        B(n,m) = mth coefficient of nth degree Bernstein polynomial
               = C(n,m) * t^(m) * (1 - t)^(n-m)
        C(n,m) = Combinations of n things, taken m at a time
               = n! / (m! * (n-m)!)
 
Field Value:
2
Usages and Demos :

View More Examples of PathIterator.SEG_QUADTO
   1:                     break;
   2:                 case PathIterator.SEG_QUADTO:
   3:                     n = 2;
   4:                     break;
   5:                 case PathIterator.SEG_CUBICTO:

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_QUADTO:
   3:                 n = 4;
   4:                 break;
   5:             case PathIterator.SEG_CUBICTO:

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_QUADTO:
   3:             case PathIterator.SEG_CUBICTO:
   4:             default:
   5:                 throw new Error();

View Full Code Here
   1:       
   2:       case PathIterator.SEG_QUADTO:
   3:         quadTo( coords[0], coords[1], coords[2], coords[3] );
   4:         break;
   5:       

View Full Code Here
   1:                 break;
   2:             case PathIterator.SEG_QUADTO:
   3:                 throw new NotImplementedException();
   4:             case PathIterator.SEG_CLOSE:
   5:                 currentShape.setClosed(true);

View Full Code Here

WIND_EVEN_ODD

public static final int WIND_EVEN_ODD
The winding rule constant for specifying an even-odd rule for determining the interior of a path. The even-odd rule specifies that a point lies inside the path if a ray drawn in any direction from that point to infinity is crossed by path segments an odd number of times.
Field Value:
0
Usages and Demos :

View More Examples of PathIterator.WIND_EVEN_ODD
   1:     public int getWindingRule() {
   2:         return PathIterator.WIND_EVEN_ODD;
   3:     }
   4: 
   5:     public boolean isDone() {

View Full Code Here
   1:         switch (path.getWindingRule()) {
   2:         case PathIterator.WIND_EVEN_ODD:
   3:             setWindingRule(GLUFunc.GLU_TESS_WINDING_ODD);
   4:             break;
   5:         case PathIterator.WIND_NON_ZERO:

View Full Code Here
   1:     {
   2:       wRule = PathIterator.WIND_EVEN_ODD;
   3:     }
   4:         ...
   5:     final PathIterator pi = s.getPathIterator(AffineTransform.getTranslateInstance(0, 0));
   6:     if (pi.getWindingRule() == PathIterator.WIND_EVEN_ODD)
   7:     {
   8:       setParameter(WINDING_RULE_NAME, WINDING_RULE_EVEN_ODD);
   9:     }

View Full Code Here
   1:             doDrawing(true, false,
   2:                       iter.getWindingRule() == PathIterator.WIND_EVEN_ODD);
   3:             gen.restoreGraphicsState();
   4:         } catch (IOException ioe) {
   5:             handleIOException(ioe);

View Full Code Here
   1:         doDrawing(true, false,
   2:                   iter.getWindingRule() == PathIterator.WIND_EVEN_ODD);
   3:         currentStream.write("Q\n");
   4:     }

View Full Code Here

WIND_NON_ZERO

public static final int WIND_NON_ZERO
The winding rule constant for specifying a non-zero rule for determining the interior of a path. The non-zero rule specifies that a point lies inside the path if a ray drawn in any direction from that point to infinity is crossed by path segments a different number of times in the counter-clockwise direction than the clockwise direction.
Field Value:
1
Usages and Demos :

View More Examples of PathIterator.WIND_NON_ZERO
   1:     public int getWindingRule () {
   2:         return PathIterator.WIND_NON_ZERO;
   3:     }
   4: 
   5:     public boolean isDone () {

View Full Code Here
   1:     public int getWindingRule () {
   2:         return PathIterator.WIND_NON_ZERO;
   3:     }
   4: 
   5:     public boolean isDone () {

View Full Code Here
   1:   public int getWindingRule() {
   2:     return PathIterator.WIND_NON_ZERO;
   3:   }
   4: 
   5:   public boolean isDone() {

View Full Code Here
   1:             break;
   2:         case PathIterator.WIND_NON_ZERO:
   3:             setWindingRule(GLUFunc.GLU_TESS_WINDING_NONZERO);
   4:             break;
   5:         }

View Full Code Here
   1:     {
   2:       wRule = PathIterator.WIND_NON_ZERO;
   3:     }
   4:     return wRule;
   5:   }

View Full Code Here

Method Details

currentSegment

public int currentSegment(double[] coords)
Returns the coordinates and type of the current path segment in the iteration. The return value is the path-segment type: SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. A double array of length 6 must be passed in and can be used to store the coordinates of the point(s). Each point is stored as a pair of double x,y coordinates. SEG_MOVETO and SEG_LINETO types returns one point, SEG_QUADTO returns two points, SEG_CUBICTO returns 3 points and SEG_CLOSE does not return any points.
Parameters:
coords - an array that holds the data returned from this method
Returns:
the path-segment type of the current path segment.
Usages and Demos :

View More Examples of currentSegment(double[] coords)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     public PathIterator getPathIterator(AffineTransform at) {
   7:         return shape.getPathIterator(at);
   8:         ...
   9: 
  10:     public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:         return shape.getPathIterator(at, flatness);
  12:         ...
  13:         public int currentSegment(double[] coords) { 
  14:             return pi.currentSegment(coords); }

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.util.Collection;
   4:         ...
   5: 
   6: public class ShapeCollectionPathIterator implements PathIterator {
   7:     private Iterator shapeIterator;
   8:         ...
   9:     private PathIterator currentPathIterator = new PathIterator() {
  10:             public int getWindingRule() {
  11:         ...
  12:     public int currentSegment(float[] coords) {
  13:         return currentPathIterator.currentSegment(coords);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:   public PathIterator getPathIterator(AffineTransform at) {
   7:     return new Iterator(shape.getPathIterator(at));
   8:         ...
   9: 
  10:   public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:     return new Iterator(shape.getPathIterator(at, flatness));
  12:         ...
  13:     public int currentSegment(float[] coords) {
  14:       int result = iterator.currentSegment(coords);

View Full Code Here
   1: 
   2:     PathIterator path = arrow[orientation].getPathIterator(t);
   3:     while(!path.isDone()) {
   4:         ...
   5:         path.currentSegment(pts);
   6:         result.addPoint(Math.round(pts[0]), Math.round(pts[1]));
   7:         path.next();
   8:     }

View Full Code Here
   1: 
   2:     class VAListIterator implements PathIterator {
   3:         int index;
   4:         ...
   5:         AffineTransform at;
   6:         PathIterator current;
   7:         
   8:         ...
   9:             if (current != null)
  10:                 return current.currentSegment(coords);
  11:             return SEG_CLOSE;
  12:         ...
  13:             if (current != null)
  14:                 return current.currentSegment(coords);

View Full Code Here

currentSegment

public int currentSegment(float[] coords)
Returns the coordinates and type of the current path segment in the iteration. The return value is the path-segment type: SEG_MOVETO, SEG_LINETO, SEG_QUADTO, SEG_CUBICTO, or SEG_CLOSE. A float array of length 6 must be passed in and can be used to store the coordinates of the point(s). Each point is stored as a pair of float x,y coordinates. SEG_MOVETO and SEG_LINETO types returns one point, SEG_QUADTO returns two points, SEG_CUBICTO returns 3 points and SEG_CLOSE does not return any points.
Parameters:
coords - an array that holds the data returned from this method
Returns:
the path-segment type of the current path segment.
Usages and Demos :

View More Examples of currentSegment(float[] coords)
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     public PathIterator getPathIterator(AffineTransform at) {
   7:         return shape.getPathIterator(at);
   8:         ...
   9: 
  10:     public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:         return shape.getPathIterator(at, flatness);
  12:         ...
  13:         public int currentSegment(double[] coords) { 
  14:             return pi.currentSegment(coords); }

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.util.Collection;
   4:         ...
   5: 
   6: public class ShapeCollectionPathIterator implements PathIterator {
   7:     private Iterator shapeIterator;
   8:         ...
   9:     private PathIterator currentPathIterator = new PathIterator() {
  10:             public int getWindingRule() {
  11:         ...
  12:     public int currentSegment(float[] coords) {
  13:         return currentPathIterator.currentSegment(coords);

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:   public PathIterator getPathIterator(AffineTransform at) {
   7:     return new Iterator(shape.getPathIterator(at));
   8:         ...
   9: 
  10:   public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:     return new Iterator(shape.getPathIterator(at, flatness));
  12:         ...
  13:     public int currentSegment(float[] coords) {
  14:       int result = iterator.currentSegment(coords);

View Full Code Here
   1: 
   2:     PathIterator path = arrow[orientation].getPathIterator(t);
   3:     while(!path.isDone()) {
   4:         ...
   5:         path.currentSegment(pts);
   6:         result.addPoint(Math.round(pts[0]), Math.round(pts[1]));
   7:         path.next();
   8:     }

View Full Code Here
   1: 
   2:     class VAListIterator implements PathIterator {
   3:         int index;
   4:         ...
   5:         AffineTransform at;
   6:         PathIterator current;
   7:         
   8:         ...
   9:             if (current != null)
  10:                 return current.currentSegment(coords);
  11:             return SEG_CLOSE;
  12:         ...
  13:             if (current != null)
  14:                 return current.currentSegment(coords);

View Full Code Here

getWindingRule

public int getWindingRule()
Returns the winding rule for determining the interior of the path.
Returns:
the winding rule.
Usages and Demos :

View More Examples of getWindingRule()
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: 
   4:         ...
   5: public class TransformPathIterator implements PathIterator {
   6:         ...
   7:     PathIterator iter;
   8:     AffineTransform transform;
   9:         ...
  10:     public int getWindingRule() {
  11:         return iter.getWindingRule();

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     public PathIterator getPathIterator(AffineTransform at) {
   7:         return shape.getPathIterator(at);
   8:         ...
   9: 
  10:     public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:         return shape.getPathIterator(at, flatness);
  12:         ...
  13:         public int getWindingRule() {
  14:             return pi.getWindingRule();

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:   public PathIterator getPathIterator(AffineTransform at) {
   7:     return new Iterator(shape.getPathIterator(at));
   8:         ...
   9: 
  10:   public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:     return new Iterator(shape.getPathIterator(at, flatness));
  12:         ...
  13:     public int getWindingRule() {
  14:       return iterator.getWindingRule();

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.PathIterator;
   3: import org.opensourcephysics.controls.XMLControl;
   4:         ...
   5:     GeneralPath shape = (GeneralPath) obj;
   6:     PathIterator it = shape.getPathIterator(null, 0.001);
   7:         ...
   8:     control.setValue("winding rule", it.getWindingRule());
   9:     control.setValue("segments", savePathSegments(it));
  10:         ...
  11: 
  12:   String savePathSegments(PathIterator it) {

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.PathIterator;
   3: import java.io.IOException;
   4:         ...
   5:       {
   6:         case PathIterator.SEG_MOVETO:
   7:           {
   8:         ...
   9:           }
  10:         case PathIterator.SEG_LINETO:
  11:           {
  12:         ...
  13:     final PathIterator it = gp.getPathIterator(new AffineTransform());
  14:     out.writeInt(it.getWindingRule());

View Full Code Here

isDone

public boolean isDone()
Tests if the iteration is complete.
Returns:
true if all the segments have been read; false otherwise.
Usages and Demos :

View More Examples of isDone()
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: 
   4:         ...
   5: public class TransformPathIterator implements PathIterator {
   6:         ...
   7:     PathIterator iter;
   8:     AffineTransform transform;
   9:         ...
  10:     public boolean isDone() {
  11:         return iter.isDone();

View Full Code Here
   1:         int i = 0;
   2:         for (PathIterator pi = a.getPathIterator(null); !pi.isDone(); )
   3:         {
   4:         ...
   5:             {
   6:                 case PathIterator.SEG_MOVETO:
   7:         ...
   8:                 case PathIterator.SEG_LINETO:
   9:                     n = 1;

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:     public static boolean shapeEquals (Shape s1, Shape s2, double epsilon) {
   6:         PathIterator p1 = s1.getPathIterator(new AffineTransform());
   7:         ...
   8:         PathIterator p2 = s2.getPathIterator(new AffineTransform());
   9:         double c1[] = new double[6];
  10:         ...
  11: 
  12:         while (!p1.isDone() && !p2.isDone()) {

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:     public PathIterator getPathIterator(AffineTransform at) {
   7:         return shape.getPathIterator(at);
   8:         ...
   9: 
  10:     public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:         return shape.getPathIterator(at, flatness);
  12:         ...
  13:         public boolean isDone() {
  14:             return pi.isDone(); }

View Full Code Here
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5: 
   6:   public PathIterator getPathIterator(AffineTransform at) {
   7:     return new Iterator(shape.getPathIterator(at));
   8:         ...
   9: 
  10:   public PathIterator getPathIterator(AffineTransform at, double flatness) {
  11:     return new Iterator(shape.getPathIterator(at, flatness));
  12:         ...
  13:     public boolean isDone() {
  14:       return iterator.isDone();

View Full Code Here

next

public void next()
Moves the iterator to the next segment of the path forwards along the primary direction of traversal as long as there are more points in that direction.
Usages and Demos :

View More Examples of next()
   1: import java.awt.geom.AffineTransform;
   2: import java.awt.geom.PathIterator;
   3: 
   4:         ...
   5: public class TransformPathIterator implements PathIterator {
   6:         ...
   7:     PathIterator iter;
   8:     AffineTransform transform;
   9:         ...
  10:     public void next() {
  11:         iter.next();

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.PathIterator;
   3: 
   4:         ...
   5:     Area area = new Area(stroked);
   6:     PathIterator iter = area.getPathIterator(null, 10.0f);
   7: 
   8:         ...
   9:         currentSegment.addPoint(Math.round(segment[0]), Math.round(segment[1]));
  10:         iter.next();
  11:         ...
  12:         if (type == PathIterator.SEG_CLOSE) {

View Full Code Here
   1:         int i = 0;
   2:         for (PathIterator pi = a.getPathIterator(null); !pi.isDone(); )
   3:         {
   4:         ...
   5:             {
   6:                 case PathIterator.SEG_MOVETO:
   7:         ...
   8:                 case PathIterator.SEG_LINETO:
   9:                     n = 1;
  10:         ...
  11:             }
  12:             pi.next();

View Full Code Here
   1: 
   2:         PathIterator ia = pa.getPathIterator(null);
   3:         ...
   4:         PathIterator ib = pb.getPathIterator(null);
   5: 
   6:         ...
   7: 
   8:             ia.next();
   9:         ...
  10:             ib.next();

View Full Code Here
   1: import java.awt.geom.GeneralPath;
   2: import java.awt.geom.PathIterator;
   3: import java.awt.geom.Point2D;
   4:         ...
   5:     public static boolean shapeEquals (Shape s1, Shape s2, double epsilon) {
   6:         PathIterator p1 = s1.getPathIterator(new AffineTransform());
   7:         ...
   8:         PathIterator p2 = s2.getPathIterator(new AffineTransform());
   9:         double c1[] = new double[6];
  10:         ...
  11:             }
  12:             p1.next();

View Full Code Here