Skip to content
Permalink
Browse files
Port symbology and composer to properties framework
  • Loading branch information
nyalldawson committed Jan 23, 2017
1 parent 43bbf68 commit ad2324021dc82d9320163b5012d7eacb40ad138e
Showing with 2,262 additions and 2,927 deletions.
  1. +15 −24 python/core/composer/qgscomposerobject.sip
  2. +7 −28 python/core/composer/qgscomposerutils.sip
  3. +19 −16 python/core/composer/qgscomposition.sip
  4. +31 −10 python/core/qgsproperty.sip
  5. +22 −8 python/core/qgspropertycollection.sip
  6. +1 −1 python/core/symbology-ng/qgs25drenderer.sip
  7. +1 −1 python/core/symbology-ng/qgsarrowsymbollayer.sip
  8. +1 −1 python/core/symbology-ng/qgscategorizedsymbolrenderer.sip
  9. +4 −4 python/core/symbology-ng/qgsfillsymbollayer.sip
  10. +1 −1 python/core/symbology-ng/qgsgeometrygeneratorsymbollayer.sip
  11. +1 −1 python/core/symbology-ng/qgsgraduatedsymbolrenderer.sip
  12. +1 −1 python/core/symbology-ng/qgsheatmaprenderer.sip
  13. +1 −1 python/core/symbology-ng/qgsinvertedpolygonrenderer.sip
  14. +2 −2 python/core/symbology-ng/qgslinesymbollayer.sip
  15. +1 −1 python/core/symbology-ng/qgsmarkersymbollayer.sip
  16. +1 −1 python/core/symbology-ng/qgsnullsymbolrenderer.sip
  17. +1 −1 python/core/symbology-ng/qgspointclusterrenderer.sip
  18. +1 −1 python/core/symbology-ng/qgspointdisplacementrenderer.sip
  19. +1 −1 python/core/symbology-ng/qgspointdistancerenderer.sip
  20. +1 −1 python/core/symbology-ng/qgsrenderer.sip
  21. +2 −2 python/core/symbology-ng/qgsrulebasedrenderer.sip
  22. +1 −1 python/core/symbology-ng/qgssinglesymbolrenderer.sip
  23. +7 −7 python/core/symbology-ng/qgssymbol.sip
  24. +79 −69 python/core/symbology-ng/qgssymbollayer.sip
  25. +1 −1 python/core/symbology-ng/qgsvectorfieldsymbollayer.sip
  26. +1 −1 python/gui/qgsdatadefinedbutton.sip
  27. +9 −9 python/gui/symbology-ng/qgsrendererwidget.sip
  28. +1 −1 python/gui/symbology-ng/qgssizescalewidget.sip
  29. +1 −1 python/gui/symbology-ng/qgssymbollayerwidget.sip
  30. +1 −1 src/app/composer/qgscomposerhtmlwidget.cpp
  31. +23 −38 src/app/composer/qgscomposeritemwidget.cpp
  32. +4 −7 src/app/composer/qgscomposeritemwidget.h
  33. +9 −9 src/app/composer/qgscomposermapwidget.cpp
  34. +1 −1 src/app/composer/qgscomposerpicturewidget.cpp
  35. +24 −44 src/app/composer/qgscompositionwidget.cpp
  36. +2 −2 src/app/composer/qgscompositionwidget.h
  37. +5 −6 src/app/dwg/qgsdwgimportdialog.cpp
  38. +0 −1 src/app/qgslabelpropertydialog.cpp
  39. +0 −1 src/app/qgsmaptoollabel.cpp
  40. +10 −14 src/app/qgsmaptooloffsetpointsymbol.cpp
  41. +5 −4 src/app/qgsmaptoolrotatepointsymbols.cpp
  42. +1 −1 src/app/qgsmaptoolselectutils.cpp
  43. +4 −6 src/core/composer/qgscomposerhtml.cpp
  44. +20 −75 src/core/composer/qgscomposeritem.cpp
  45. +0 −1 src/core/composer/qgscomposeritem.h
  46. +35 −89 src/core/composer/qgscomposermap.cpp
  47. +56 −82 src/core/composer/qgscomposerobject.cpp
  48. +23 −33 src/core/composer/qgscomposerobject.h
  49. +7 −10 src/core/composer/qgscomposerpicture.cpp
  50. +20 −80 src/core/composer/qgscomposerutils.cpp
  51. +7 −28 src/core/composer/qgscomposerutils.h
  52. +32 −267 src/core/composer/qgscomposition.cpp
  53. +20 −65 src/core/composer/qgscomposition.h
  54. +3 −3 src/core/dxf/qgsdxfexport.cpp
  55. +0 −1 src/core/qgspallabeling.h
  56. +61 −15 src/core/qgsproperty.cpp
  57. +37 −10 src/core/qgsproperty.h
  58. +39 −15 src/core/qgspropertycollection.cpp
  59. +22 −4 src/core/qgspropertycollection.h
  60. +1 −1 src/core/qgsvectorfilewriter.cpp
  61. +6 −6 src/core/qgsvectorlayer.cpp
  62. +0 −1 src/core/qgsvectorlayerlabelprovider.cpp
  63. +1 −1 src/core/qgsvectorlayerrenderer.cpp
  64. +6 −6 src/core/symbology-ng/qgs25drenderer.cpp
  65. +1 −1 src/core/symbology-ng/qgs25drenderer.h
  66. +27 −21 src/core/symbology-ng/qgsarrowsymbollayer.cpp
  67. +1 −1 src/core/symbology-ng/qgsarrowsymbollayer.h
  68. +15 −11 src/core/symbology-ng/qgscategorizedsymbolrenderer.cpp
  69. +1 −1 src/core/symbology-ng/qgscategorizedsymbolrenderer.h
  70. +75 −109 src/core/symbology-ng/qgsellipsesymbollayer.cpp
  71. +135 −190 src/core/symbology-ng/qgsfillsymbollayer.cpp
  72. +5 −5 src/core/symbology-ng/qgsfillsymbollayer.h
  73. +4 −6 src/core/symbology-ng/qgsgeometrygeneratorsymbollayer.cpp
  74. +1 −1 src/core/symbology-ng/qgsgeometrygeneratorsymbollayer.h
  75. +15 −11 src/core/symbology-ng/qgsgraduatedsymbolrenderer.cpp
  76. +1 −1 src/core/symbology-ng/qgsgraduatedsymbolrenderer.h
  77. +1 −1 src/core/symbology-ng/qgsheatmaprenderer.cpp
  78. +1 −1 src/core/symbology-ng/qgsheatmaprenderer.h
  79. +2 −2 src/core/symbology-ng/qgsinvertedpolygonrenderer.cpp
  80. +1 −1 src/core/symbology-ng/qgsinvertedpolygonrenderer.h
  81. +52 −58 src/core/symbology-ng/qgslinesymbollayer.cpp
  82. +2 −2 src/core/symbology-ng/qgslinesymbollayer.h
  83. +107 −143 src/core/symbology-ng/qgsmarkersymbollayer.cpp
  84. +1 −1 src/core/symbology-ng/qgsmarkersymbollayer.h
  85. +1 −1 src/core/symbology-ng/qgsnullsymbolrenderer.cpp
  86. +1 −1 src/core/symbology-ng/qgsnullsymbolrenderer.h
  87. +5 −5 src/core/symbology-ng/qgspointclusterrenderer.cpp
  88. +1 −1 src/core/symbology-ng/qgspointclusterrenderer.h
  89. +3 −3 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  90. +1 −1 src/core/symbology-ng/qgspointdisplacementrenderer.h
  91. +2 −2 src/core/symbology-ng/qgspointdistancerenderer.cpp
  92. +1 −1 src/core/symbology-ng/qgspointdistancerenderer.h
  93. +7 −10 src/core/symbology-ng/qgsrenderer.cpp
  94. +1 −1 src/core/symbology-ng/qgsrenderer.h
  95. +10 −10 src/core/symbology-ng/qgsrulebasedrenderer.cpp
  96. +2 −2 src/core/symbology-ng/qgsrulebasedrenderer.h
  97. +6 −6 src/core/symbology-ng/qgssinglesymbolrenderer.cpp
  98. +1 −1 src/core/symbology-ng/qgssinglesymbolrenderer.h
  99. +95 −120 src/core/symbology-ng/qgssymbol.cpp
  100. +28 −28 src/core/symbology-ng/qgssymbol.h
  101. +201 −213 src/core/symbology-ng/qgssymbollayer.cpp
  102. +88 −137 src/core/symbology-ng/qgssymbollayer.h
  103. +12 −0 src/core/symbology-ng/qgssymbollayerutils.cpp
  104. +3 −3 src/core/symbology-ng/qgsvectorfieldsymbollayer.cpp
  105. +1 −1 src/core/symbology-ng/qgsvectorfieldsymbollayer.h
  106. +1 −1 src/gui/qgsdatadefinedbutton.cpp
  107. +4 −3 src/gui/qgsdatadefinedbutton.h
  108. +29 −10 src/gui/qgsdatadefinedbuttonv2.cpp
  109. +45 −1 src/gui/qgsdatadefinedbuttonv2.h
  110. +2 −2 src/gui/qgshighlight.cpp
  111. +7 −7 src/gui/symbology-ng/qgsarrowsymbollayerwidget.cpp
  112. +12 −12 src/gui/symbology-ng/qgsellipsesymbollayerwidget.cpp
  113. +18 −19 src/gui/symbology-ng/qgslayerpropertieswidget.cpp
  114. +6 −2 src/gui/symbology-ng/qgslayerpropertieswidget.h
  115. +2 −3 src/gui/symbology-ng/qgsrendererpropertiesdialog.cpp
  116. +24 −23 src/gui/symbology-ng/qgsrendererwidget.cpp
  117. +9 −9 src/gui/symbology-ng/qgsrendererwidget.h
  118. +1 −1 src/gui/symbology-ng/qgsrulebasedrendererwidget.cpp
  119. +13 −10 src/gui/symbology-ng/qgssizescalewidget.cpp
  120. +2 −2 src/gui/symbology-ng/qgssizescalewidget.h
  121. +106 −116 src/gui/symbology-ng/qgssymbollayerwidget.cpp
  122. +3 −3 src/gui/symbology-ng/qgssymbollayerwidget.h
  123. +26 −27 src/gui/symbology-ng/qgssymbolselectordialog.cpp
  124. +4 −4 src/gui/symbology-ng/qgssymbolselectordialog.h
  125. +35 −30 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  126. +2 −0 src/gui/symbology-ng/qgssymbolslistwidget.h
  127. +2 −2 src/plugins/grass/qgsgrasseditrenderer.cpp
  128. +1 −1 src/plugins/grass/qgsgrasseditrenderer.h
  129. +3 −3 src/ui/composer/qgscomposerhtmlwidgetbase.ui
  130. +10 −10 src/ui/composer/qgscomposeritemwidgetbase.ui
  131. +11 −11 src/ui/composer/qgscomposermapwidgetbase.ui
  132. +3 −3 src/ui/composer/qgscomposerpicturewidgetbase.ui
  133. +7 −7 src/ui/composer/qgscompositionwidgetbase.ui
  134. +9 −9 src/ui/symbollayer/qgsarrowsymbollayerwidgetbase.ui
  135. +14 −14 src/ui/symbollayer/widget_ellipse.ui
  136. +8 −8 src/ui/symbollayer/widget_filledmarker.ui
  137. +12 −12 src/ui/symbollayer/widget_fontmarker.ui
  138. +14 −14 src/ui/symbollayer/widget_gradientfill.ui
  139. +3 −3 src/ui/symbollayer/widget_layerproperties.ui
  140. +4 −4 src/ui/symbollayer/widget_linepatternfill.ui
  141. +6 −6 src/ui/symbollayer/widget_markerline.ui
  142. +6 −6 src/ui/symbollayer/widget_pointpatternfill.ui
  143. +6 −6 src/ui/symbollayer/widget_rasterfill.ui
  144. +3 −3 src/ui/symbollayer/widget_set_dd_value.ui
  145. +8 −8 src/ui/symbollayer/widget_shapeburstfill.ui
  146. +8 −8 src/ui/symbollayer/widget_simplefill.ui
  147. +9 −9 src/ui/symbollayer/widget_simpleline.ui
  148. +13 −13 src/ui/symbollayer/widget_simplemarker.ui
  149. +8 −8 src/ui/symbollayer/widget_svgfill.ui
  150. +11 −11 src/ui/symbollayer/widget_svgmarker.ui
  151. +5 −5 src/ui/symbollayer/widget_symbolslist.ui
  152. +3 −3 tests/src/core/testqgscomposerdd.cpp
  153. +20 −21 tests/src/core/testqgscomposermap.cpp
  154. +6 −58 tests/src/core/testqgscomposerobject.cpp
  155. +5 −8 tests/src/core/testqgscomposerpicture.cpp
  156. +37 −100 tests/src/core/testqgscomposerutils.cpp
  157. +2 −2 tests/src/core/testqgsellipsemarker.cpp
  158. +5 −5 tests/src/core/testqgsfilledmarker.cpp
  159. +2 −2 tests/src/core/testqgsfontmarker.cpp
  160. +2 −2 tests/src/core/testqgslinefillsymbol.cpp
  161. +3 −3 tests/src/core/testqgsmarkerlinesymbol.cpp
  162. +2 −2 tests/src/core/testqgspointpatternfillsymbol.cpp
  163. +9 −0 tests/src/core/testqgsproperty.cpp
  164. +11 −11 tests/src/core/testqgssimplemarker.cpp
  165. +2 −2 tests/src/core/testqgssvgmarker.cpp
