QGIS API Documentation
2.10.1-Pisa
|
A container class for data source field mapping or expression. More...
#include <qgsdatadefined.h>
Public Member Functions | |
QgsDataDefined (bool active=false, bool useexpr=false, const QString &expr=QString(), const QString &field=QString()) | |
Construct a new data defined object. More... | |
QgsDataDefined (const QgsExpression *expression) | |
Construct a new data defined object, analysing the expression to determine if it's a simple field reference or an expression. More... | |
QgsDataDefined (const QString &string) | |
Construct a new data defined object, analysing the string to determine if it's a simple field reference or an expression. More... | |
QgsDataDefined (const QgsDataDefined &other) | |
Copy constructor. More... | |
virtual | ~QgsDataDefined () |
QgsExpression * | expression () |
bool | expressionIsPrepared () const |
Returns whether the data defined object's expression is prepared. More... | |
QMap< QString, QVariant > | expressionParams () const |
QString | expressionString () const |
QString | field () const |
bool | hasDefaultValues () const |
Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field. More... | |
void | insertExpressionParam (QString key, QVariant param) |
bool | isActive () const |
bool | operator!= (const QgsDataDefined &other) const |
QgsDataDefined & | operator= (QgsDataDefined const &rhs) |
Assignment operator. More... | |
bool | operator== (const QgsDataDefined &other) const |
bool | prepareExpression (QgsVectorLayer *layer) |
Prepares the expression using a vector layer. More... | |
bool | prepareExpression (const QgsFields &fields=QgsFields()) |
Prepares the expression using a fields collection. More... | |
QStringList | referencedColumns (QgsVectorLayer *layer) |
Returns the columns referenced by the QgsDataDefined. More... | |
QStringList | referencedColumns (const QgsFields &fields=QgsFields()) |
Returns the columns referenced by the QgsDataDefined. More... | |
void | setActive (bool active) |
void | setExpressionParams (QMap< QString, QVariant > params) |
void | setExpressionString (const QString &expr) |
void | setField (const QString &field) |
bool | setFromXmlElement (const QDomElement &element) |
Sets the properties of the data defined container from an XML element. More... | |
void | setUseExpression (bool use) |
QgsStringMap | toMap (const QString &baseName=QString()) const |
Encodes the QgsDataDefined into a string map. More... | |
QDomElement | toXmlElement (QDomDocument &document, const QString &elementName) const |
Returns a DOM element containing the properties of the data defined container. More... | |
bool | useExpression () const |
Static Public Member Functions | |
static QgsDataDefined * | fromMap (const QgsStringMap &map, const QString &baseName=QString()) |
Creates a QgsDataDefined from a decoded QgsStringMap. More... | |
A container class for data source field mapping or expression.
Definition at line 36 of file qgsdatadefined.h.
QgsDataDefined::QgsDataDefined | ( | bool | active = false , |
bool | useexpr = false , |
||
const QString & | expr = QString() , |
||
const QString & | field = QString() |
||
) |
Construct a new data defined object.
active | Whether the current data defined is active |
useexpr | Whether to use expression instead of field |
expr | Expression string |
field | Field name string |
Definition at line 24 of file qgsdatadefined.cpp.
|
explicit |
Construct a new data defined object, analysing the expression to determine if it's a simple field reference or an expression.
expression | can be null |
Definition at line 32 of file qgsdatadefined.cpp.
|
explicit |
Construct a new data defined object, analysing the string to determine if it's a simple field reference or an expression.
string | field reference or an expression, can be empty |
Definition at line 70 of file qgsdatadefined.cpp.
QgsDataDefined::QgsDataDefined | ( | const QgsDataDefined & | other | ) |
Copy constructor.
Note that copies of data defined objects with expressions will not be prepared.
Definition at line 42 of file qgsdatadefined.cpp.
|
virtual |
Definition at line 82 of file qgsdatadefined.cpp.
QgsExpression * QgsDataDefined::expression | ( | ) |
Definition at line 211 of file qgsdatadefined.cpp.
bool QgsDataDefined::expressionIsPrepared | ( | ) | const |
Returns whether the data defined object's expression is prepared.
Definition at line 206 of file qgsdatadefined.cpp.
Definition at line 138 of file qgsdatadefined.cpp.
QString QgsDataDefined::expressionString | ( | ) | const |
Definition at line 121 of file qgsdatadefined.cpp.
QString QgsDataDefined::field | ( | ) | const |
Definition at line 255 of file qgsdatadefined.cpp.
|
static |
Creates a QgsDataDefined from a decoded QgsStringMap.
map | string map encoding of QgsDataDefined |
baseName | base name for values in the string map |
Definition at line 48 of file qgsdatadefined.cpp.
bool QgsDataDefined::hasDefaultValues | ( | ) | const |
Returns whether the data defined container is set to all the default values, ie, disabled, with empty expression and no assigned field.
Definition at line 87 of file qgsdatadefined.cpp.
Definition at line 270 of file qgsdatadefined.cpp.
bool QgsDataDefined::isActive | ( | ) | const |
Definition at line 92 of file qgsdatadefined.cpp.
bool QgsDataDefined::operator!= | ( | const QgsDataDefined & | other | ) | const |
Definition at line 323 of file qgsdatadefined.cpp.
QgsDataDefined & QgsDataDefined::operator= | ( | QgsDataDefined const & | rhs | ) |
Assignment operator.
Note that after assignment the data defined object's expression will not be prepared.
Definition at line 328 of file qgsdatadefined.cpp.
bool QgsDataDefined::operator== | ( | const QgsDataDefined & | other | ) | const |
Definition at line 318 of file qgsdatadefined.cpp.
bool QgsDataDefined::prepareExpression | ( | QgsVectorLayer * | layer | ) |
Prepares the expression using a vector layer.
layer | vector layer |
Definition at line 149 of file qgsdatadefined.cpp.
Prepares the expression using a fields collection.
fields |
Definition at line 163 of file qgsdatadefined.cpp.
QStringList QgsDataDefined::referencedColumns | ( | QgsVectorLayer * | layer | ) |
Returns the columns referenced by the QgsDataDefined.
layer | vector layer, used for preparing the expression if required |
Definition at line 220 of file qgsdatadefined.cpp.
QStringList QgsDataDefined::referencedColumns | ( | const QgsFields & | fields = QgsFields() | ) |
Returns the columns referenced by the QgsDataDefined.
fields | vector layer, used for preparing the expression if required |
Definition at line 232 of file qgsdatadefined.cpp.
void QgsDataDefined::setActive | ( | bool | active | ) |
Definition at line 97 of file qgsdatadefined.cpp.
Definition at line 143 of file qgsdatadefined.cpp.
void QgsDataDefined::setExpressionString | ( | const QString & | expr | ) |
Definition at line 126 of file qgsdatadefined.cpp.
void QgsDataDefined::setField | ( | const QString & | field | ) |
Definition at line 260 of file qgsdatadefined.cpp.
bool QgsDataDefined::setFromXmlElement | ( | const QDomElement & | element | ) |
Sets the properties of the data defined container from an XML element.
Calling this will overwrite all the current properties of the container.
element | DOM element |
Definition at line 303 of file qgsdatadefined.cpp.
void QgsDataDefined::setUseExpression | ( | bool | use | ) |
Definition at line 111 of file qgsdatadefined.cpp.
QgsStringMap QgsDataDefined::toMap | ( | const QString & | baseName = QString() | ) | const |
Encodes the QgsDataDefined into a string map.
baseName | optional base name for values in the string map. Can be used to differentiate multiple QgsDataDefineds encoded in the same string map. |
Definition at line 276 of file qgsdatadefined.cpp.
QDomElement QgsDataDefined::toXmlElement | ( | QDomDocument & | document, |
const QString & | elementName | ||
) | const |
Returns a DOM element containing the properties of the data defined container.
document | DOM document |
elementName | name for DOM element |
Definition at line 293 of file qgsdatadefined.cpp.
bool QgsDataDefined::useExpression | ( | ) | const |
Definition at line 106 of file qgsdatadefined.cpp.