Package org.pathvisio.libgpml.model
Class LineElement.Anchor
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.LineElement.GenericPoint
org.pathvisio.libgpml.model.LineElement.Anchor
- 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 Summary
Fields Modifier and Type Field Description private doublepositionprivate AnchorShapeTypeshapeTypeFields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel -
Constructor Summary
Constructors Modifier Constructor Description privateAnchor(double position, AnchorShapeType shapeType)Instantiates an Anchor pathway element. -
Method Summary
Modifier and Type Method Description java.util.Set<GraphLink.LinkableFrom>getLinkableFroms()ReturnsGraphLink.LinkableFrompathway elements, at this time that only goes forLineElement.LinePoint, for thisGraphLink.LinkableTopathway element.ObjectTypegetObjectType()Returns the object type of this pathway element.doublegetPosition()Returns the proportional distance of an anchor along the line it belongs to, between 0 and 1.AnchorShapeTypegetShapeType()Returns the visual representation of an anchor, e.g., none, square.intgetZOrder()Returns the z-order of this pathway element.voidsetPosition(double v)Sets the proportional distance of an anchor along the line it belongs to, between 0 and 1.voidsetShapeType(AnchorShapeType v)Sets the shapeType for given anchor pathway element.voidsetZOrder(int v)Do nothing.protected voidterminate()Terminates this anchor and removes all links and references.java.awt.geom.Point2DtoAbsoluteCoordinate(java.awt.geom.Point2D p)Returns the absolute coordinate as aPoint2D.java.awt.geom.Point2DtoRelativeCoordinate(java.awt.geom.Point2D p)Returns the relative coordinate as aPoint2D.voidunsetAllLinkableFroms()Removes links from allGraphLink.LinkableFromline points to thisGraphLink.LinkableTopathway element.Methods inherited from class org.pathvisio.libgpml.model.LineElement.GenericPoint
getLineElement, setPathwayModelToMethods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getPathwayModel, getPropertyEx, getPropertyKeys, getStaticProperty, getStaticPropertyKeys, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, setPropertyEx, setStaticProperty, unsetPathwayModelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pathvisio.libgpml.model.Drawable
getPathwayModelMethods inherited from interface org.pathvisio.libgpml.model.GraphLink.LinkableTo
getElementId
-
Field Details
-
position
private double position -
shapeType
-
-
Constructor Details
-
Anchor
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
Returns the object type of this pathway element.- Specified by:
getObjectTypein interfaceDrawable- Specified by:
getObjectTypein interfaceGraphLink.LinkableTo- Specified by:
getObjectTypein classPathwayObject- 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
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
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. -
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. -
getLinkableFroms
ReturnsGraphLink.LinkableFrompathway elements, at this time that only goes forLineElement.LinePoint, for thisGraphLink.LinkableTopathway element.- Specified by:
getLinkableFromsin interfaceGraphLink.LinkableTo- Returns:
- the LinkableFrom line points.
-
unsetAllLinkableFroms
public void unsetAllLinkableFroms()Removes links from allGraphLink.LinkableFromline points to thisGraphLink.LinkableTopathway element. -
toAbsoluteCoordinate
public java.awt.geom.Point2D toAbsoluteCoordinate(java.awt.geom.Point2D p)Returns the absolute coordinate as aPoint2D.- Specified by:
toAbsoluteCoordinatein interfaceDrawable- Specified by:
toAbsoluteCoordinatein interfaceGraphLink.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 aPoint2D.- Specified by:
toRelativeCoordinatein interfaceDrawable- Specified by:
toRelativeCoordinatein interfaceGraphLink.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:
terminatein classPathwayObject
-