net.refractions.udig.tools.edit.support
Class AbstractPathIterator

java.lang.Object
  extended by net.refractions.udig.tools.edit.support.AbstractPathIterator
All Implemented Interfaces:
java.awt.geom.PathIterator
Direct Known Subclasses:
EditGeomPathIterator

public abstract class AbstractPathIterator
extends java.lang.Object
implements java.awt.geom.PathIterator

An abstract class for drawing EditGeom objects

Since:
1.1.0
Author:
jones

Field Summary
protected  Point currentPoint
           
protected  PrimitiveShape currentShape
           
protected  EditGeom geom
           
protected  Point nextPoint
           
protected  java.util.Iterator<Point> points
           
 
Fields inherited from interface java.awt.geom.PathIterator
SEG_CLOSE, SEG_CUBICTO, SEG_LINETO, SEG_MOVETO, SEG_QUADTO, WIND_EVEN_ODD, WIND_NON_ZERO
 
Constructor Summary
protected AbstractPathIterator(EditGeom shape)
           
 
Method Summary
protected  java.awt.Shape createPoint()
          Called if there is only a single point in the geom.
protected  Path createPointPath(Device device)
           
 int currentSegment(double[] coords)
           
 int currentSegment(float[] coords)
           
 int getWindingRule()
           
 boolean isDone()
           
 void next()
           
 Path toPath(Device device)
           
 java.awt.Shape toShape()
          Returns a shape that can be draw.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

geom

protected final EditGeom geom

points

protected java.util.Iterator<Point> points

currentPoint

protected Point currentPoint

nextPoint

protected Point nextPoint

currentShape

protected PrimitiveShape currentShape
Constructor Detail

AbstractPathIterator

protected AbstractPathIterator(EditGeom shape)
Method Detail

toShape

public java.awt.Shape toShape()
Returns a shape that can be draw.

It is recommended to call getShape() every time a draw is needed because the shape does not update if the EditGeom is updated between draws. getShape is guaranteed to get a shape that is representative of the current state of geom.

Returns:

toPath

public Path toPath(Device device)

createPoint

protected java.awt.Shape createPoint()
Called if there is only a single point in the geom. Default behaviour is to return a small square. If null is returned then this PathIterator will be used to create a geometry.

Returns:
a shape to draw or null if PathIterator should be used to create a shape.

createPointPath

protected Path createPointPath(Device device)

getWindingRule

public int getWindingRule()
Specified by:
getWindingRule in interface java.awt.geom.PathIterator

isDone

public boolean isDone()
Specified by:
isDone in interface java.awt.geom.PathIterator

next

public void next()
Specified by:
next in interface java.awt.geom.PathIterator

currentSegment

public int currentSegment(float[] coords)
Specified by:
currentSegment in interface java.awt.geom.PathIterator

currentSegment

public int currentSegment(double[] coords)
Specified by:
currentSegment in interface java.awt.geom.PathIterator