@@ -84,21 +84,24 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
*/
virtual bool readXml( const QDomElement& itemElem, const QDomDocument& doc );

/** Returns a reference to the data defined settings for one of the item's data defined properties.
* @param property data defined property to return
* @note this method was added in version 2.5
/** Returns a reference to the object's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
QgsDataDefined* dataDefinedProperty( const DataDefinedProperty property ) const;
QgsPropertyCollection& dataDefinedProperties();

/** Sets parameters for a data defined property for the item
* @param property data defined property to set
* @param active true if data defined property is active, false if it is disabled
* @param useExpression true if the expression should be used
* @param expression expression for data defined property
* @param field field name if the data defined property should take its value from a field
* @note this method was added in version 2.5
/** Returns a reference to the object's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
//const QgsPropertyCollection& dataDefinedProperties() const;

/** Sets the objects's property collection, used for data defined overrides.
* @param collection property collection. Existing properties will be replaced.
* @note added in QGIS 3.0
* @see dataDefinedProperties()
*/
void setDataDefinedProperty( const DataDefinedProperty property, const bool active, const bool useExpression, const QString &expression, const QString &field );
void setDataDefinedProperties( const QgsPropertyCollection& collection );

/** Set a custom property for the object.
* @param key property key. If a property with the same key already exists it will be overwritten.
@@ -159,18 +162,6 @@ class QgsComposerObject : QObject, QgsExpressionContextGenerator
*/
virtual void refreshDataDefinedProperty( const DataDefinedProperty property = AllProperties, const QgsExpressionContext* context = 0 );

