Skip to content
Permalink
Browse files

More const-corretness for QgsFeatureRenderer

  • Loading branch information
m-kuhn committed Apr 18, 2018
1 parent 3775cdb commit 7123803d07ddd50bde0b9c14959cb67dc80574db
Showing with 179 additions and 179 deletions.
  1. +1 −1 python/core/symbology/qgs25drenderer.sip.in
  2. +3 −3 python/core/symbology/qgscategorizedsymbolrenderer.sip.in
  3. +3 −3 python/core/symbology/qgsgraduatedsymbolrenderer.sip.in
  4. +2 −2 python/core/symbology/qgsheatmaprenderer.sip.in
  5. +6 −6 python/core/symbology/qgsinvertedpolygonrenderer.sip.in
  6. +4 −4 python/core/symbology/qgsnullsymbolrenderer.sip.in
  7. +7 −7 python/core/symbology/qgspointdistancerenderer.sip.in
  8. +8 −8 python/core/symbology/qgsrenderer.sip.in
  9. +13 −13 python/core/symbology/qgsrulebasedrenderer.sip.in
  10. +3 −3 python/core/symbology/qgssinglesymbolrenderer.sip.in
  11. +1 −1 src/core/symbology/qgs25drenderer.cpp
  12. +1 −1 src/core/symbology/qgs25drenderer.h
  13. +4 −4 src/core/symbology/qgscategorizedsymbolrenderer.cpp
  14. +4 −4 src/core/symbology/qgscategorizedsymbolrenderer.h
  15. +4 −4 src/core/symbology/qgsgraduatedsymbolrenderer.cpp
  16. +4 −4 src/core/symbology/qgsgraduatedsymbolrenderer.h
  17. +2 −2 src/core/symbology/qgsheatmaprenderer.cpp
  18. +2 −2 src/core/symbology/qgsheatmaprenderer.h
  19. +9 −9 src/core/symbology/qgsinvertedpolygonrenderer.cpp
  20. +7 −7 src/core/symbology/qgsinvertedpolygonrenderer.h
  21. +4 −4 src/core/symbology/qgsnullsymbolrenderer.cpp
  22. +4 −4 src/core/symbology/qgsnullsymbolrenderer.h
  23. +12 −12 src/core/symbology/qgspointdistancerenderer.cpp
  24. +8 −8 src/core/symbology/qgspointdistancerenderer.h
  25. +10 −10 src/core/symbology/qgsrenderer.cpp
  26. +8 −8 src/core/symbology/qgsrenderer.h
  27. +26 −26 src/core/symbology/qgsrulebasedrenderer.cpp
  28. +13 −13 src/core/symbology/qgsrulebasedrenderer.h
  29. +3 −3 src/core/symbology/qgssinglesymbolrenderer.cpp
  30. +3 −3 src/core/symbology/qgssinglesymbolrenderer.h
@@ -37,7 +37,7 @@ Create a new 2.5D renderer from XML
virtual QgsFeatureRenderer *clone() const /Factory/;


virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbolList symbols( QgsRenderContext &context ) const;

@@ -83,9 +83,9 @@ class QgsCategorizedSymbolRenderer : QgsFeatureRenderer

QgsCategorizedSymbolRenderer( const QString &attrName = QString(), const QgsCategoryList &categories = QgsCategoryList() );

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual void startRender( QgsRenderContext &context, const QgsFields &fields );

@@ -163,7 +163,7 @@ create renderer from XML element

virtual QgsLegendSymbolList legendSymbolItems() const;

virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;


QgsSymbol *sourceSymbol();
@@ -120,9 +120,9 @@ class QgsGraduatedSymbolRenderer : QgsFeatureRenderer

~QgsGraduatedSymbolRenderer();

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual void startRender( QgsRenderContext &context, const QgsFields &fields );

@@ -292,7 +292,7 @@ create renderer from XML element

virtual QgsLegendSymbolList legendSymbolItems() const;

virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;


QgsSymbol *sourceSymbol();
@@ -29,11 +29,11 @@ class QgsHeatmapRenderer : QgsFeatureRenderer

virtual void startRender( QgsRenderContext &context, const QgsFields &fields );

virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

virtual void stopRender( QgsRenderContext &context );

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring

@@ -46,7 +46,7 @@ Direct copies are forbidden. Use clone() instead.
virtual void startRender( QgsRenderContext &context, const QgsFields &fields );


virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

%Docstring
Renders a given feature.
@@ -88,25 +88,25 @@ Proxy that will call this method on the embedded renderer.
Proxy that will call this method on the embedded renderer.
%End

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
Proxy that will call this method on the embedded renderer.
%End

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
Proxy that will call this method on the embedded renderer.
%End

