Class PathGeometry

  • All Implemented Interfaces:
    Geometry

    public class PathGeometry
    extends java.lang.Object
    implements Geometry
    PathGeometry represents a path. Actually, any shape. Its defining shape is any instance of Shape, although generally this class is most useful for shapes that are instances of GeneralPath, since any modification to any of the will cause the shape returned by getShape() to be changed into an instance of GeneralPath.

    PathGeometry provides sites for the vertices of the path, and for the control point for those segments that are quadratic or cubic curves.

    Version:
    $Id$
    Author:
    John Reekie, Nick Zamora
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      class  PathGeometry.CloseSegment
      CloseSegment is a special type of Vertex, that closes a sub-path.
      class  PathGeometry.Vertex
      Vertex is the site that represents vertexes of the path.
    • Constructor Summary

      Constructors 
      Constructor Description
      PathGeometry​(Figure figure, java.awt.Shape shape)
      Create a new geometry object on the given figure and with the given initial shape.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Figure getFigure()
      Get the figure to which this geometry object is attached.
      java.awt.Shape getShape()
      Get the shape that defines this geometry object.
      Site getVertex​(int number)
      Get the site on the given vertex.
      int getVertexCount()
      Get the number of vertices of this shape.
      void setShape​(java.awt.Shape shape)
      Set the shape that defines this geometry object.
      void translate​(double x, double y)
      Translate the geometry object
      java.util.Iterator vertices()
      Return an iteration over the vertices in this geometry object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PathGeometry

        public PathGeometry​(Figure figure,
                            java.awt.Shape shape)
        Create a new geometry object on the given figure and with the given initial shape.
    • Method Detail

      • getFigure

        public Figure getFigure()
        Get the figure to which this geometry object is attached. Returns null if there isn't one.
        Specified by:
        getFigure in interface Geometry
      • getShape

        public java.awt.Shape getShape()
        Get the shape that defines this geometry object. If any of the sites have been translated since this shape was set, a new shape will be produced and returned.
        Specified by:
        getShape in interface Geometry
      • getVertex

        public Site getVertex​(int number)
        Get the site on the given vertex.
      • getVertexCount

        public int getVertexCount()
        Get the number of vertices of this shape. This number includes all "Close" segments.
      • setShape

        public void setShape​(java.awt.Shape shape)
        Set the shape that defines this geometry object.
        Specified by:
        setShape in interface Geometry
      • translate

        public void translate​(double x,
                              double y)
        Translate the geometry object
        Specified by:
        translate in interface Geometry
      • vertices

        public java.util.Iterator vertices()
        Return an iteration over the vertices in this geometry object.