Package diva.canvas.connector
Class PerimeterSite
- java.lang.Object
-
- diva.canvas.AbstractSite
-
- diva.canvas.connector.PerimeterSite
-
- All Implemented Interfaces:
Site
public class PerimeterSite extends AbstractSite
A site that locates itself on the perimeter of a figure. It implements the setNormal() method to change its position so that a line drawn through the site at the given normal will appear to originate from the center of the figure. Currently, perimeter sites are able to locate themselves on the perimeter of ellipses, rectangles, and arbitrary polygons. For any other shape, the site locates itself on the perimeter of the bounding box for the shape.- Version:
- $Id$
- Author:
- John Reekie, Steve Neuendorffer
-
-
Field Summary
-
Fields inherited from class diva.canvas.AbstractSite
_hasNormal, _normal
-
-
Constructor Summary
Constructors Constructor Description PerimeterSite(Figure figure, int id)Create a new site on the given figure with the given ID.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FiguregetFigure()Get the figure to which this site is attached.intgetID()Get the ID of this site.java.awt.geom.Point2DgetPoint(double normal)Get the point location of the site, in the enclosing transform context.doublegetX()Get the x-coordinate of the site.doublegetY()Get the y-coordinate of the site.-
Methods inherited from class diva.canvas.AbstractSite
getNormal, getPoint, getPoint, getPoint, getTransformContext, hasNormal, isNormal, setNormal, translate
-
-
-
-
Constructor Detail
-
PerimeterSite
public PerimeterSite(Figure figure, int id)
Create a new site on the given figure with the given ID.
-
-
Method Detail
-
getFigure
public Figure getFigure()
Get the figure to which this site is attached.- Specified by:
getFigurein interfaceSite- Specified by:
getFigurein classAbstractSite- Returns:
- The figure.
-
getID
public int getID()
Get the ID of this site.- Specified by:
getIDin interfaceSite- Specified by:
getIDin classAbstractSite- Returns:
- The unique identifier.
-
getPoint
public java.awt.geom.Point2D getPoint(double normal)
Get the point location of the site, in the enclosing transform context.- Specified by:
getPointin interfaceSite- Overrides:
getPointin classAbstractSite- Parameters:
normal- The normal- Returns:
- The point.
-
getX
public double getX()
Get the x-coordinate of the site. The site is located in the center of the parent figure's bounding box.- Specified by:
getXin interfaceSite- Specified by:
getXin classAbstractSite- Returns:
- The x-coordinate of the site.
-
getY
public double getY()
Get the y-coordinate of the site. The site is located in the center of the parent figure's bounding box.- Specified by:
getYin interfaceSite- Specified by:
getYin classAbstractSite- Returns:
- The y-coordinate of the site.
-
-