public class LinearGradient extends GradientBase
The concept of a linear gradient is more or or less taken from SVG.
A linear gradient is defined by a vector which determines the direction and the length
of the gradient. So for a valid gradient this vector should have a length different from 0.
Otherwise all restrictions for the GradientBase
class apply. (
The vector for a linear gradient is defined by a start and an endpoint and each point consists
of three absolute-relative value pairs (@see RelAbsVector)
For examples of LinearGradients see the render extension specification and/or the SVG specification.
GradientBase)
PAD, REFLECT, REPEAT
Constructor and Description |
---|
LinearGradient()
Creates a new
LinearGradient object with the given SBML level
and SBML version. |
LinearGradient(long level)
Creates a new
LinearGradient object with the given SBML level
and SBML version. |
LinearGradient(long level,
long version)
Creates a new
LinearGradient object with the given SBML level
and SBML version. |
LinearGradient(long level,
long version,
long pkgVersion)
Creates a new
LinearGradient object with the given SBML level
and SBML version. |
LinearGradient(RenderPkgNamespaces renderns)
Creates a new
LinearGradient object with the given SBMLNamespaces . |
LinearGradient(RenderPkgNamespaces renderns,
String id)
Constructor which creates a
LinearGradient with no gradient stops. |
LinearGradient(XMLNode node)
Creates a new
LinearGradient object from the given XMLNode object. |
LinearGradient(XMLNode node,
long l2version)
Creates a new
LinearGradient object from the given XMLNode object. |
Modifier and Type | Method and Description |
---|---|
LinearGradient |
cloneObject()
Creates and returns a deep copy of this
LinearGradient object. |
void |
delete()
Explicitly deletes the underlying native object.
|
String |
getElementName()
Returns the XML element name of this object.
|
int |
getTypeCode()
Returns the libSBML type code for this SBML object.
|
RelAbsVector |
getXPoint1()
Returns the x coordinate for the start point as a reference.
|
RelAbsVector |
getXPoint2()
Returns the x coordinate for the end point as a reference.
|
RelAbsVector |
getYPoint1()
Returns the y coordinate for the start point as a reference.
|
RelAbsVector |
getYPoint2()
Returns the y coordinate for the end point as a reference.
|
RelAbsVector |
getZPoint1()
Returns the z coordinate for the start point as a reference.
|
RelAbsVector |
getZPoint2()
Returns the z coordinate for the end point as a reference.
|
void |
setCoordinates(RelAbsVector x1,
RelAbsVector y1,
RelAbsVector x2,
RelAbsVector y2)
Sets the 2D coordinates for the start and the end point of the linear gradient vector.
|
void |
setCoordinates(RelAbsVector x1,
RelAbsVector y1,
RelAbsVector z1,
RelAbsVector x2,
RelAbsVector y2,
RelAbsVector z2)
Sets the 3D coordinates for the start and the end point of the linear gradient vector.
|
void |
setPoint1(RelAbsVector x,
RelAbsVector y)
Sets the coordinates for the start point of the linear gradient vector.
|
void |
setPoint1(RelAbsVector x,
RelAbsVector y,
RelAbsVector z)
Sets the coordinates for the start point of the linear gradient vector.
|
void |
setPoint2(RelAbsVector x,
RelAbsVector y)
Sets the coordinates for the end point of the linear gradient vector.
|
void |
setPoint2(RelAbsVector x,
RelAbsVector y,
RelAbsVector z)
Sets the coordinates for the end point of the linear gradient vector.
|
XMLNode |
toXML()
Creates an
XMLNode object from this LinearGradient object. |
addGradientStop, connectToChild, createGradientStop, getGradientStop, getListOfGradientStops, getNumGradientStops, getSpreadMethod, setSpreadMethod, unsetId
addCVTerm, addCVTerm, appendAnnotation, appendAnnotation, appendNotes, appendNotes, deleteDisabledPlugins, deleteDisabledPlugins, disablePackage, enablePackage, equals, getAncestorOfType, getAncestorOfType, getAnnotation, getAnnotationString, getColumn, getCVTerm, getCVTerms, getDisabledPlugin, getElementByMetaId, getElementBySId, getLevel, getLine, getListOfAllElements, getListOfAllElements, getListOfAllElementsFromPlugins, getListOfAllElementsFromPlugins, getMetaId, getModel, getModelHistory, getNamespaces, getNotes, getNotesString, getNumCVTerms, getNumDisabledPlugins, getNumPlugins, getPackageName, getPackageVersion, getParentSBMLObject, getPlugin, getPlugin, getPrefix, getResourceBiologicalQualifier, getResourceModelQualifier, getSBMLDocument, getSBOTerm, getSBOTermAsURL, getSBOTermID, getURI, getVersion, hashCode, hasValidLevelVersionNamespaceCombination, isPackageEnabled, isPackageURIEnabled, isPkgEnabled, isPkgURIEnabled, isSetAnnotation, isSetMetaId, isSetModelHistory, isSetNotes, isSetSBOTerm, isSetUserData, matchesRequiredSBMLNamespacesForAddition, matchesSBMLNamespaces, removeFromParentAndDelete, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, removeTopLevelAnnotationElement, renameMetaIdRefs, renameSIdRefs, renameUnitSIdRefs, replaceTopLevelAnnotationElement, replaceTopLevelAnnotationElement, setAnnotation, setAnnotation, setMetaId, setModelHistory, setNamespaces, setNotes, setNotes, setNotes, setSBOTerm, setSBOTerm, toSBML, toXMLNode, unsetAnnotation, unsetCVTerms, unsetMetaId, unsetModelHistory, unsetName, unsetNotes, unsetSBOTerm, unsetUserData
public LinearGradient(long level, long version, long pkgVersion) throws SBMLConstructorException
LinearGradient
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public LinearGradient(long level, long version) throws SBMLConstructorException
LinearGradient
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public LinearGradient(long level) throws SBMLConstructorException
LinearGradient
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public LinearGradient() throws SBMLConstructorException
LinearGradient
object with the given SBML level
and SBML version.
level
- SBML level of the new objectlevel
- SBML version of the new objectSBMLConstructorException
public LinearGradient(RenderPkgNamespaces renderns) throws SBMLConstructorException
LinearGradient
object with the given SBMLNamespaces
.
sbmlns
- The SBML namespace for the object.SBMLConstructorException
public LinearGradient(XMLNode node, long l2version) throws SBMLConstructorException
LinearGradient
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
LinearGradient
object as defined in the render extension specification.
This method is normally called when render information is read from a file and
should normally not have to be called explicitly.
node
- the XMLNode
object reference that describes the LinearGradient
object to be instantiated.SBMLConstructorException
public LinearGradient(XMLNode node) throws SBMLConstructorException
LinearGradient
object from the given XMLNode
object.
The XMLNode
object has to contain a valid XML representation of a
LinearGradient
object as defined in the render extension specification.
This method is normally called when render information is read from a file and
should normally not have to be called explicitly.
node
- the XMLNode
object reference that describes the LinearGradient
object to be instantiated.SBMLConstructorException
public LinearGradient(RenderPkgNamespaces renderns, String id) throws SBMLConstructorException
LinearGradient
with no gradient stops.
The id is set to the given value.
The LinearGradient
object is invalid until it has an id and at least two
gradient stops.
The start and the end of the linear gradient vector are set to (0,0,0).
A linear gradient with a vector of length zero should also be considered invalid.
id
- the new id for the LinearGradient
.
This constructor is deprecated. The new libsbml API only has
constructors which take the SBML level and version or one that takes
an SBMLNamespaces
object.
SBMLConstructorException
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 LinearGradient.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 LinearGradient.delete()
themselves.
delete
 in class GradientBase