protected:

/** Evaluate a data defined property and return the calculated value
* @returns true if data defined property could be successfully evaluated
* @param property data defined property to evaluate
* @param expressionValue QVariant for storing the evaluated value
* @param context expression context for evaluating expressions. Must have feature and fields set to current
* atlas feature and coverage layer fields prior to calling this method.
* @note this method was added in version 2.5
*/
bool dataDefinedEvaluate( const QgsComposerObject::DataDefinedProperty property, QVariant &expressionValue, const QgsExpressionContext& context = QgsExpressionContext() ) const;

signals:
/** Emitted when the item changes. Signifies that the item widgets must update the
* gui elements.
@@ -102,40 +102,19 @@ class QgsComposerUtils
*/
static bool decodePresetPaperSize( const QString& presetString, double &width, double &height );

/** Reads all data defined properties from xml
* @param itemElem dom element containing data defined properties
* @param dataDefinedNames map of data defined property to name used within xml
* @param dataDefinedProperties map of data defined properties to QgsDataDefined in which to store properties from xml
* @note this method was added in version 2.5
/** Reads all pre 3.0 data defined properties from an XML element.
* @note this method was added in version 3.0
* @see readDataDefinedProperty
* @see writeDataDefinedPropertyMap
*/
static void readDataDefinedPropertyMap( const QDomElement &itemElem,
QMap< QgsComposerObject::DataDefinedProperty, QString >* dataDefinedNames,
QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >* dataDefinedProperties
);
static void readOldDataDefinedPropertyMap( const QDomElement &itemElem,
QgsPropertyCollection& dataDefinedProperties );