virtual QgsSymbolList symbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
Proxy that will call this method on the embedded renderer.
%End

virtual QgsSymbolList originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList originalSymbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
Proxy that will call this method on the embedded renderer.
@@ -118,7 +118,7 @@ Proxy that will call this method on the embedded renderer.
Proxy that will call this method on the embedded renderer.
%End

virtual bool willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
Proxy that will call this method on the embedded renderer.
@@ -24,16 +24,16 @@ and diagrams for the layer. Selected features will also be drawn with a default

QgsNullSymbolRenderer();

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;


virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

virtual void stopRender( QgsRenderContext &context );

virtual bool willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;


virtual QSet<QString> usedAttributes( const QgsRenderContext &context ) const;
@@ -65,25 +65,25 @@ Constructor for QgsPointDistanceRenderer.

virtual void toSld( QDomDocument &doc, QDomElement &element, const QgsStringMap &props = QgsStringMap() ) const;

virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

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

virtual QgsFeatureRenderer::Capabilities capabilities();

virtual QgsSymbolList symbols( QgsRenderContext &context ) const;

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbolList symbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbolList originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList originalSymbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual bool willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual void startRender( QgsRenderContext &context, const QgsFields &fields );

@@ -78,7 +78,7 @@ return a new renderer - used by default in vector layers

QString type() const;

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const = 0;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const = 0;
%Docstring
To be overridden

@@ -92,7 +92,7 @@ Must be called between startRender() and stopRender() calls.
.. versionadded:: 2.12
%End

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
%Docstring
Return symbol for feature. The difference compared to symbolForFeature() is that it returns original
symbol which can be used as an identifier for renderer's rule - the former may return a temporary replacement
@@ -101,7 +101,7 @@ of a symbol for use in rendering.
.. versionadded:: 2.12
%End

virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
%Docstring
Return legend keys matching a specified feature.

@@ -175,7 +175,7 @@ and generate a proper subclass.
:return: A copy of this renderer
%End

virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
%Docstring
Render a feature using this renderer in the given context.
Must be called between startRender() and stopRender() calls.
@@ -320,7 +320,7 @@ If supported by the renderer, return classification attribute for the use in leg
set type and size of editing vertex markers for subsequent rendering
%End

virtual bool willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
%Docstring
Returns whether the renderer will render a feature or not.
Must be called between startRender() and stopRender() calls.
@@ -329,7 +329,7 @@ Default implementation uses symbolForFeature().
.. versionadded:: 2.12
%End

virtual QgsSymbolList symbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
%Docstring
Returns list of symbols used for rendering the feature.
For renderers that do not support MoreSymbolsPerFeature it is more efficient
@@ -338,7 +338,7 @@ to use symbolForFeature()
.. versionadded:: 2.12
%End

virtual QgsSymbolList originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList originalSymbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;
%Docstring
Equivalent of originalSymbolsForFeature() call
extended to support renderers that may use more symbols per feature - similar to symbolsForFeature()
@@ -476,7 +476,7 @@ implementation does not use subrenderers and will always return null.
protected:
QgsFeatureRenderer( const QString &type );

void renderFeatureWithSymbol( QgsFeature &feature,
void renderFeatureWithSymbol( const QgsFeature &feature,
QgsSymbol *symbol,
QgsRenderContext &context,
int layer,
@@ -31,7 +31,7 @@ the rules and draws features with symbols from rules that match.

struct FeatureToRender
{
FeatureToRender( QgsFeature &_f, int _flags );
FeatureToRender( const QgsFeature &_f, int _flags );
QgsFeature feat;
int flags; // selected and/or draw markers
};
@@ -130,7 +130,7 @@ Returns true if this rule or one of its chilren needs the geometry to be applied
.. versionadded:: 2.6
%End

bool isFilterOK( QgsFeature &f, QgsRenderContext *context = 0 ) const;
bool isFilterOK( const QgsFeature &f, QgsRenderContext *context = 0 ) const;
%Docstring
Check if a given feature shall be rendered by this rule

@@ -307,29 +307,29 @@ Render a given feature, will recursively call subclasses and only render if the
the reason for not rendering the feature.
%End

bool willRenderFeature( QgsFeature &feat, QgsRenderContext *context = 0 );
bool willRenderFeature( const QgsFeature &feature, QgsRenderContext *context = 0 );
%Docstring
only tell whether a feature will be rendered without actually rendering it
%End

QgsSymbolList symbolsForFeature( QgsFeature &feat, QgsRenderContext *context = 0 );
QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext *context = 0 );
%Docstring
tell which symbols will be used to render the feature
%End

QSet< QString > legendKeysForFeature( QgsFeature &feat, QgsRenderContext *context = 0 );
QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext *context = 0 );
%Docstring
Returns which legend keys match the feature