public void setCoordinates(RelAbsVector x1, RelAbsVector y1, RelAbsVector z1, RelAbsVector x2, RelAbsVector y2, RelAbsVector z2)
RelAbsVector
object.
x1
- x value of the start point of the linear gradient vectory1
- y value of the start point of the linear gradient vectorz1
- z value of the start point of the linear gradient vectorx2
- x value of the end point of the linear gradient vectory2
- y value of the end point of the linear gradient vectorz2
- z value of the end point of the linear gradient vectorpublic void setCoordinates(RelAbsVector x1, RelAbsVector y1, RelAbsVector x2, RelAbsVector y2)
RelAbsVector
object.
x1
- x value of the start point of the linear gradient vectory1
- y value of the start point of the linear gradient vectorx2
- x value of the end point of the linear gradient vectory2
- y value of the end point of the linear gradient vectorpublic void setPoint1(RelAbsVector x, RelAbsVector y, RelAbsVector z)
Each value can be a combination of absolute and relative value and is represented by
a RelAbsVector
object.
The z value can be omitted. In that case it is set to 0.
x
- x value of the start point of the linear gradient vectory
- y value of the start point of the linear gradient vectorz
- z value of the start point of the linear gradient vectorpublic void setPoint1(RelAbsVector x, RelAbsVector y)
Each value can be a combination of absolute and relative value and is represented by
a RelAbsVector
object.
The z value can be omitted. In that case it is set to 0.
x
- x value of the start point of the linear gradient vectory
- y value of the start point of the linear gradient vectorz
- z value of the start point of the linear gradient vectorpublic void setPoint2(RelAbsVector x, RelAbsVector y, RelAbsVector z)
Each value can be a combination of absolute and relative value and is represented by
a RelAbsVector
object.
The z value can be omitted. In that case it is set to 0.
x
- x value of the end point of the linear gradient vectory
- y value of the end point of the linear gradient vectorz
- z value of the end point of the linear gradient vectorpublic void setPoint2(RelAbsVector x, RelAbsVector y)
Each value can be a combination of absolute and relative value and is represented by
a RelAbsVector
object.
The z value can be omitted. In that case it is set to 0.
x
- x value of the end point of the linear gradient vectory
- y value of the end point of the linear gradient vectorz
- z value of the end point of the linear gradient vectorpublic RelAbsVector getXPoint1()
RelAbsVector
that represents the x value of the start point.public RelAbsVector getYPoint1()
RelAbsVector
that represents the y value of the start point.public RelAbsVector getZPoint1()
RelAbsVector
that represents the z value of the start point.public RelAbsVector getXPoint2()
RelAbsVector
that represents the x value of the start point.public RelAbsVector getYPoint2()
RelAbsVector
that represents the y value of the start point.public RelAbsVector getZPoint2()
RelAbsVector
that represents the z value of the start point.public LinearGradient cloneObject()
LinearGradient
object.
cloneObject
 in class GradientBase
LinearGradient
objectpublic String getElementName()
This is overridden by subclasses to return a string appropriate to the
SBML component. For example, Model
defines it as returning 'model',
CompartmentType
defines it as returning 'compartmentType', etc.
getElementName
 in class GradientBase
public int getTypeCode()
LibSBML attaches an
identifying code to every kind of SBML object. These are known as
SBML type codes. In other languages, the set of type codes
is stored in an enumeration in the Java language interface for
libSBML, the type codes are defined as static integer constants in
interface class libsbmlConstants
. The names of the type codes
all begin with the characters SBML_.
getTypeCode
 in class SBase
SBML_UNKNOWN
(default).
LinearGradient.getElementName()
public XMLNode toXML()
XMLNode
object from this LinearGradient
object.
toXML
 in class GradientBase
XMLNode
with the XML representation for the
LinearGradient
object.