/** Reads a single data defined property from xml DOM element
* @param property data defined property to read
* @param ddElem dom element containing settings for data defined property
* @param dataDefinedProperties map of data defined properties to QgsDataDefined in which to store properties from xml
* @note this method was added in version 2.5
/** Reads a pre 3.0 data defined property from an XML DOM element.
* @note this method was added in version 3.0
* @see readDataDefinedPropertyMap
*/
static void readDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, const QDomElement &ddElem,
QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >* dataDefinedProperties );

/** Writes data defined properties to xml
* @param itemElem DOM element in which to store data defined properties
* @param doc DOM document
* @param dataDefinedNames map of data defined property to name used within xml
* @param dataDefinedProperties map of data defined properties to QgsDataDefined for storing in xml
* @note this method was added in version 2.5
* @see readDataDefinedPropertyMap
*/
static void writeDataDefinedPropertyMap( QDomElement &itemElem, QDomDocument &doc,
const QMap< QgsComposerObject::DataDefinedProperty, QString >* dataDefinedNames,
const QMap< QgsComposerObject::DataDefinedProperty, QgsDataDefined* >* dataDefinedProperties );
static QgsAbstractProperty* readOldDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, const QDomElement &ddElem ) /Factory/;

/** Returns a font where size is set in pixels and the size has been upscaled with FONT_WORKAROUND_SCALE
* to workaround QT font rendering bugs
@@ -660,22 +660,6 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
*/
QList< QgsPaperItem* > pages();

