Skip to content

Commit

Permalink
More const-corretness for QgsFeatureRenderer
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Apr 18, 2018
1 parent 3775cdb commit 7123803
Show file tree
Hide file tree
Showing 30 changed files with 179 additions and 179 deletions.
2 changes: 1 addition & 1 deletion python/core/symbology/qgs25drenderer.sip.in
Expand Up @@ -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;

Expand Down
6 changes: 3 additions & 3 deletions python/core/symbology/qgscategorizedsymbolrenderer.sip.in
Expand Up @@ -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 );

Expand Down Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions python/core/symbology/qgsgraduatedsymbolrenderer.sip.in
Expand Up @@ -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 );

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions python/core/symbology/qgsheatmaprenderer.sip.in
Expand Up @@ -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

Expand Down
12 changes: 6 additions & 6 deletions python/core/symbology/qgsinvertedpolygonrenderer.sip.in
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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.
Expand Down
8 changes: 4 additions & 4 deletions python/core/symbology/qgsnullsymbolrenderer.sip.in
Expand Up @@ -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;
Expand Down
14 changes: 7 additions & 7 deletions python/core/symbology/qgspointdistancerenderer.sip.in
Expand Up @@ -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 );

Expand Down
16 changes: 8 additions & 8 deletions python/core/symbology/qgsrenderer.sip.in
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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.

Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand All @@ -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
Expand All @@ -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()
Expand Down Expand Up @@ -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,
Expand Down
26 changes: 13 additions & 13 deletions python/core/symbology/qgsrulebasedrenderer.sip.in
Expand Up @@ -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
};
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down Expand Up @@ -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();

Expand Down
6 changes: 3 additions & 3 deletions python/core/symbology/qgssinglesymbolrenderer.sip.in
Expand Up @@ -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 );

Expand Down Expand Up @@ -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/ );

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgs25drenderer.cpp
Expand Up @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology/qgs25drenderer.h
Expand Up @@ -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;

/**
Expand Down
8 changes: 4 additions & 4 deletions src/core/symbology/qgscategorizedsymbolrenderer.cpp
Expand Up @@ -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;
Expand All @@ -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 );

Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 7123803

Please sign in to comment.