Package diva.canvas.interactor
Class PathGeometry.Vertex
- java.lang.Object
-
- diva.canvas.AbstractSite
-
- diva.canvas.interactor.PathGeometry.Vertex
-
- All Implemented Interfaces:
Site
- Direct Known Subclasses:
PathGeometry.CloseSegment
- Enclosing class:
- PathGeometry
public class PathGeometry.Vertex extends AbstractSite
Vertex is the site that represents vertexes of the path. Any object that has a reference to a Vertex is obliged to lose it if the Vertex's id becomes larger than the number of vertexes in the path. (If they don't, then accessing the site may result in a out-of-bounds exception.) Clients must also be aware that the type of the vertex may also change if the shape changes, so they should use the getType() method to get the type of the vertex if necessary.
-
-
Field Summary
-
Fields inherited from class diva.canvas.AbstractSite
_hasNormal, _normal
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getControlPoint()
Get the control point of this site.Figure
getFigure()
Get the figure to which this site is attached, or null if it is not attached to a figure.int
getID()
Get the ID of this site.double
getX()
Get the x-coordinate of the site, in the local coordinates of the containing pane.double
getY()
Get the y-coordinate of the site, in the local coordinates of the containing pane.void
setPoint(java.awt.geom.Point2D point)
Set the point location of the sitejava.lang.String
toString()
Describe this sitevoid
translate(double x, double y)
Translate the site by the indicated distance.-
Methods inherited from class diva.canvas.AbstractSite
getNormal, getPoint, getPoint, getPoint, getPoint, getTransformContext, hasNormal, isNormal, setNormal
-
-
-
-
Method Detail
-
getID
public int getID()
Get the ID of this site.- Specified by:
getID
in interfaceSite
- Specified by:
getID
in classAbstractSite
- Returns:
- The unique identifier.
-
getControlPoint
public int getControlPoint()
Get the control point of this site.
-
getFigure
public Figure getFigure()
Get the figure to which this site is attached, or null if it is not attached to a figure.- Specified by:
getFigure
in interfaceSite
- Specified by:
getFigure
in classAbstractSite
- Returns:
- The figure.
-
getX
public double getX()
Get the x-coordinate of the site, in the local coordinates of the containing pane.- Specified by:
getX
in interfaceSite
- Specified by:
getX
in classAbstractSite
- Returns:
- The x-coordinate of the site.
-
getY
public double getY()
Get the y-coordinate of the site, in the local coordinates of the containing pane.- Specified by:
getY
in interfaceSite
- Specified by:
getY
in classAbstractSite
- Returns:
- The y-coordinate of the site.
-
setPoint
public void setPoint(java.awt.geom.Point2D point)
Set the point location of the site
-
translate
public void translate(double x, double y)
Translate the site by the indicated distance. If this vertex is one end of a cubic curve, move the adjacent control point or control points the same distance. If this site is one end of a quadratic curve, move the adjacent control points half of the distance.- Specified by:
translate
in interfaceSite
- Overrides:
translate
in classAbstractSite
- Parameters:
x
- The x distance to be translated.y
- The y distance to be translated.
-
toString
public java.lang.String toString()
Describe this site- Overrides:
toString
in classjava.lang.Object
-
-