Class 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
    • Constructor Detail

      • PerimeterSite

        public PerimeterSite​(Figure figure,
                             int id)
        Create a new site on the given figure with the given ID.
    • Method Detail

      • getID

        public int getID()
        Get the ID of this site.
        Specified by:
        getID in interface Site
        Specified by:
        getID in class AbstractSite
        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:
        getPoint in interface Site
        Overrides:
        getPoint in class AbstractSite
        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:
        getX in interface Site
        Specified by:
        getX in class AbstractSite
        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:
        getY in interface Site
        Specified by:
        getY in class AbstractSite
        Returns:
        The y-coordinate of the site.