/** Returns a reference to the data defined settings for one of the composition's data defined properties.
* @param property data defined property to return
* @note this method was added in version 2.5
*/
QgsDataDefined* dataDefinedProperty( const QgsComposerObject::DataDefinedProperty property );

/** Sets parameters for a data defined property for the composition
* @param property data defined property to set
* @param active true if data defined property is active, false if it is disabled
* @param useExpression true if the expression should be used
* @param expression expression for data defined property
* @param field field name if the data defined property should take its value from a field
* @note this method was added in version 2.5
*/
void setDataDefinedProperty( const QgsComposerObject::DataDefinedProperty property, bool active, bool useExpression, const QString &expression, const QString &field );

/** Returns the items model attached to the composition
* @returns QgsComposerModel for composition
* @note this method was added in version 2.5
@@ -775,6 +759,25 @@ class QgsComposition : QGraphicsScene, QgsExpressionContextGenerator
*/
QgsExpressionContext createExpressionContext() const;

/** Returns a reference to the composition's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
QgsPropertyCollection& dataDefinedProperties();

/** Returns a reference to the composition's property collection, used for data defined overrides.
* @note added in QGIS 3.0
* @see setDataDefinedProperties()
*/
//const QgsPropertyCollection& dataDefinedProperties() const;

/** Sets the composition's property collection, used for data defined overrides.
* @param collection property collection. Existing properties will be replaced.
* @note added in QGIS 3.0
* @see dataDefinedProperties()
*/
void setDataDefinedProperties( const QgsPropertyCollection& collection );

protected:
void init();

@@ -56,7 +56,7 @@ class QgsAbstractProperty

/** Returns a clone of the property.
*/
virtual QgsAbstractProperty* clone() = 0 /Factory/;
virtual QgsAbstractProperty* clone() const = 0 /Factory/;

/** Returns whether the property is currently active.
* @see setActive()
@@ -69,6 +69,12 @@ class QgsAbstractProperty
*/
void setActive( bool active );

/**
* Returns an expression string representing the state of the property, or an empty
* string if the property could not be converted to an expression
*/
virtual QString asExpression() const = 0;

/**
* Prepares the property against a specified expression context. Calling prepare before evaluating the
* property multiple times allows precalculation of expensive setup tasks such as parsing expressions.
@@ -93,6 +99,18 @@ class QgsAbstractProperty
*/
QVariant value( const QgsExpressionContext& context, const QVariant& defaultValue = QVariant() ) const;

/**
* Calculates the current value of the property and interprets it as a string.
* @param context QgsExpressionContext to evaluate the property for.
* @param defaultString default string to return if the property cannot be calculated as a string
* @param ok if specified, will be set to true if conversion was successful
* @returns value parsed to string
* @see value()
* @see valueAsDouble()
* @see valueAsInt()
*/
QString valueAsString( const QgsExpressionContext& context, const QString& defaultString = QString(), bool* ok /Out/ = nullptr ) const;

