Package org.pathvisio.libgpml.model
Interface Groupable
- All Superinterfaces:
Drawable
- All Known Implementing Classes:
DataNode
,DataNode.State
,GraphicalLine
,Group
,Interaction
,Label
,LineElement
,Shape
,ShapedElement
public interface Groupable extends Drawable
Interface for classes which can belong in a
Group
. This class is
implemented by ShapedElement
and LineElement
.- Author:
- finterly
-
Method Summary
Modifier and Type Method Description java.awt.geom.Rectangle2D
getBounds()
Get the rectangular bounds of the object without rotation taken into account.double
getCenterX()
Returns the center x coordinate of the bounding box around (start, end) this pathway element.double
getCenterY()
Returns the center y coordinate of the bounding box around (start, end) this pathway element.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 pathway element.double
getLeft()
Returns the left x coordinate of the bounding box around (start, end) this pathway element.java.awt.geom.Rectangle2D
getRotatedBounds()
Returns the rectangular bounds of the object after rotation is applied.double
getTop()
Returns the top y coordinate of the bounding box around (start, end) this pathway element.double
getWidth()
Calculates and returns the width of the bounding box around (start, end) this pathway element.boolean
hasGroupRef()
Checks whether this pathway element belongs to a group.void
setCenterX(double v)
Sets the x position of the center of the pathway element.void
setCenterY(double v)
Sets the y position of the center of the pathway element.void
setGroupRefTo(Group groupRef)
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 pathway element.void
setTop(double v)
Sets the position of the top side of the rectangular bounds of the pathway element.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 p)
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 interface org.pathvisio.libgpml.model.Drawable
getObjectType, getPathwayModel, getZOrder, setZOrder
-
Method Details
-
getGroupRef
Group getGroupRef()Returns the parent group of this pathway element. In GPML, groupRef refers to the elementId (formerly groupId) of the parent gpml:Group.- Returns:
- groupRef the parent group of this pathway element.
-
hasGroupRef
boolean hasGroupRef()Checks whether this pathway element belongs to a group.- 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 the 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.- Parameters:
groupRef
- the new parent group to set.
-
unsetGroupRef
void unsetGroupRef()Unsets the parent group, if any, from this pathway element. -
getRotatedBounds
java.awt.geom.Rectangle2D getRotatedBounds()Returns the rectangular bounds of the object after rotation is applied.- Returns:
- rectangle2d the rectangular bounds.
-
getBounds
java.awt.geom.Rectangle2D getBounds()Get the rectangular bounds of the object without rotation taken into account.- Returns:
- rectangle2d the rectangular bounds.
-
getCenterX
double getCenterX()Returns the center x coordinate of the bounding box around (start, end) this pathway element.- Returns:
- the center x coordinate.
-
setCenterX
void setCenterX(double v)Sets the x position of the center of the pathway element.- Parameters:
v
- the center x coordinate to set.
-
getCenterY
double getCenterY()Returns the center y coordinate of the bounding box around (start, end) this pathway element.- Returns:
- the center y coordinate
-
setCenterY
void setCenterY(double v)Sets the y position of the center of the pathway element.- Parameters:
v
- the center y coordinate to set.
-
getWidth
double getWidth()Calculates and returns the width of the bounding box around (start, end) this pathway element.- Returns:
- width the width.
-
getHeight
double getHeight()Calculates and returns the height of the bounding box around (start, end) this pathway element.- Returns:
- height the height.
-
getLeft
double getLeft()Returns the left x coordinate of the bounding box around (start, end) this pathway element.- Returns:
- left the left x coordinate.
-
setLeft
void setLeft(double v)Sets the position of the left side of the rectangular bounds of the pathway element.- Parameters:
v
- the left x coordinate to set.
-
getTop
double getTop()Returns the top y coordinate of the bounding box around (start, end) this pathway element.- Returns:
- the top y coordinate.
-
setTop
void setTop(double v)Sets the position of the top side of the rectangular bounds of the pathway element.- Parameters:
v
- the top y coordinate to set.
-
toAbsoluteCoordinate
java.awt.geom.Point2D toAbsoluteCoordinate(java.awt.geom.Point2D p)Converts a point to pathway coordinates (relative to the pathway).- Specified by:
toAbsoluteCoordinate
in interfaceDrawable
- Parameters:
p
- the point2d.- Returns:
- the absolute point2d coordinate.
-
toRelativeCoordinate
java.awt.geom.Point2D toRelativeCoordinate(java.awt.geom.Point2D p)Converts a point to shape coordinates (relative to the bounds of the object)- Specified by:
toRelativeCoordinate
in interfaceDrawable
- Parameters:
p
- 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.
-