Class LineElement.Anchor

java.lang.Object
All Implemented Interfaces:
Drawable, GraphLink.LinkableTo
Enclosing class:
LineElement

public class LineElement.Anchor
extends LineElement.GenericPoint
implements GraphLink.LinkableTo
This class stores information for an Anchor pathway element. Anchor element is a connection point on a graphical line or an interaction.
Author:
finterly
  • Field Details

    • position

      private double position
    • shapeType

      private AnchorShapeType shapeType
  • Constructor Details

    • Anchor

      private Anchor​(double position, AnchorShapeType shapeType)
      Instantiates an Anchor pathway element.
      Parameters:
      position - the proportional distance of an anchor along the line it belongs to.
      shapeType - the visual representation of an anchor.
  • Method Details

    • getObjectType

      public ObjectType getObjectType()
      Returns the object type of this pathway element.
      Specified by:
      getObjectType in interface Drawable
      Specified by:
      getObjectType in interface GraphLink.LinkableTo
      Specified by:
      getObjectType in class PathwayObject
      Returns:
      the object type.
    • getPosition

      public double getPosition()
      Returns the proportional distance of an anchor along the line it belongs to, between 0 and 1.
      Returns:
      position the position of the anchor.
    • setPosition

      public void setPosition​(double v)
      Sets the proportional distance of an anchor along the line it belongs to, between 0 and 1.
      Parameters:
      v - the position of the anchor to set.
    • getShapeType

      public AnchorShapeType getShapeType()
      Returns the visual representation of an anchor, e.g., none, square.
      Returns:
      shapeType the shape type of the anchor. Return default square shapeType if null.
    • setShapeType

      public void setShapeType​(AnchorShapeType v)
      Sets the shapeType for given anchor pathway element.
      Parameters:
      v - the shape type of the anchor to set.
      Throws:
      java.lang.IllegalArgumentException - if shapeType null.
    • getZOrder

      public int getZOrder()
      Returns the z-order of this pathway element. NB: Anchor z-order is always z-order of parent line +1. This is because z-order is not written out to the gpml file.
      Specified by:
      getZOrder in interface Drawable
      Returns:
      zOrder the order of this pathway element.
    • setZOrder

      public void setZOrder​(int v)
      Do nothing. Anchor z-order is always z-order of parent line +1. This is because z-order is not written out to the gpml file.
      Specified by:
      setZOrder in interface Drawable
      Parameters:
      v - the input
    • getLinkableFroms

      public java.util.Set<GraphLink.LinkableFrom> getLinkableFroms()
      Returns GraphLink.LinkableFrom pathway elements, at this time that only goes for LineElement.LinePoint, for this GraphLink.LinkableTo pathway element.
      Specified by:
      getLinkableFroms in interface GraphLink.LinkableTo
      Returns:
      the LinkableFrom line points.
    • unsetAllLinkableFroms

      public void unsetAllLinkableFroms()
      Removes links from all GraphLink.LinkableFrom line points to this GraphLink.LinkableTo pathway element.
    • toAbsoluteCoordinate

      public java.awt.geom.Point2D toAbsoluteCoordinate​(java.awt.geom.Point2D p)
      Returns the absolute coordinate as a Point2D.
      Specified by:
      toAbsoluteCoordinate in interface Drawable
      Specified by:
      toAbsoluteCoordinate in interface GraphLink.LinkableTo
      Parameters:
      p - the point2d coordinate.
      Returns:
      the absolute coordinate as point2d.
    • toRelativeCoordinate

      public java.awt.geom.Point2D toRelativeCoordinate​(java.awt.geom.Point2D p)
      Returns the relative coordinate as a Point2D.
      Specified by:
      toRelativeCoordinate in interface Drawable
      Specified by:
      toRelativeCoordinate in interface GraphLink.LinkableTo
      Parameters:
      p - a point in absolute model coordinates
      Returns:
      the relative coordinate as point2d.
    • terminate

      protected void terminate()
      Terminates this anchor and removes all links and references.
      Overrides:
      terminate in class PathwayObject