/** Calculates the current value of the property and interprets it as a color.
* @param context QgsExpressionContext to evaluate the property for.
* @param defaultColor default color to return if the property cannot be calculated as a color
@@ -101,7 +119,7 @@ class QgsAbstractProperty
* @see valueAsDouble()
* @see valueAsInt()
*/
QColor valueAsColor( const QgsExpressionContext& context, const QColor& defaultColor = QColor() ) const;
QColor valueAsColor( const QgsExpressionContext& context, const QColor& defaultColor = QColor(), bool* ok /Out/ = nullptr ) const;

/** Calculates the current value of the property and interprets it as a double.
* @param context QgsExpressionContext to evaluate the property for.
@@ -111,7 +129,7 @@ class QgsAbstractProperty
* @see valueAsInt()
* @see valueAsColor()
*/
double valueAsDouble( const QgsExpressionContext& context, double defaultValue = 0.0 ) const;
double valueAsDouble( const QgsExpressionContext& context, double defaultValue = 0.0, bool* ok /Out/ = nullptr ) const;

/** Calculates the current value of the property and interprets it as an integer.
* @param context QgsExpressionContext to evaluate the property for.
@@ -121,7 +139,7 @@ class QgsAbstractProperty
* @see valueAsDouble()
* @see valueAsColor()
*/
int valueAsInt( const QgsExpressionContext& context, int defaultValue = 0 ) const;
int valueAsInt( const QgsExpressionContext& context, int defaultValue = 0, bool* ok /Out/ = nullptr ) const;

/**
* Calculates the current value of the property and interprets it as an boolean.
@@ -132,7 +150,7 @@ class QgsAbstractProperty
* @see valueAsDouble()
* @see valueAsColor()
*/
bool valueAsBool( const QgsExpressionContext& context, bool defaultValue = false ) const;
bool valueAsBool( const QgsExpressionContext& context, bool defaultValue = false, bool* ok /Out/ = nullptr ) const;

/** Writes the current state of the property into an XML element
* @param propertyElem destination element for the property's state
@@ -197,7 +215,8 @@ class QgsStaticProperty : QgsAbstractProperty

virtual Type propertyType() const;

virtual QgsStaticProperty* clone() /Factory/;
virtual QgsStaticProperty* clone() const /Factory/;
virtual QString asExpression() const;

/** Sets the static value for the property.
* @param value property value
@@ -238,11 +257,12 @@ class QgsFieldBasedProperty : QgsAbstractProperty
* @param field field name
* @param isActive whether the property is intially active
*/
QgsFieldBasedProperty( const QString& field = QString(), bool isActive = false );
QgsFieldBasedProperty( const QString& field = QString(), bool isActive = true );

virtual Type propertyType() const;

virtual QgsFieldBasedProperty* clone() /Factory/;
virtual QgsFieldBasedProperty* clone() const /Factory/;
virtual QString asExpression() const;

/** Sets the field name the property references.
* @param field field name
@@ -285,11 +305,12 @@ class QgsExpressionBasedProperty : QgsAbstractProperty
* @param expression expression string
* @param isActive whether the property is intially active
*/
QgsExpressionBasedProperty( const QString& expression = QString(), bool isActive = false );
QgsExpressionBasedProperty( const QString& expression = QString(), bool isActive = true );

virtual Type propertyType() const;

virtual QgsExpressionBasedProperty* clone() /Factory/;
virtual QgsExpressionBasedProperty* clone() const /Factory/;
virtual QString asExpression() const;

/** Sets the expression to use for the property value.
* @param expression expression string
@@ -88,6 +88,20 @@ class QgsAbstractPropertyCollection
*/
virtual QVariant value( int key, const QgsExpressionContext& context, const QVariant& defaultValue = QVariant() ) const = 0;

/**
* Calculates the current value of the property with the specified key and interprets it as a string.
* @param key integer key for property to return. The intended use case is that a context specific enum is cast to
* int and used for the key value.
* @param context QgsExpressionContext to evaluate the property for.
* @param defaultValue default string to return if the property cannot be calculated as a string
* @param ok if specified, will be set to true if conversion was successful
* @returns value parsed to string
* @see value()
* @see valueAsInteger()
* @see valueAsColor()
*/
QString valueAsString( int key, const QgsExpressionContext& context, const QString& defaultString = QString(), bool* ok /Out/ = nullptr ) const;


