Package org.pathvisio.libgpml.model
Class ShapedElement
java.lang.Object
org.pathvisio.libgpml.model.PathwayObject
org.pathvisio.libgpml.model.PathwayElement
org.pathvisio.libgpml.model.ShapedElement
- All Implemented Interfaces:
 java.lang.Cloneable,Drawable,GraphLink.LinkableTo,Groupable,Referenceable,Referenceable.Annotatable,Referenceable.Citable,Referenceable.Evidenceable
- Direct Known Subclasses:
 DataNode,DataNode.State,Group,Label,Shape
public abstract class ShapedElement extends PathwayElement implements GraphLink.LinkableTo, Groupable
This class stores information for shaped pathway element 
DataNode,
 DataNode.State, Label, Shape, and Group.- Author:
 - finterly
 
- 
Nested Class Summary
Nested classes/interfaces inherited from class org.pathvisio.libgpml.model.PathwayElement
PathwayElement.AnnotationRef, PathwayElement.CitationRef, PathwayElement.Comment, PathwayElement.EvidenceRef, PathwayElement.InfoRefNested 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.awt.ColorborderColorprivate LineStyleTypeborderStyleprivate doubleborderWidthprivate doublecenterXprivate doublecenterYprivate java.awt.ColorfillColorprivate booleanfontDecorationprivate java.lang.StringfontNameprivate doublefontSizeprivate booleanfontStrikethruprivate booleanfontStyleprivate booleanfontWeightprivate GroupgroupRefprivate HAlignTypehAlignprivate doubleheightprivate doublerotationprivate IShapeshapeTypeprivate java.awt.ColortextColorprivate VAlignTypevAlignprivate doublewidthprivate intzOrderFields inherited from class org.pathvisio.libgpml.model.PathwayObject
noFire, pathwayModel - 
Constructor Summary
Constructors Constructor Description ShapedElement()Instantiates a shaped pathway element. - 
Method Summary
Modifier and Type Method Description voidcopyValuesFrom(ShapedElement src)Copies values from the given source pathway element.java.awt.ColorgetBorderColor()Returns the border color of this shaped pathway element.LineStyleTypegetBorderStyle()Returns the visual appearance of a border, e.g.doublegetBorderWidth()Returns the pixel value for the border of this shaped pathway element.java.awt.geom.Rectangle2DgetBounds()Returns the rectangular bounds of this shaped pathway element without rotation taken into account.doublegetCenterX()Returns the center x coordinate for this shaped pathway element.doublegetCenterY()Returns the center y coordinate for this shaped pathway element.java.awt.ColorgetFillColor()Returns the color used to paint the area of this shaped pathway element., not including its border.booleangetFontDecoration()Returns the typographic style for underline or normal.java.lang.StringgetFontName()Returns the name of the set of printable text characters to be used for visualization, e.g., Arial.doublegetFontSize()Returns the point value for the size of the font.booleangetFontStrikethru()Returns the typographic style for strikethru or normal.booleangetFontStyle()Returns the typographic style applied to displayed text, e.g.booleangetFontWeight()Returns the thickness of the font used, a bold font would have more weight.GroupgetGroupRef()Returns the parent group of this pathway element.HAlignTypegetHAlign()Returns the horizontal alignment of displayed text, e.g., Left, Center, Right.doublegetHeight()Returns the height of this shaped pathway element.doublegetLeft()Returns the left x coordinate of the bounding box around (start, end) this shaped pathway element.java.util.Set<GraphLink.LinkableFrom>getLinkableFroms()ReturnsGraphLink.LinkableFrompathway elements, at this time that only goes forLineElement.LinePoint, for thisGraphLink.LinkableTopathway element.java.awt.geom.Rectangle2DgetRotatedBounds()Returns the rectangular bounds of this shaped pathway element after rotation is applied.doublegetRotation()Returns the rotation of this shaped pathway element.IShapegetShapeType()Returns the visual appearance of a two dimensional object, e.g.java.lang.ObjectgetStaticProperty(StaticProperty key)Returns static property value for given key.java.util.Set<StaticProperty>getStaticPropertyKeys()Returns all static properties for this pathway object.java.awt.ColorgetTextColor()Returns the color of text for this shaped pathway element..abstract java.lang.StringgetTextLabel()Returns text label for shaped pathway elements.doublegetTop()Returns the top y coordinate of the bounding box around (start, end) this shaped pathway element.VAlignTypegetVAlign()Returns the vertical alignment of displayed text, e.g., Top, Middle, Bottom.doublegetWidth()Returns the width of this shaped pathway element.intgetZOrder()Returns the z-order of this pathway element.booleanhasGroupRef()Checks whether this pathway element belongs to a group.voidsetBorderColor(java.awt.Color v)Sets the border color of this shaped pathway element.voidsetBorderStyle(LineStyleType v)Sets the visual appearance of a border, e.g.voidsetBorderWidth(double v)Sets the pixel value for the border of this shaped pathway element.voidsetCenterX(double v)Sets the center x coordinate for this shaped pathway element.voidsetCenterY(double v)Sets the center y coordinate for this shaped pathway element.voidsetFillColor(java.awt.Color v)Sets the color used to paint the area of this shaped pathway element, not including its border.voidsetFontDecoration(boolean v)Sets the typographic style for underline or normal.voidsetFontName(java.lang.String v)Sets the name of the set of printable text characters to be used for visualization, e.g., Arial.voidsetFontSize(double v)Sets point value for the size of the font.voidsetFontStrikethru(boolean v)Sets the typographic style for strikethru or normal.voidsetFontStyle(boolean v)Sets the typographic style applied to displayed text, e.g.voidsetFontWeight(boolean v)Sets the thickness of the font used, a bold font would have more weight.private voidsetGroupRef(Group v)Sets the parent group for this pathway element.voidsetGroupRefTo(Group v)Verifies if given parent group is new and valid.voidsetHAlign(HAlignType v)Sets the horizontal alignment of displayed text, e.g., Left, Center, Right.voidsetHeight(double v)Sets the height of this shaped pathway element.voidsetLeft(double v)Sets the center x coordinate given the left x coordinate of the bounding box around (start, end) this shaped pathway element.voidsetRotation(java.lang.Double v)Sets the rotation of this shaped pathway element.voidsetShapeType(IShape v)Returns the visual appearance of a two dimensional object, e.g.voidsetStaticProperty(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.voidsetTextColor(java.awt.Color v)Sets the color of text for this shaped pathway element.abstract voidsetTextLabel(java.lang.String v)Sets text label for this shaped pathway elements.voidsetTop(double v)Sets the center y coordinate given the top y coordinate of the bounding box around (start, end) this shaped pathway element.voidsetVAlign(VAlignType v)Sets the vertical alignment of displayed text, e.g., Top, Middle, Bottom.voidsetWidth(double v)Sets the width of this shaped pathway element.voidsetZOrder(int v)Sets the z-order of this pathway element.protected voidterminate()Terminates this pathway element.java.awt.geom.Point2DtoAbsoluteCoordinate(java.awt.geom.Point2D p)Converts a point to pathway coordinates (relative to the pathway).java.awt.geom.Point2DtoRelativeCoordinate(java.awt.geom.Point2D p)Converts a point to shape coordinates (relative to the bounds of the shape).voidunsetAllLinkableFroms()Removes links from allGraphLink.LinkableFromline points to thisGraphLink.LinkableTopathway element.voidunsetGroupRef()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, setPropertyExMethods inherited from class org.pathvisio.libgpml.model.PathwayObject
addListener, dontFireEvents, fireObjectModifiedEvent, getElementId, getListeners, getObjectType, getPathwayModel, hasPathwayModel, removeListener, setElementId, setGeneratedElementId, setPathwayModel, setPathwayModelTo, 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
getObjectType, getPathwayModelMethods inherited from interface org.pathvisio.libgpml.model.GraphLink.LinkableTo
getElementId, getObjectType 
- 
Field Details
- 
groupRef
 - 
centerX
private double centerX - 
centerY
private double centerY - 
width
private double width - 
height
private double height - 
textColor
private java.awt.Color textColor - 
fontName
private java.lang.String fontName - 
fontWeight
private boolean fontWeight - 
fontStyle
private boolean fontStyle - 
fontDecoration
private boolean fontDecoration - 
fontStrikethru
private boolean fontStrikethru - 
fontSize
private double fontSize - 
hAlign
 - 
vAlign
 - 
borderColor
private java.awt.Color borderColor - 
borderStyle
 - 
borderWidth
private double borderWidth - 
fillColor
private java.awt.Color fillColor - 
shapeType
 - 
zOrder
private int zOrder - 
rotation
private double rotation 
 - 
 - 
Constructor Details
- 
ShapedElement
public ShapedElement()Instantiates a shaped pathway element. 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 shaped pathway element is already instantiated. 
 - 
 - 
Method Details
- 
getTextLabel
public abstract java.lang.String getTextLabel()Returns text label for shaped pathway elements. Text labels are required forDataNode,DataNode.StateandLabel; and optional forShapeandGroup.- Returns:
 - the text of of the shaped pathway element.
 
 - 
setTextLabel
public abstract void setTextLabel(java.lang.String v)Sets text label for this shaped pathway elements.- Parameters:
 v- the the text to set for this shaped pathway element.
 - 
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:
 getGroupRefin 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:
 hasGroupRefin 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:
 setGroupRefToin 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:
 unsetGroupRefin interfaceGroupable
 - 
getCenterX
public double getCenterX()Returns the center x coordinate for this shaped pathway element.- Specified by:
 getCenterXin interfaceGroupable- Returns:
 - centerX the middle of an object in the x direction.
 
 - 
setCenterX
public void setCenterX(double v)Sets the center x coordinate for this shaped pathway element.- Specified by:
 setCenterXin interfaceGroupable- Parameters:
 v- the middle of an object in the x direction to set.
 - 
getCenterY
public double getCenterY()Returns the center y coordinate for this shaped pathway element.- Specified by:
 getCenterYin interfaceGroupable- Returns:
 - centerY the middle of an object in the y direction.
 
 - 
setCenterY
public void setCenterY(double v)Sets the center y coordinate for this shaped pathway element.- Specified by:
 setCenterYin interfaceGroupable- Parameters:
 v- the middle of an object in the y direction to set.
 - 
getWidth
public double getWidth()Returns the width of this shaped pathway element. - 
setWidth
public void setWidth(double v)Sets the width of this shaped pathway element.- Parameters:
 v- the width to set for this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if width is a negative value.
 - 
getHeight
public double getHeight()Returns the height of this shaped pathway element. - 
setHeight
public void setHeight(double v)Sets the height of this shaped pathway element.- Parameters:
 v- the height to set for this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if height is a negative value.
 - 
getTextColor
public java.awt.Color getTextColor()Returns the color of text for this shaped pathway element..- Returns:
 - textColor the color of text.
 
 - 
setTextColor
public void setTextColor(java.awt.Color v)Sets the color of text for this shaped pathway element.- Parameters:
 v- the color of text for this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if color null.
 - 
getFontName
public java.lang.String getFontName()Returns the name of the set of printable text characters to be used for visualization, e.g., Arial.- Returns:
 - fontName the name of the font.
 
 - 
setFontName
public void setFontName(java.lang.String v)Sets the name of the set of printable text characters to be used for visualization, e.g., Arial.- Parameters:
 v- the name of the font.- Throws:
 java.lang.IllegalArgumentException- if given fontName is null.
 - 
getFontWeight
public boolean getFontWeight()Returns the thickness of the font used, a bold font would have more weight.- Returns:
 - fontWeight the boolean, if true font weight is bold. If false, font weight is normal.
 
 - 
setFontWeight
public void setFontWeight(boolean v)Sets the thickness of the font used, a bold font would have more weight.- Parameters:
 v- the boolean, if true font weight is bold. If false, font weight is normal.
 - 
getFontStyle
public boolean getFontStyle()Returns the typographic style applied to displayed text, e.g. normal or italic.- Returns:
 - fontStyle the boolean, if true typographic style is italic. If false, typographic style is normal.
 
 - 
setFontStyle
public void setFontStyle(boolean v)Sets the typographic style applied to displayed text, e.g. normal or italic.- Parameters:
 v- the boolean, if true typographic style is italic. If false, typographic style is normal.
 - 
getFontDecoration
public boolean getFontDecoration()Returns the typographic style for underline or normal.- Returns:
 - fontDecoration the boolean, if true typographic style is underline. If false, typographic style is normal.
 
 - 
setFontDecoration
public void setFontDecoration(boolean v)Sets the typographic style for underline or normal.- Parameters:
 v- the boolean, if true typographic style is underline. If false, typographic style is normal.
 - 
getFontStrikethru
public boolean getFontStrikethru()Returns the typographic style for strikethru or normal.- Returns:
 - fontStrikethru the boolean, if true typographic style is strikethru. If false, typographic style is normal.
 
 - 
setFontStrikethru
public void setFontStrikethru(boolean v)Sets the typographic style for strikethru or normal.- Parameters:
 v- the boolean, if true typographic style is strikethru. If false, typographic style is normal.
 - 
getFontSize
public double getFontSize()Returns the point value for the size of the font.- Returns:
 - fontSize the value for the size of the font.
 
 - 
setFontSize
public void setFontSize(double v)Sets point value for the size of the font. Rounds any decimals to the nearest 0.5.- Parameters:
 v- the value for the size of the font.- Throws:
 java.lang.IllegalArgumentException- if fontSize is a negative value.
 - 
getHAlign
Returns the horizontal alignment of displayed text, e.g., Left, Center, Right.- Returns:
 - hAlign the horizontal alignment value of displayed text.
 
 - 
setHAlign
Sets the horizontal alignment of displayed text, e.g., Left, Center, Right.- Parameters:
 v- the horizontal alignment value of displayed text.
 - 
getVAlign
Returns the vertical alignment of displayed text, e.g., Top, Middle, Bottom.- Returns:
 - vAlign the vertical alignment value of displayed text.
 
 - 
setVAlign
Sets the vertical alignment of displayed text, e.g., Top, Middle, Bottom.- Parameters:
 v- the vertical alignment value of displayed text.
 - 
getBorderColor
public java.awt.Color getBorderColor()Returns the border color of this shaped pathway element.- Returns:
 - borderColor the border color of this shaped pathway element.
 
 - 
setBorderColor
public void setBorderColor(java.awt.Color v)Sets the border color of this shaped pathway element.- Parameters:
 v- the border color of this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if color null.
 - 
getBorderStyle
Returns the visual appearance of a border, e.g. Solid or Broken.- Returns:
 - borderStyle the style of a border.
 
 - 
setBorderStyle
Sets the visual appearance of a border, e.g. Solid or Broken.- Parameters:
 v- the style of a border.
 - 
getBorderWidth
public double getBorderWidth()Returns the pixel value for the border of this shaped pathway element.- Returns:
 - borderWidth the width of a border.
 
 - 
setBorderWidth
public void setBorderWidth(double v)Sets the pixel value for the border of this shaped pathway element.- Parameters:
 v- the width of a border.- Throws:
 java.lang.IllegalArgumentException- if borderWidth is a negative value.
 - 
getFillColor
public java.awt.Color getFillColor()Returns the color used to paint the area of this shaped pathway element., not including its border.- Returns:
 - fillColor the fill color of this shaped pathway element.
 
 - 
setFillColor
public void setFillColor(java.awt.Color v)Sets the color used to paint the area of this shaped pathway element, not including its border.- Parameters:
 v- the fill color of this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if fillColor null.
 - 
getShapeType
Returns the visual appearance of a two dimensional object, e.g. Rectangle, Arc, Mitochondria, Oval. NB: Shape.type is for object type while shapeType is the visual appearance. For example, an object may have Shape.type "Nucleus" and shapeType "Oval".- Returns:
 - shapeType the visual appearance of this shaped pathway element.
 
 - 
setShapeType
Returns the visual appearance of a two dimensional object, e.g. Rectangle, Arc, Mitochondria, Oval. NB: Shape.type is for object type while shapeType is the visual appearance. For example, an object may have Shape.type "Nucleus" and shapeType "Oval".- Parameters:
 v- the visual appearance of this shaped pathway element.- Throws:
 java.lang.IllegalArgumentException- if shapeType 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. - 
getRotation
public double getRotation()Returns the rotation of this shaped pathway element.- Returns:
 - rotation the rotation of this shaped pathway element.
 
 - 
setRotation
public void setRotation(java.lang.Double v)Sets the rotation of this shaped pathway element.- Parameters:
 v- the rotation of this shaped pathway element.
 - 
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. - 
terminate
protected void terminate()Terminates this pathway element. The pathway model, if any, is unset from this pathway element. Links to all annotationRefs, citationRefs, and evidenceRefs are removed from this data node.- Overrides:
 terminatein classPathwayElement
 - 
getRotatedBounds
public java.awt.geom.Rectangle2D getRotatedBounds()Returns the rectangular bounds of this shaped pathway element after rotation is applied.- Specified by:
 getRotatedBoundsin interfaceGroupable- Returns:
 - the rectangular bounds for this shaped pathway element with rotation taken into account.
 
 - 
getBounds
public java.awt.geom.Rectangle2D getBounds()Returns the rectangular bounds of this shaped pathway element without rotation taken into account. - 
getLeft
public double getLeft()Returns the left x coordinate of the bounding box around (start, end) this shaped pathway element. - 
setLeft
public void setLeft(double v)Sets the center x coordinate given the left x coordinate of the bounding box around (start, end) this shaped pathway element. - 
getTop
public double getTop()Returns the top y coordinate of the bounding box around (start, end) this shaped pathway element. - 
setTop
public void setTop(double v)Sets the center y coordinate given the top y coordinate of the bounding box around (start, end) this shaped pathway element. - 
toAbsoluteCoordinate
public java.awt.geom.Point2D toAbsoluteCoordinate(java.awt.geom.Point2D p)Converts a point to pathway coordinates (relative to the pathway).- Specified by:
 toAbsoluteCoordinatein interfaceDrawable- Specified by:
 toAbsoluteCoordinatein interfaceGraphLink.LinkableTo- Specified by:
 toAbsoluteCoordinatein interfaceGroupable- Parameters:
 p- the point2d.- Returns:
 - the absolute point2d coordinate.
 
 - 
toRelativeCoordinate
public java.awt.geom.Point2D toRelativeCoordinate(java.awt.geom.Point2D p)Converts a point to shape coordinates (relative to the bounds of the shape).- Specified by:
 toRelativeCoordinatein interfaceDrawable- Specified by:
 toRelativeCoordinatein interfaceGraphLink.LinkableTo- Specified by:
 toRelativeCoordinatein interfaceGroupable- 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.
 
 - 
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:
 getStaticPropertyKeysin classPathwayElement- Returns:
 - result the set of static property for this pathway object.
 
 - 
getStaticProperty
Returns static property value for given key.- Overrides:
 getStaticPropertyin 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:
 setStaticPropertyin classPathwayElement- Parameters:
 key- the key.value- the static property value.
 
 -