diva.canvas.interactor
Class PathGeometry

java.lang.Object
  extended by diva.canvas.interactor.PathGeometry
All Implemented Interfaces:
Geometry

public class PathGeometry
extends 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:
$Revision: 1.15 $
Author:
John Reekie, Nick Zamora

Nested Class Summary
 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
PathGeometry(Figure figure, Shape shape)
          Create a new geometry object on the given figure and with the given initial shape.
 
Method Summary
 Figure getFigure()
          Get the figure to which this geometry object is attached.
 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(Shape shape)
          Set the shape that defines this geometry object.
 void translate(double x, double y)
          Translate the geometry object
 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,
                    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 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(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 Iterator vertices()
Return an iteration over the vertices in this geometry object.



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.