public class GraphicalPrimitive2D extends GraphicalPrimitive1D
The GraphicalPrimitive2D class implements attributes and methods necessary
for 2D objects like rectangles, polygons or ellipses. The attributes that
are implemented are a fill color and a fill rule that specifies how the
fill color is applied.
The GraphicalPrimitive2D class is derived from GraphicalPrimitive1D and
inherits all its methods and attributes.
| Modifier and Type | Field and Description |
|---|---|
static int |
EVENODD |
static int |
INHERIT |
static int |
INVALID |
static int |
NONZERO |
static int |
UNSET |
| Modifier and Type | Method and Description |
|---|---|
SBase |
cloneObject()
Creates and returns a deep copy of this
GraphicalPrimitive2D object. |
void |
delete()
Explicitly deletes the underlying native object.
|
java.lang.String |
getElementName()
Returns the XML element name of this
GraphicalPrimitive2D object. |
java.lang.String |
getFill()
Returns the value of the 'fill' attribute of this
GraphicalPrimitive2D. |
java.lang.String |
getFillColor()
Returns the value of the 'fill' attribute of this
GraphicalPrimitive2D. |
int |
getFillRule()
Returns the value of the 'fill-rule' attribute of this
GraphicalPrimitive2D. |
java.lang.String |
getFillRuleAsString()
Returns the value of the 'fill-rule' attribute of this
GraphicalPrimitive2D. |
int |
getTypeCode()
Returns the libSBML type code for this
GraphicalPrimitive2D object. |
boolean |
hasRequiredAttributes()
Predicate returning
true if all the required attributes for this
GraphicalPrimitive2D object have been set. |
boolean |
isEllipse()
|
boolean |
isLineEnding()
|
boolean |
isPolygon()
|
boolean |
isRectangle()
|
boolean |
isRenderGroup()
|
boolean |
isSetFill()
Predicate returning
true if this GraphicalPrimitive2D's 'fill'
attribute is set. |
boolean |
isSetFillColor()
Returns
true if the fill attribute is set or false otherwise. |
boolean |
isSetFillRule()
Predicate returning
true if this GraphicalPrimitive2D's 'fill-rule'
attribute is set. |
int |
setFill(java.lang.String fill)
Sets the value of the 'fill' attribute of this
GraphicalPrimitive2D. |
void |
setFillColor(java.lang.String color)
Set fill color to the id of a color definition, the id of a gradient
definition or a color value string.
|
void |
setFillRule(int rule)
Sets the value of the 'fill-rule' attribute of this
GraphicalPrimitive2D. |
int |
setFillRule(java.lang.String fillRule)
Sets the value of the 'fill-rule' attribute of this
GraphicalPrimitive2D. |
int |
unsetFill()
Unsets the value of the 'fill' attribute of this
GraphicalPrimitive2D. |
int |
unsetFillRule()
Unsets the value of the 'fill-rule' attribute of this
GraphicalPrimitive2D. |
addDash, clearDashes, getDashByIndex, getId, getNumDashes, getStroke, getStrokeDashArray, getStrokeWidth, insertDash, isRenderCurve, isSetDashArray, isSetId, isSetStroke, isSetStrokeDashArray, isSetStrokeWidth, isText, removeDash, setDashByIndex, setId, setStroke, setStrokeDashArray, setStrokeWidth, toXML, unsetId, unsetStroke, unsetStrokeDashArray, unsetStrokeWidthgetIdentityMatrix2D, getMatrix2D, isImage, setMatrix, setMatrix2DgetIdentityMatrix, getMatrix, getName, getTransform, isSetMatrix, isSetName, isSetTransform, setName, setTransform, unsetMatrix, unsetName, unsetTransformaddCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, connectToChild, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getIdAttribute, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageCoreVersion, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetIdAttribute, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setIdAttribute, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetIdAttribute, unsetMetaId, unsetModelHistory, unsetNotes, unsetSBOTerm, unsetUserDatapublic static final int UNSET
public static final int NONZERO
public static final int EVENODD
public static final int INHERIT
public static final int INVALID
public void delete()
In general, application software will not need to call this method directly. The Java language binding for libSBML is implemented as a language wrapper that provides a Java interface to libSBML's underlying C++/C code. Some of the Java methods return objects that are linked to objects created not by Java code, but by C++ code. The Java objects wrapped around them will be deleted when the garbage collector invokes the corresponding C++ finalize() methods for the objects. The finalize() methods in turn call the GraphicalPrimitive2D.delete() method on the libSBML object.
This method is exposed in case calling programs want to ensure that the underlying object is freed immediately, and not at some arbitrary time determined by the Java garbage collector. In normal usage, callers do not need to invoke GraphicalPrimitive2D.delete() themselves.
delete in class GraphicalPrimitive1Dpublic SBase cloneObject()
GraphicalPrimitive2D object.
cloneObject in class GraphicalPrimitive1DGraphicalPrimitive2D object.public java.lang.String getFill()
GraphicalPrimitive2D.
GraphicalPrimitive2D as
a string.public java.lang.String getFillColor()
GraphicalPrimitive2D.
GraphicalPrimitive2D as
a string.public int getFillRule()
GraphicalPrimitive2D.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
GraphicalPrimitive2D as an int value.
The possible values returned by this method are:
public java.lang.String getFillRuleAsString()
GraphicalPrimitive2D.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
GraphicalPrimitive2D as a string. The possible values returned by this
method are:
'unset'
'nonzero'
'evenodd'
'inherit'
'(Unknown FillRule value)'
public boolean isSetFill()
true if this GraphicalPrimitive2D's 'fill'
attribute is set.
true if this GraphicalPrimitive2D's 'fill' attribute has been
set, otherwise false is returned.public boolean isSetFillColor()
true if the fill attribute is set or false otherwise.
The fill attribute is considered set if the string is not empty.
true if the fill color is set.public boolean isSetFillRule()
true if this GraphicalPrimitive2D's 'fill-rule'
attribute is set.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
true if this GraphicalPrimitive2D's 'fill-rule' attribute has
been set, otherwise false is returned.public int setFill(java.lang.String fill)
GraphicalPrimitive2D.
fill - String& value of the 'fill' attribute to be set.
Calling this function with fill = null or an empty string is
equivalent to calling unsetFill().
public void setFillColor(java.lang.String color)
color - the id of a color deifnition or a gradient or a color value string.public void setFillRule(int rule)
GraphicalPrimitive2D.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
rule - int value of the
'fill-rule' attribute to be set.
public int setFillRule(java.lang.String fillRule)
GraphicalPrimitive2D.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
fillRule - String& of the 'fill-rule' attribute to be set.
public int unsetFill()
GraphicalPrimitive2D.
public int unsetFillRule()
GraphicalPrimitive2D.
The attribute 'fill-rule' is used to define how polygons should be filled. In the SBML Level 3 Version 1 Render specification, the following are the allowable values for 'fill-rule':
'nonzero': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and then examining the places where a segment of the shape crosses the ray.
Starting with a count of zero, add one each time a path segment crosses
the ray from left to right and subtract one each time a path segment crosses
the ray from right to left. After counting the crossings, if the result is
zero then the point is outside the path. Otherwise, it is inside.
'evenodd': This value determines the 'insideness' of a point in
the shape by drawing a ray from that point to infinity in any direction
and counting the number of path segments from the given shape that the ray
crosses. If this number is odd, the point is inside; if even, the point is
outside.
'inherit': This value declares the 'insideness' of a point
in the shape by declaring that the property takes the same computed value
as the property for the element's parent. The inherited value, which is
normally only used as a fallback value, can be clarified by setting
'inherit' explicitly. NOTE: This value is NOT in the Level 3
Version 1 Render specification, but was left out due to an oversight:
the value has long been part of the codebase. It is provided here as
a convenience. Elements with a fill-rule set to 'inherit' actually
behave identicaly to elements without a fill-rule attribute at all, since
this attribute always takes the value of a parent element if not
defined explicitly.
public boolean isEllipse()
isEllipse in class GraphicalPrimitive1Dtrue if this abstract GraphicalPrimitive2D is of type
Ellipse, false otherwisepublic boolean isRectangle()
isRectangle in class GraphicalPrimitive1Dtrue if this abstract GraphicalPrimitive2D is of type
Rectangle, false otherwisepublic boolean isPolygon()
isPolygon in class GraphicalPrimitive1Dtrue if this abstract GraphicalPrimitive2D is of type
Polygon, false otherwisepublic boolean isRenderGroup()
isRenderGroup in class GraphicalPrimitive1Dtrue if this abstract GraphicalPrimitive2D is of type
RenderGroup, false otherwisepublic boolean isLineEnding()
isLineEnding in class GraphicalPrimitive1Dtrue if this abstract GraphicalPrimitive2D is of type
LineEnding, false otherwisepublic java.lang.String getElementName()
GraphicalPrimitive2D object.
For GraphicalPrimitive2D, the XML element name is always
'graphicalPrimitive2D'.
getElementName in class Transformation2D'graphicalPrimitive2D'.public int getTypeCode()
GraphicalPrimitive2D object.
LibSBML attaches an identifying code to every kind of SBML object. These
are integer constants known as SBML type codes. The names of all
the codes begin with the characters SBML_.
In the Java language interface for libSBML, the
type codes are defined as static integer constants in the interface class
libsbmlConstants. Note that different Level 3
package plug-ins may use overlapping type codes; to identify the package
to which a given object belongs, call the
method on the object.
SBase.getPackageName()
The exception to this is lists: all SBML-style list elements have the type
SBML_LIST_OF, regardless of what package they
are from.
getTypeCode in class GraphicalPrimitive1DSBML_RENDER_GRAPHICALPRIMITIVE2D.
GraphicalPrimitive2D.getElementName(),
SBase.getPackageName()ListOf.getItemTypeCode()).
public boolean hasRequiredAttributes()
true if all the required attributes for this
GraphicalPrimitive2D object have been set.
hasRequiredAttributes in class GraphicalPrimitive1Dtrue to indicate that all the required attributes of this
GraphicalPrimitive2D have been set, otherwise false is returned.