/**
* Calculates the current value of the property with the specified key and interprets it as a color.
@@ -100,7 +114,7 @@ class QgsAbstractPropertyCollection
* @see valueAsDouble()
* @see valueAsInteger()
*/
QColor valueAsColor( int key, const QgsExpressionContext& context, const QColor& defaultColor = QColor() ) const;
QColor valueAsColor( int key, const QgsExpressionContext& context, const QColor& defaultColor = QColor(), bool* ok /Out/ = nullptr ) const;

/**
* Calculates the current value of the property with the specified key and interprets it as a double.
@@ -113,7 +127,7 @@ class QgsAbstractPropertyCollection
* @see valueAsInteger()
* @see valueAsColor()
*/
double valueAsDouble( int key, const QgsExpressionContext& context, double defaultValue = 0.0 ) const;
double valueAsDouble( int key, const QgsExpressionContext& context, double defaultValue = 0.0, bool* ok /Out/ = nullptr ) const;

/**
* Calculates the current value of the property with the specified key and interprets it as an integer.
@@ -126,7 +140,7 @@ class QgsAbstractPropertyCollection
* @see valueAsDouble()
* @see valueAsColor()
*/
int valueAsInt( int key, const QgsExpressionContext& context, int defaultValue = 0 ) const;
int valueAsInt( int key, const QgsExpressionContext& context, int defaultValue = 0, bool* ok /Out/ = nullptr ) const;

/**
* Calculates the current value of the property with the specified key and interprets it as an boolean.
@@ -139,7 +153,7 @@ class QgsAbstractPropertyCollection
* @see valueAsDouble()
* @see valueAsColor()
*/
bool valueAsBool( int key, const QgsExpressionContext& context, bool defaultValue = false ) const;
bool valueAsBool( int key, const QgsExpressionContext& context, bool defaultValue = false, bool* ok /Out/ = nullptr ) const;


/**
@@ -164,14 +178,14 @@ class QgsAbstractPropertyCollection

/**
* Returns true if the collection has any active properties, or false if all properties
* within the collection are deactived.
* within the collection are deactivated.
* @see hasActiveDynamicProperties()
*/
virtual bool hasActiveProperties() const = 0;

/**
* Returns true if the collection has any active, non-static properties, or false if either all non-static properties
* within the collection are deactived or if the collection only contains static properties.
* within the collection are deactivated or if the collection only contains static properties.
* @see hasActiveProperties()
*/
virtual bool hasActiveDynamicProperties() const = 0;
@@ -323,14 +337,14 @@ class QgsPropertyCollectionStack : QgsAbstractPropertyCollection
QgsPropertyCollection* collection( const QString& name );

/** Returns true if the collection has any active properties, or false if all properties
* within the collection are deactived.
* within the collection are deactivated.
* @see hasActiveProperty()
* @see hasActiveDynamicProperties()
*/
bool hasActiveProperties() const;

/** Returns true if the collection has any active, non-static properties, or false if either all non-static properties
* within the collection are deactived or if the collection only contains static properties.
* within the collection are deactivated or if the collection only contains static properties.
* @see hasActiveProperties()
*/
bool hasActiveDynamicProperties() const;
@@ -33,7 +33,7 @@ class Qgs25DRenderer : QgsFeatureRenderer
void startRender( QgsRenderContext& context, const QgsFields& fields );
void stopRender( QgsRenderContext& context );

QSet<QString> usedAttributes() const;
QSet<QString> usedAttributes( const QgsRenderContext& context ) const;
QgsFeatureRenderer* clone() const;

virtual QgsSymbol* symbolForFeature( QgsFeature& feature, QgsRenderContext& context );
@@ -32,7 +32,7 @@ class QgsArrowSymbolLayer : public QgsLineSymbolLayer
virtual bool setSubSymbol( QgsSymbol* symbol /Transfer/ );

/** Return a list of attributes required to render this feature */
virtual QSet<QString> usedAttributes() const;
virtual QSet<QString> usedAttributes( const QgsRenderContext& context ) const;

/** Get current arrow width */
double arrowWidth() const;
@@ -59,7 +59,7 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer

virtual void stopRender( QgsRenderContext& context );

virtual QSet<QString> usedAttributes() const;
virtual QSet<QString> usedAttributes( const QgsRenderContext& context ) const;

virtual QString dump() const;

0 comments on commit ad23240

Please sign in to comment.