.. versionadded:: 2.14
%End

QgsRuleBasedRenderer::RuleList rulesForFeature( QgsFeature &feat, QgsRenderContext *context = 0, bool onlyActive = true );
QgsRuleBasedRenderer::RuleList rulesForFeature( const QgsFeature &feature, QgsRenderContext *context = 0, bool onlyActive = true );
%Docstring
Returns the list of rules used to render the feature in a specific
context.

:param feat: The feature for which rules have to be find
:param feature: The feature for which rules have to be find
:param context: The rendering context
:param onlyActive: True to search for active rules only, false otherwise
%End
@@ -447,13 +447,13 @@ Constructor for convenience. Creates a root rule and adds a default rule with sy

~QgsRuleBasedRenderer();

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

%Docstring
return symbol for current feature. Should not be used individually: there could be more symbols for a feature
%End

virtual bool renderFeature( QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );
virtual bool renderFeature( const QgsFeature &feature, QgsRenderContext &context, int layer = -1, bool selected = false, bool drawVertexMarker = false );


virtual void startRender( QgsRenderContext &context, const QgsFields &fields );
@@ -497,13 +497,13 @@ return symbol for current feature. Should not be used individually: there could

virtual QString dump() const;

virtual bool willRenderFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual bool willRenderFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbolList symbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList symbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbolList originalSymbolsForFeature( QgsFeature &feat, QgsRenderContext &context ) const;
virtual QgsSymbolList originalSymbolsForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QSet<QString> legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet<QString> legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsFeatureRenderer::Capabilities capabilities();

@@ -17,9 +17,9 @@ class QgsSingleSymbolRenderer : QgsFeatureRenderer

QgsSingleSymbolRenderer( QgsSymbol *symbol /Transfer/ );

virtual QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual QgsSymbol *originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QgsSymbol *originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual void startRender( QgsRenderContext &context, const QgsFields &fields );

@@ -53,7 +53,7 @@ create renderer from XML element

virtual QgsLegendSymbolList legendSymbolItems() const;

virtual QSet< QString > legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const;
virtual QSet< QString > legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const;

virtual void setLegendSymbolItem( const QString &key, QgsSymbol *symbol /Transfer/ );

@@ -162,7 +162,7 @@ QgsFeatureRenderer *Qgs25DRenderer::clone() const
return c;
}

QgsSymbol *Qgs25DRenderer::symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const
QgsSymbol *Qgs25DRenderer::symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
{
Q_UNUSED( feature )
Q_UNUSED( context )
@@ -45,7 +45,7 @@ class CORE_EXPORT Qgs25DRenderer : public QgsFeatureRenderer
QSet<QString> usedAttributes( const QgsRenderContext &context ) const override;
QgsFeatureRenderer *clone() const override SIP_FACTORY;

QgsSymbol *symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const override;
QgsSymbol *symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const override;
QgsSymbolList symbols( QgsRenderContext &context ) const override;

/**
@@ -207,12 +207,12 @@ QgsSymbol *QgsCategorizedSymbolRenderer::symbolForValue( const QVariant &value,
return *it;
}

QgsSymbol *QgsCategorizedSymbolRenderer::symbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const
QgsSymbol *QgsCategorizedSymbolRenderer::symbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
{
return originalSymbolForFeature( feature, context );
}

QVariant QgsCategorizedSymbolRenderer::valueForFeature( QgsFeature &feature, QgsRenderContext &context ) const
QVariant QgsCategorizedSymbolRenderer::valueForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
{
QgsAttributes attrs = feature.attributes();
QVariant value;
@@ -230,7 +230,7 @@ QVariant QgsCategorizedSymbolRenderer::valueForFeature( QgsFeature &feature, Qgs
return value;
}

QgsSymbol *QgsCategorizedSymbolRenderer::originalSymbolForFeature( QgsFeature &feature, QgsRenderContext &context ) const
QgsSymbol *QgsCategorizedSymbolRenderer::originalSymbolForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
{
QVariant value = valueForFeature( feature, context );

@@ -789,7 +789,7 @@ QgsLegendSymbolList QgsCategorizedSymbolRenderer::legendSymbolItems() const
return baseLegendSymbolItems();
}

QSet<QString> QgsCategorizedSymbolRenderer::legendKeysForFeature( QgsFeature &feature, QgsRenderContext &context ) const
QSet<QString> QgsCategorizedSymbolRenderer::legendKeysForFeature( const QgsFeature &feature, QgsRenderContext &context ) const
{
QString value = valueForFeature( feature, context ).toString();
int i = 0;

0 comments on commit 7123803

Please sign in to comment.
You can’t perform that action at this time.