Package org.pathvisio.libgpml.model
Class LineElement
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
org.pathvisio.libgpml.model.LineElement
- All Implemented Interfaces:
java.lang.Cloneable
,ConnectorRestrictions
,Drawable
,Groupable
,Referenceable
,Referenceable.Annotatable
,Referenceable.Citable
,Referenceable.Evidenceable
- Direct Known Subclasses:
GraphicalLine
,Interaction
public abstract class LineElement extends PathwayElement implements Groupable, ConnectorRestrictions
This abstract class stores information for a Line pathway element, e.g.
GraphicalLine
or Interaction
.- Author:
- finterly
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
LineElement.Anchor
This class stores information for an Anchor pathway element.class
LineElement.GenericPoint
Abstract class of generic point, extended byLineElement.LinePoint
andLineElement.Anchor
.class
LineElement.LinePoint
This class stores information for a Point pathway element.Nested classes/interfaces inherited from class org.pathvisio.libgpml.model.PathwayElement
PathwayElement.AnnotationRef, PathwayElement.CitationRef, PathwayElement.Comment, PathwayElement.EvidenceRef, PathwayElement.InfoRef
Nested classes/interfaces inherited from interface org.pathvisio.libgpml.model.Referenceable
Referenceable.Annotatable, Referenceable.Citable, Referenceable.Evidenceable
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<LineElement.Anchor>
anchors
private ConnectorType
connectorType
private ArrowHeadType
endArrowHeadType
private Group
groupRef
private java.awt.Color
lineColor
private java.util.List<LineElement.LinePoint>
linePoints
private LineStyleType
lineStyle
private double
lineWidth
(package private) ConnectorShape
shape
private ArrowHeadType
startArrowHeadType
private int
zOrder
Fields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel
Fields inherited from interface org.pathvisio.libgpml.model.connector.ConnectorRestrictions
SIDE_EAST, SIDE_NORTH, SIDE_SOUTH, SIDE_WEST
-
Constructor Summary
Constructors Constructor Description LineElement()
Instantiates a line pathway element. -
Method Summary
Modifier and Type Method Description LineElement.Anchor
addAnchor(double position, AnchorShapeType anchorShapeType)
Adds a new anchor to this line at the given position with anchorShapeType property.LineElement.Anchor
addAnchor(java.lang.String elementId, double position, AnchorShapeType anchorShapeType)
Creates and adds a new anchor to this line at the given position with anchorShapeType property.void
addAnchor(LineElement.Anchor anchor)
Adds given anchor to anchors list.private void
addLinePoints(java.util.List<LineElement.LinePoint> points)
Adds all given points to the linePoints list.void
adjustWayPointPreferences(ConnectorShape.WayPoint[] waypoints)
private boolean
almostPerfectAlignment(int side)
Check if either the line segment has less than or equal to 10 degree alignment with the side passedvoid
copyValuesFrom(LineElement src)
Copies values from the given source pathway element.private ConnectorShape.Segment
findAnchorSegment(LineElement attLine, double pos)
java.util.List<LineElement.Anchor>
getAnchors()
Get the anchors for this line.private int
getAttachedLineDirection(LineElement.Anchor anchor)
java.awt.geom.Rectangle2D
getBounds()
Returns the rectangular bounds for this line pathway element.double
getCenterX()
Returns the center x coordinate of the bounding box around (start, end) this line pathway element.double
getCenterY()
Returns the center y coordinate of the bounding box around (start, end) this line pathway element.private int
getClockwisePerpendicularSide(int side)
Returns the Perpendicular for a SIDE_* constant (e.g.ConnectorShape
getConnectorShape()
The Connector Shape for this line - the connector shape can calculate a Shape based on the connector type (straight, elbow or curved) and possibly way pointsConnectorType
getConnectorType()
Returns the value of the connectorType property.private int
getDirectionX()
returns the sign of end.x - start.xprivate int
getDirectionY()
returns the sign of end.y - start.yArrowHeadType
getEndArrowHeadType()
Returns the arrowHead property of the end point.GraphLink.LinkableTo
getEndElementRef()
Returns the elementRef of the end point.LineElement.LinePoint
getEndLinePoint()
Returns the end (last) point of points list.double
getEndLinePointX()
Returns the x coordinate of the end point.double
getEndLinePointY()
Returns the y coordinate of the end point.java.awt.geom.Point2D
getEndPoint2D()
converts end point from MPoint to Point2Dint
getEndSide()
Calculate on which side of a PathwayElement (SIDE_NORTH, SIDE_EAST, SIDE_SOUTH or SIDE_WEST) the end of this line is connected to.Group
getGroupRef()
Returns the parent group of this pathway element.double
getHeight()
Calculates and returns the height of the bounding box around (start, end) this line pathway element.double
getLeft()
Returns the left x coordinate of the bounding box around (start, end) this line pathway element.java.awt.Color
getLineColor()
Returns the color of a line.java.util.List<LineElement.LinePoint>
getLinePoints()
Get the points for this line.LineStyleType
getLineStyle()
Returns the visual appearance of a line, e.g.double
getLineWidth()
Returns the pixel value for the width of a line.private int
getOppositeSide(int side)
Returns the opposite for a SIDE_* constant (e.g.java.util.List<java.awt.geom.Point2D>
getPoints2D()
converts all points from MPoint to Point2Djava.awt.geom.Rectangle2D
getRotatedBounds()
Returns the rectangular bounds of this line pathway elements.private static int
getSide(double relX, double relY)
private static int
getSide(double x, double y, double cx, double cy)
Get the side of the given pathway element to which the x and y coordinates connectArrowHeadType
getStartArrowHeadType()
Returns the arrowHead property of the start point.GraphLink.LinkableTo
getStartElementRef()
Returns the elementRef of the end point.LineElement.LinePoint
getStartLinePoint()
Returns the start (first) point of points list.double
getStartLinePointX()
Returns the x coordinate of the start point.double
getStartLinePointY()
Returns the y coordinate of the start point.java.awt.geom.Point2D
getStartPoint2D()
converts start point from MPoint to Point2Dint
getStartSide()
Calculate on which side of a PathwayElement (SIDE_NORTH, SIDE_EAST, SIDE_SOUTH or SIDE_WEST) the start of this line is connected to.java.lang.Object
getStaticProperty(StaticProperty key)
Returns static property value for given key.java.util.Set<StaticProperty>
getStaticPropertyKeys()
Returns all static properties for this pathway object.double
getTop()
Returns the top y coordinate of the bounding box around (start, end) this line pathway element.ConnectorShape.WayPoint[]
getWayPointPreferences()
Get the preferred waypoints, to which the connector must draw it's path.double
getWidth()
Calculates and returns the width of the bounding box around (start, end) this line pathway element.int
getZOrder()
Returns the z-order of this pathway element.boolean
hasAnchor(LineElement.Anchor anchor)
Checks whether anchors has the given anchor.boolean
hasGroupRef()
Checks whether this pathway element belongs to a group.java.awt.geom.Rectangle2D
mayCross(java.awt.geom.Point2D point)
Check if the connector may cross this point Optionally, returns a shape that defines the boundaries of the area around this point that the connector may not cross.void
removeAnchor(LineElement.Anchor anchor)
Removes given anchor from the anchors list.private void
removeAnchors()
Removes all anchors from the anchors list.private void
removeLinePoints(java.util.List<LineElement.LinePoint> toRemove)
Removes all points from the given line points list.void
resetWayPointPreferences()
void
setCenterX(double v)
Sets the x position of the center of the line.void
setCenterY(double v)
Sets the y position of the center of the line.void
setConnectorType(ConnectorType v)
Sets the value of the connectorType property.void
setEndArrowHeadType(ArrowHeadType value)
Sets the arrow head type of the end point.void
setEndElementRef(GraphLink.LinkableTo elementRef)
Sets the elementRef for the end point.void
setEndLinePoint(LineElement.LinePoint linePoint)
Sets end linePoint coordinates to the coordinates of the given linePoint.void
setEndLinePointX(double v)
Sets the x coordinate of the end point.void
setEndLinePointY(double v)
Sets the y coordinate of the end point.private void
setGroupRef(Group v)
Sets the parent group for this pathway element.void
setGroupRefTo(Group v)
Verifies if given parent group is new and valid.void
setLeft(double v)
Sets the position of the left side of the rectangular bounds of the linevoid
setLineColor(java.awt.Color v)
Sets the color of a line.void
setLinePoints(java.util.List<LineElement.LinePoint> points)
Sets linePoints to the given list of LinePoints.void
setLineStyle(LineStyleType v)
Sets the visual appearance of a line, e.g.void
setLineWidth(double v)
Sets the pixel value for the width of a line.protected void
setPathwayModelTo(PathwayModel pathwayModel)
Sets the pathway model for this pathway element.void
setStartArrowHeadType(ArrowHeadType value)
Sets the arrow head type of the start point.void
setStartElementRef(GraphLink.LinkableTo elementRef)
Sets the elementRef for the start point.void
setStartLinePoint(LineElement.LinePoint linePoint)
Sets start linePoint coordinates to the coordinates of the given linePoint.void
setStartLinePointX(double v)
Sets the x coordinate of the start point.void
setStartLinePointY(double v)
Sets the y coordinate of the start point.void
setStaticProperty(StaticProperty key, java.lang.Object value)
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g.void
setTop(double v)
Sets the position of the top side of the rectangular bounds of the linevoid
setZOrder(int v)
Sets the z-order of this pathway element.protected void
terminate()
Terminates this LineElement.java.awt.geom.Point2D
toAbsoluteCoordinate(java.awt.geom.Point2D p)
Converts a point to pathway coordinates (relative to the pathway).java.awt.geom.Point2D
toRelativeCoordinate(java.awt.geom.Point2D mp)
Converts a point to shape coordinates (relative to the bounds of the object)void
unsetGroupRef()
Unsets the parent group, if any, from this pathway element.Methods inherited from class org.pathvisio.libgpml.model.PathwayElement
addAnnotation, addAnnotation, addAnnotation, addCitation, addCitation, addCitation, addComment, addComment, addEvidence, addEvidence, addEvidence, copy, copyReferencesFrom, copyValuesFrom, findComment, getAnnotationRefs, getCitationRefs, getComments, getDynamicProperties, getDynamicProperty, getDynamicPropertyKeys, getEvidenceRefs, getPropertyEx, getPropertyKeys, hasAnnotationRef, hasCitationRef, hasEvidenceRef, removeAnnotationRef, removeAnnotationRefs, removeCitationRef, removeCitationRefs, removeComment, removeEvidenceRef, removeEvidenceRefs, setComments, setDynamicProperty, setPropertyEx
Methods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getObjectType, getPathwayModel, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, 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
getObjectType, getPathwayModel
-
Field Details
-
startArrowHeadType
-
endArrowHeadType
-
groupRef
-
linePoints
-
anchors
-
lineColor
private java.awt.Color lineColor -
lineStyle
-
lineWidth
private double lineWidth -
connectorType
-
zOrder
private int zOrder -
shape
ConnectorShape shape
-
-
Constructor Details
-
LineElement
public LineElement()Instantiates a line pathway element. NB: Property groupRef is to be set bysetGroupRefTo(Group)
. In GPML, groupRef refers to the elementId (formerly groupId) of the parent gpml:Group. Note, a group can also belong in another group. Graphics properties have default values and can be set after a line pathway element is already instantiated.
-
-
Method Details
-
getStartArrowHeadType
Returns the arrowHead property of the start point. Arrowhead specifies the glyph at the ends of graphical lines and interactions. Intermediate points have arrowhead type UNDIRECTED (the absence of an arrowhead).- Returns:
- startArrowHeadType the arrow head type.
-
setStartArrowHeadType
Sets the arrow head type of the start point.- Parameters:
value
- the arrow head type to set.
-
getEndArrowHeadType
Returns the arrowHead property of the end point. Arrowhead specifies the glyph at the ends of graphical lines and interactions. Intermediate points have arrowhead type UNDIRECTED (the absence of an arrowhead).- Returns:
- endArrowHeadType the arrow head type.
-
setEndArrowHeadType
Sets the arrow head type of the end point.- Parameters:
value
- the arrow head type to set.
-
getGroupRef
Returns the parent group of this pathway element. In GPML, groupRef refers to the elementId (formerly groupId) of the parent gpml:Group.- Specified by:
getGroupRef
in interfaceGroupable
- Returns:
- groupRef the parent group of this pathway element.
-
hasGroupRef
public boolean hasGroupRef()Checks whether this pathway element belongs to a group.- Specified by:
hasGroupRef
in interfaceGroupable
- Returns:
- true if and only if the group of this pathway element is effective.
-
setGroupRefTo
Verifies if given parent group is new and valid. Sets the parent group of this pathway element. Adds this pathway element to the the pathwayElements list of the new parent group. If there is an old parent group, this pathway element is removed from its pathwayElements list.- Specified by:
setGroupRefTo
in interfaceGroupable
- Parameters:
v
- the new parent group to set.
-
setGroupRef
Sets the parent group for this pathway element.- Parameters:
v
- the given group to set.
-
unsetGroupRef
public void unsetGroupRef()Unsets the parent group, if any, from this pathway element.- Specified by:
unsetGroupRef
in interfaceGroupable
-
getLinePoints
Get the points for this line.- Returns:
- points the list of points, an empty list if no anchors are defined.
-
setLinePoints
Sets linePoints to the given list of LinePoints. Removes old pointsremoveLinePoints(java.util.List<org.pathvisio.libgpml.model.LineElement.LinePoint>)
, if any, then adds new pointsaddLinePoints(java.util.List<org.pathvisio.libgpml.model.LineElement.LinePoint>)
. In the case of updating waypoints, start and end line points are preserved and should not be removed.- Parameters:
points
- the list of points to set.
-
addLinePoints
Adds all given points to the linePoints list. Adds each point to the pathway modelPathwayModel.addPathwayObject(org.pathvisio.libgpml.model.PathwayObject)
if applicable. This method is called only bysetLinePoints(java.util.List<org.pathvisio.libgpml.model.LineElement.LinePoint>)
.- Parameters:
points
- the points to add to pathway model..
-
removeLinePoints
Removes all points from the given line points list.NB:
- Called from
setLinePoints(java.util.List<org.pathvisio.libgpml.model.LineElement.LinePoint>)
. For which in some cases, start and end line points are preserved and should not be removed. - When this line element is terminated
terminate()
, all points of linePoints list are removed.
- Parameters:
toRemove
- the list of points to remove.
- Called from
-
getAnchors
Get the anchors for this line.- Returns:
- anchors the list of anchors, an empty list if no anchors are defined.
-
hasAnchor
Checks whether anchors has the given anchor.- Parameters:
anchor
- the anchor to look for.- Returns:
- true if has anchor, false otherwise.
-
addAnchor
Adds given anchor to anchors list. Sets lineElement for the given anchor.- Parameters:
anchor
- the anchor to be added.
-
addAnchor
Adds a new anchor to this line at the given position with anchorShapeType property. CallsaddAnchor(Anchor anchor)
.- Parameters:
position
- the relative position on the line, between 0 (start) to 1 (end).anchorShapeType
- the shape type of the anchor.
-
addAnchor
public LineElement.Anchor addAnchor(java.lang.String elementId, double position, AnchorShapeType anchorShapeType)Creates and adds a new anchor to this line at the given position with anchorShapeType property. Anchor elementId is set immediately after creation. This method is used when reading gpml.CallsaddAnchor(Anchor anchor)
.- Parameters:
elementId
- the elementId to set for created anchor.position
- the relative position on the line, between 0 (start) to 1 (end).anchorShapeType
- the shape type of the anchor.
-
removeAnchor
Removes given anchor from the anchors list. Anchor ceases to exist and is terminated.- Parameters:
anchor
- the anchor to be removed.
-
removeAnchors
private void removeAnchors()Removes all anchors from the anchors list. -
getLineColor
public java.awt.Color getLineColor()Returns the color of a line.- Returns:
- lineColor the color of a line.
-
setLineColor
public void setLineColor(java.awt.Color v)Sets the color of a line.- Parameters:
v
- the color of a line.- Throws:
java.lang.IllegalArgumentException
- if color null.
-
getLineStyle
Returns the visual appearance of a line, e.g. Solid or Broken.- Returns:
- lineStyle the style of a line.
-
setLineStyle
Sets the visual appearance of a line, e.g. Solid or Broken.- Parameters:
v
- the line style to set.- Throws:
java.lang.IllegalArgumentException
- if lineStyle null.
-
getLineWidth
public double getLineWidth()Returns the pixel value for the width of a line.- Returns:
- lineWidth the width of a line.
-
setLineWidth
public void setLineWidth(double v)Sets the pixel value for the width of a line.- Parameters:
v
- the width of a line.- Throws:
java.lang.IllegalArgumentException
- if lineWidth is a negative value.
-
getConnectorType
Returns the value of the connectorType property. Specifies a set of rules to govern layout of Graphical Lines and Interactions. PathVisio (Java): Line Type and GPML: ConnectorType e.g. Curved, Elbow, Straight- Returns:
- connectorType the layout of a line.
-
setConnectorType
Sets the value of the connectorType property. Specifies a set of rules to govern layout of Graphical Lines and Interactions. PathVisio (Java): Line Type and GPML: ConnectorType e.g. Curved, Elbow, Straight- Parameters:
v
- the layout of a line.- Throws:
java.lang.IllegalArgumentException
- if ConnectorType null.
-
getZOrder
public int getZOrder()Returns the z-order of this pathway element. -
setZOrder
public void setZOrder(int v)Sets the z-order of this pathway element. -
getStartLinePoint
Returns the start (first) point of points list.- Returns:
- the first point of points list.
-
setStartLinePoint
Sets start linePoint coordinates to the coordinates of the given linePoint.- Parameters:
linePoint
- the given line point.
-
getEndLinePoint
Returns the end (last) point of points list.- Returns:
- the last point of points list.
-
setEndLinePoint
Sets end linePoint coordinates to the coordinates of the given linePoint.- Parameters:
linePoint
- the given line point.
-
getStartLinePointX
public double getStartLinePointX()Returns the x coordinate of the start point.- Returns:
- the x coordinate of the start point.
-
setStartLinePointX
public void setStartLinePointX(double v)Sets the x coordinate of the start point.- Parameters:
v
- the value to set.
-
getStartLinePointY
public double getStartLinePointY()Returns the y coordinate of the start point.- Returns:
- the y coordinate of the start point.
-
setStartLinePointY
public void setStartLinePointY(double v)Sets the y coordinate of the start point.- Parameters:
v
- the value to set.
-
getEndLinePointX
public double getEndLinePointX()Returns the x coordinate of the end point.- Returns:
- the x coordinate of the end point.
-
setEndLinePointX
public void setEndLinePointX(double v)Sets the x coordinate of the end point.- Parameters:
v
- the value to set.
-
getEndLinePointY
public double getEndLinePointY()Returns the y coordinate of the end point.- Returns:
- the y coordinate of the end point.
-
setEndLinePointY
public void setEndLinePointY(double v)Sets the y coordinate of the end point.- Parameters:
v
- the value to set.
-
getStartElementRef
Returns the elementRef of the end point.- Returns:
- the elementRef linkableTo pathway element.
-
setStartElementRef
Sets the elementRef for the start point.- Parameters:
elementRef
- to link to.
-
getEndElementRef
Returns the elementRef of the end point.- Returns:
- the elementRef linkableTo pathway element.
-
setEndElementRef
Sets the elementRef for the end point.- Parameters:
elementRef
- to link to.
-
getStartPoint2D
public java.awt.geom.Point2D getStartPoint2D()converts start point from MPoint to Point2D- Specified by:
getStartPoint2D
in interfaceConnectorRestrictions
- Returns:
- the start point.
-
getEndPoint2D
public java.awt.geom.Point2D getEndPoint2D()converts end point from MPoint to Point2D- Specified by:
getEndPoint2D
in interfaceConnectorRestrictions
- Returns:
- the end point.
-
getPoints2D
public java.util.List<java.awt.geom.Point2D> getPoints2D()converts all points from MPoint to Point2D -
getRotatedBounds
public java.awt.geom.Rectangle2D getRotatedBounds()Returns the rectangular bounds of this line pathway elements. This method simply callsgetBounds()
because lines do not have property rotation.- Specified by:
getRotatedBounds
in interfaceGroupable
- Returns:
- the rectangular bounds for this line pathway element.
-
getBounds
public java.awt.geom.Rectangle2D getBounds()Returns the rectangular bounds for this line pathway element. The bounds for a line is calculated from its ends points (first and last). -
getCenterX
public double getCenterX()Returns the center x coordinate of the bounding box around (start, end) this line pathway element.- Specified by:
getCenterX
in interfaceGroupable
- Returns:
- the center x coordinate.
-
setCenterX
public void setCenterX(double v)Sets the x position of the center of the line. This makes the line move as a whole- Specified by:
setCenterX
in interfaceGroupable
- Parameters:
v
- the center x coordinate to set.
-
getCenterY
public double getCenterY()Returns the center y coordinate of the bounding box around (start, end) this line pathway element.- Specified by:
getCenterY
in interfaceGroupable
- Returns:
- the center y coordinate
-
setCenterY
public void setCenterY(double v)Sets the y position of the center of the line. This makes the line move as a whole.- Specified by:
setCenterY
in interfaceGroupable
- Parameters:
v
- the center y coordinate to set.
-
getWidth
public double getWidth()Calculates and returns the width of the bounding box around (start, end) this line pathway element. -
getHeight
public double getHeight()Calculates and returns the height of the bounding box around (start, end) this line pathway element. -
getLeft
public double getLeft()Returns the left x coordinate of the bounding box around (start, end) this line pathway element. -
setLeft
public void setLeft(double v)Sets the position of the left side of the rectangular bounds of the line -
getTop
public double getTop()Returns the top y coordinate of the bounding box around (start, end) this line pathway element. -
setTop
public void setTop(double v)Sets the position of the top side of the rectangular bounds of the line -
getDirectionX
private int getDirectionX()returns the sign of end.x - start.x -
getDirectionY
private int getDirectionY()returns the sign of end.y - start.y -
toAbsoluteCoordinate
public java.awt.geom.Point2D toAbsoluteCoordinate(java.awt.geom.Point2D p)Description copied from interface:Groupable
Converts a point to pathway coordinates (relative to the pathway).- Specified by:
toAbsoluteCoordinate
in interfaceDrawable
- Specified by:
toAbsoluteCoordinate
in interfaceGroupable
- Parameters:
p
-- Returns:
-
toRelativeCoordinate
public java.awt.geom.Point2D toRelativeCoordinate(java.awt.geom.Point2D mp)Description copied from interface:Groupable
Converts a point to shape coordinates (relative to the bounds of the object)- Specified by:
toRelativeCoordinate
in interfaceDrawable
- Specified by:
toRelativeCoordinate
in interfaceGroupable
- Parameters:
mp
- a point in absolute model coordinates- Returns:
- the same point relative to the bounding box of this pathway element: -1,-1 meaning the top-left corner, 1,1 meaning the bottom right corner, and 0,0 meaning the center.
-
getConnectorShape
The Connector Shape for this line - the connector shape can calculate a Shape based on the connector type (straight, elbow or curved) and possibly way points -
getStartSide
public int getStartSide()Calculate on which side of a PathwayElement (SIDE_NORTH, SIDE_EAST, SIDE_SOUTH or SIDE_WEST) the start of this line is connected to. If the start is not connected to anything, returns SIDE_WEST- Specified by:
getStartSide
in interfaceConnectorRestrictions
- Returns:
- The side, one of the SIDE_* constants
-
getEndSide
public int getEndSide()Calculate on which side of a PathwayElement (SIDE_NORTH, SIDE_EAST, SIDE_SOUTH or SIDE_WEST) the end of this line is connected to. If the end is not connected to anything, returns SIDE_EAST- Specified by:
getEndSide
in interfaceConnectorRestrictions
- Returns:
- The side, one of the SIDE_* constants
-
getAttachedLineDirection
-
findAnchorSegment
-
almostPerfectAlignment
private boolean almostPerfectAlignment(int side)Check if either the line segment has less than or equal to 10 degree alignment with the side passed- Parameters:
side
-- Returns:
- true if less or equal to 10 degree alignment else false
-
getClockwisePerpendicularSide
private int getClockwisePerpendicularSide(int side)Returns the Perpendicular for a SIDE_* constant (e.g. SIDE_EAST, SIDE_WEST) -
adjustWayPointPreferences
-
resetWayPointPreferences
public void resetWayPointPreferences() -
getWayPointPreferences
Get the preferred waypoints, to which the connector must draw it's path. The waypoints returned by this method are preferences and the connector shape may decide not to use them if they are invalid.- Specified by:
getWayPointPreferences
in interfaceConnectorRestrictions
-
getSide
private static int getSide(double x, double y, double cx, double cy)Get the side of the given pathway element to which the x and y coordinates connect- Parameters:
x
- the x coordinatey
- the y coordinatecx
-cy
- // e The element to find the side of- Returns:
- One of the SIDE_* constants
-
getSide
private static int getSide(double relX, double relY) -
getOppositeSide
private int getOppositeSide(int side)Returns the opposite for a SIDE_* constant (e.g. SIDE_EAST, SIDE_WEST) -
mayCross
public java.awt.geom.Rectangle2D mayCross(java.awt.geom.Point2D point)Check if the connector may cross this point Optionally, returns a shape that defines the boundaries of the area around this point that the connector may not cross. This method can be used for advanced connectors that route along other objects on the drawing- Specified by:
mayCross
in interfaceConnectorRestrictions
- Parameters:
point
- the point to check.- Returns:
- A shape that defines the boundaries of the area around this point that the connector may not cross. Returning null is allowed for implementing classes.
-
setPathwayModelTo
protected void setPathwayModelTo(PathwayModel pathwayModel) throws java.lang.IllegalArgumentException, java.lang.IllegalStateExceptionSets the pathway model for this pathway element. NB: Only set when a pathway model adds this pathway element. NB: This method is not used directly. It is called byPathwayModel.addPathwayObject(org.pathvisio.libgpml.model.PathwayObject)
.- Overrides:
setPathwayModelTo
in classPathwayObject
- Parameters:
pathwayModel
- the parent pathway model.- Throws:
java.lang.IllegalArgumentException
java.lang.IllegalStateException
-
terminate
protected void terminate()Terminates this LineElement. The pathway model, if any, is unset from this anchor.Links to all annotationRefs, citationRefs, and evidenceRefs are removed from this data node.- Overrides:
terminate
in classPathwayElement
-
copyValuesFrom
Copies values from the given source pathway element.NB:
- GroupRef is not copied, but can be set later if the parent group and all other pathway element members are copied.
- Parameters:
src
- the source pathway element.
-
getStaticPropertyKeys
Returns all static properties for this pathway object.- Overrides:
getStaticPropertyKeys
in classPathwayElement
- Returns:
- result the set of static property for this pathway object.
-
getStaticProperty
Returns static property value for given key.- Overrides:
getStaticProperty
in classPathwayElement
- Parameters:
key
- the key.- Returns:
- the static property value.
-
setStaticProperty
This works so that o.setNotes(x) is the equivalent of o.setProperty("Notes", x); Value may be null in some cases, e.g. graphRef- Overrides:
setStaticProperty
in classPathwayElement
- Parameters:
key
- the key.value
- the property value.
-