libSBML C++ API
5.18.0
|
For many elements in the render extension, it is necessary to specify coordinates not in terms of absolute values, but rather in terms of relative values or even a combination of absolute and relative values. Such a pair of values where one represents an absolute value and the other represents a relative value can be expressed by a RelAbsVector. The RelAbsVector class represents a pair of numerical values where one value represents an absolute value and the other value is a relative value in percent.
The relative and absolute values to initialize a RelAbsVector object can either be given as numerical datatypes (double) or as a valid value string. A value string is a combination of an absolute value and a relative value and the absolute value if given has to come first. So valid value strings would be: "5.0e3+20%", or "100%" or "4".
Public Member Functions | |
virtual RelAbsVector * | clone () const |
Creates and returns a deep copy of this RelAbsVector object. More... | |
bool | empty () const |
void | erase () |
resets this element by setting the two coordinates to 0.0 More... | |
double | getAbsoluteValue () const |
Returns the absolute coordinate value. More... | |
std::string | getCoordinate () const |
Returns the coordinate value. More... | |
double | getRelativeValue () const |
Returns the relative coordinate value. More... | |
bool | isSetAbsoluteValue () const |
Predicate returning true if this RelAbsVector's "abs" attribute is set. More... | |
bool | isSetCoordinate () const |
Predicate returning true if this RelAbsVector's coordinate attribute is set. More... | |
bool | isSetRelativeValue () const |
Predicate returning true if this RelAbsVector's "rel" attribute is set. More... | |
bool | operator!= (const RelAbsVector &other) const |
Inverse comparison operator. More... | |
RelAbsVector | operator+ (const RelAbsVector &other) const |
addition operator for RelAbsVector objects More... | |
RelAbsVector | operator/ (double x) const |
Divides a RelAbsVector object by a double value. More... | |
RelAbsVector & | operator= (const RelAbsVector &rhs) |
Assignment operator for RelAbsVector. More... | |
bool | operator== (const RelAbsVector &other) const |
Comparison operator. More... | |
RelAbsVector (double a=0.0, double r=0.0) | |
Constructor with two values. More... | |
RelAbsVector (const std::string &coordString) | |
Constructor with a value string. More... | |
RelAbsVector (const RelAbsVector &orig) | |
Copy constructor for RelAbsVector. More... | |
int | setAbsoluteValue (double abs) |
Sets the absolute coordinate value. More... | |
int | setCoordinate (double abs, double rel=0.0) |
Sets the relative and absolute value. More... | |
int | setCoordinate (const std::string &coordString) |
Sets the coordinates from the given string. More... | |
int | setRelativeValue (double rel) |
Sets the relative coordinate value. More... | |
std::string | toString () const |
int | unsetAbsoluteValue () |
Unsets the value of the "abs" attribute of this RelAbsVector. More... | |
int | unsetCoordinate () |
Unsets the value of the "rel" attribute of this RelAbsVector. More... | |
int | unsetRelativeValue () |
Unsets the value of the relative coordinate attribute of this RelAbsVector. More... | |
virtual | ~RelAbsVector () |
Destroy this RelAbsVector object. More... | |
RelAbsVector::RelAbsVector | ( | double | a = 0.0 , |
double | r = 0.0 |
||
) |
Constructor with two values.
First value sets the absolute value, second sets the relative value (%).
a | absolute value |
r | relative value in % (50 -> 50%) |
RelAbsVector::RelAbsVector | ( | const std::string & | coordString | ) |
Constructor with a value string.
If the string does not represent a valid value, the relative and the absolute component of the RelAbsVector are set to NaN.
coordString | value as a string |
RelAbsVector::RelAbsVector | ( | const RelAbsVector & | orig | ) |
Copy constructor for RelAbsVector.
orig | the RelAbsVector instance to copy. |
|
virtual |
Destroy this RelAbsVector object.
|
virtual |
Creates and returns a deep copy of this RelAbsVector object.
bool RelAbsVector::empty | ( | ) | const |
void RelAbsVector::erase | ( | ) |
resets this element by setting the two coordinates to 0.0
double RelAbsVector::getAbsoluteValue | ( | ) | const |
Returns the absolute coordinate value.
std::string RelAbsVector::getCoordinate | ( | ) | const |
Returns the coordinate value.
double RelAbsVector::getRelativeValue | ( | ) | const |
Returns the relative coordinate value.
bool RelAbsVector::isSetAbsoluteValue | ( | ) | const |
Predicate returning true
if this RelAbsVector's "abs" attribute is set.
true
if this RelAbsVector's "abs" attribute has been set, otherwise false
is returned. bool RelAbsVector::isSetCoordinate | ( | ) | const |
Predicate returning true
if this RelAbsVector's coordinate attribute is set.
true
if this RelAbsVector's coordinate attribute has been set, otherwise false
is returned. bool RelAbsVector::isSetRelativeValue | ( | ) | const |
Predicate returning true
if this RelAbsVector's "rel" attribute is set.
true
if this RelAbsVector's "rel" attribute has been set, otherwise false
is returned. bool RelAbsVector::operator!= | ( | const RelAbsVector & | other | ) | const |
Inverse comparison operator.
Return false if two RelAbsVector objects are equal.
RelAbsVector RelAbsVector::operator+ | ( | const RelAbsVector & | other | ) | const |
addition operator for RelAbsVector objects
RelAbsVector RelAbsVector::operator/ | ( | double | x | ) | const |
Divides a RelAbsVector object by a double value.
x | divisor |
RelAbsVector & RelAbsVector::operator= | ( | const RelAbsVector & | rhs | ) |
Assignment operator for RelAbsVector.
rhs | the RelAbsVector object whose values are to be used as the basis of the assignment. |
bool RelAbsVector::operator== | ( | const RelAbsVector & | other | ) | const |
Comparison operator.
Return true if two RelAbsVector objects are equal.
int RelAbsVector::setAbsoluteValue | ( | double | abs | ) |
Sets the absolute coordinate value.
Calling this function with an argument of 0.0
or NaN
is equivalent to unsetting the value.
abs | double value of the "abs" attribute to be set. |
int RelAbsVector::setCoordinate | ( | double | abs, |
double | rel = 0.0 |
||
) |
Sets the relative and absolute value.
Calling this function with an argument of 0.0
or NaN
is equivalent to unsetting the value.
abs | absolute value |
rel | relative value. If the relative value is omitted, it is set to 0. |
int RelAbsVector::setCoordinate | ( | const std::string & | coordString | ) |
Sets the coordinates from the given string.
If the string does not represent a valid value, the relative and the absolute component of the RelAbsVector are set to NaN.
Calling this function with either cooredinate having a value of "0.0"
or "NaN"
is equivalent to unsetting the value.
coordString | value string |
int RelAbsVector::setRelativeValue | ( | double | rel | ) |
Sets the relative coordinate value.
Calling this function with an argument of 0.0
or NaN
is equivalent to unsetting the value.
rel | double value of the "rel" attribute to be set. |
std::string RelAbsVector::toString | ( | ) | const |
int RelAbsVector::unsetAbsoluteValue | ( | ) |
Unsets the value of the "abs" attribute of this RelAbsVector.
int RelAbsVector::unsetCoordinate | ( | ) |
Unsets the value of the "rel" attribute of this RelAbsVector.
int RelAbsVector::unsetRelativeValue | ( | ) |
Unsets the value of the relative coordinate attribute of this RelAbsVector.