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 double
position
private AnchorShapeType
shapeType
Fields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel
-
Constructor Summary
Constructors Modifier Constructor Description private
Anchor(double position, AnchorShapeType shapeType)
Instantiates an Anchor pathway element. -
Method Summary
Modifier and Type Method Description java.util.Set<GraphLink.LinkableFrom>
getLinkableFroms()
ReturnsGraphLink.LinkableFrom
pathway elements, at this time that only goes forLineElement.LinePoint
, for thisGraphLink.LinkableTo
pathway element.ObjectType
getObjectType()
Returns the object type of this pathway element.double
getPosition()
Returns the proportional distance of an anchor along the line it belongs to, between 0 and 1.AnchorShapeType
getShapeType()
Returns the visual representation of an anchor, e.g., none, square.int
getZOrder()
Returns the z-order of this pathway element.void
setPosition(double v)
Sets the proportional distance of an anchor along the line it belongs to, between 0 and 1.void
setShapeType(AnchorShapeType v)
Sets the shapeType for given anchor pathway element.void
setZOrder(int v)
Do nothing.protected void
terminate()
Terminates this anchor and removes all links and references.java.awt.geom.Point2D
toAbsoluteCoordinate(java.awt.geom.Point2D p)
Returns the absolute coordinate as aPoint2D
.java.awt.geom.Point2D
toRelativeCoordinate(java.awt.geom.Point2D p)
Returns the relative coordinate as aPoint2D
.void
unsetAllLinkableFroms()
Removes links from allGraphLink.LinkableFrom
line points to thisGraphLink.LinkableTo
pathway element.Methods inherited from class org.pathvisio.libgpml.model.LineElement.GenericPoint
getLineElement, setPathwayModelTo
Methods 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, unsetPathwayModel
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.pathvisio.libgpml.model.Drawable
getPathwayModel
Methods 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:
getObjectType
in interfaceDrawable
- Specified by:
getObjectType
in interfaceGraphLink.LinkableTo
- Specified by:
getObjectType
in 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.LinkableFrom
pathway elements, at this time that only goes forLineElement.LinePoint
, for thisGraphLink.LinkableTo
pathway element.- Specified by:
getLinkableFroms
in interfaceGraphLink.LinkableTo
- Returns:
- the LinkableFrom line points.
-
unsetAllLinkableFroms
public void unsetAllLinkableFroms()Removes links from allGraphLink.LinkableFrom
line points to thisGraphLink.LinkableTo
pathway element. -
toAbsoluteCoordinate
public java.awt.geom.Point2D toAbsoluteCoordinate(java.awt.geom.Point2D p)Returns the absolute coordinate as aPoint2D
.- Specified by:
toAbsoluteCoordinate
in interfaceDrawable
- Specified by:
toAbsoluteCoordinate
in 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:
toRelativeCoordinate
in interfaceDrawable
- Specified by:
toRelativeCoordinate
in 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:
terminate
in classPathwayObject
-