Skip to content

Commit

Permalink
symbology-ng: make dump() methods const
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Jul 22, 2013
1 parent aa7c428 commit cf22bcf
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 29 deletions.
4 changes: 2 additions & 2 deletions python/core/symbology-ng/qgscategorizedsymbolrendererv2.sip
Expand Up @@ -22,7 +22,7 @@ class QgsRendererCategoryV2
void setLabel( const QString &label );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
};
Expand All @@ -49,7 +49,7 @@ class QgsCategorizedSymbolRendererV2 : QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down
5 changes: 3 additions & 2 deletions python/core/symbology-ng/qgsgraduatedsymbolrendererv2.sip
Expand Up @@ -22,7 +22,7 @@ class QgsRendererRangeV2
void setUpperValue( double upperValue );

// debugging
QString dump();
QString dump() const;

void toSld( QDomDocument& doc, QDomElement &element, QgsStringMap props ) const;
};
Expand All @@ -48,7 +48,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down Expand Up @@ -112,6 +112,7 @@ class QgsGraduatedSymbolRendererV2 : QgsFeatureRendererV2

//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note not available in python bindings
// virtual QgsLegendSymbolList legendSymbolItems();

QgsSymbolV2* sourceSymbol();
Expand Down
5 changes: 3 additions & 2 deletions python/core/symbology-ng/qgsrendererv2.sip
Expand Up @@ -70,15 +70,15 @@ class QgsFeatureRendererV2
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

//! for debugging
virtual QString dump();
virtual QString dump() const;

enum Capabilities
{
SymbolLevels = 1, // rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
RotationField = 2, // rotate symbols by attribute value
MoreSymbolsPerFeature = 4 // may use more than one symbol to render a feature: symbolsForFeature() will return them
Filter = 8, // features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)
ScaleDependent = 16 // dependends on scale if feature will be rendered (rule based )
ScaleDependent = 16 // depends on scale if feature will be rendered (rule based )
};

//! returns bitwise OR-ed capabilities of the renderer
Expand Down Expand Up @@ -123,6 +123,7 @@ class QgsFeatureRendererV2

//! return a list of item text / symbol
//! @note: this method was added in version 1.5
//! @note: not available in python bindings
// virtual QgsLegendSymbolList legendSymbolItems();

//! set type and size of editing vertex markers for subsequent rendering
Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgssinglesymbolrendererv2.sip
Expand Up @@ -35,7 +35,7 @@ class QgsSingleSymbolRendererV2 : QgsFeatureRendererV2
//! @note added in 2.0
QgsSymbolV2::ScaleMethod scaleMethod() const;

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone() /Factory/;

Expand Down
2 changes: 1 addition & 1 deletion python/core/symbology-ng/qgssymbolv2.sip
Expand Up @@ -83,7 +83,7 @@ class QgsSymbolV2

QImage bigSymbolPreviewImage();

QString dump();
QString dump() const;

virtual QgsSymbolV2* clone() const = 0 /Factory/;

Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.cpp
Expand Up @@ -97,7 +97,7 @@ void QgsRendererCategoryV2::setLabel( const QString &label )
mLabel = label;
}

QString QgsRendererCategoryV2::dump()
QString QgsRendererCategoryV2::dump() const
{
return QString( "%1::%2::%3\n" ).arg( mValue.toString() ).arg( mLabel ).arg( mSymbol->dump() );
}
Expand Down Expand Up @@ -425,7 +425,7 @@ QList<QString> QgsCategorizedSymbolRendererV2::usedAttributes()
return attributes.toList();
}

QString QgsCategorizedSymbolRendererV2::dump()
QString QgsCategorizedSymbolRendererV2::dump() const
{
QString s = QString( "CATEGORIZED: idx %1\n" ).arg( mAttrName );
for ( int i = 0; i < mCategories.count(); i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgscategorizedsymbolrendererv2.h
Expand Up @@ -48,7 +48,7 @@ class CORE_EXPORT QgsRendererCategoryV2
void setLabel( const QString &label );

// debugging
QString dump();
QString dump() const;

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

Expand Down Expand Up @@ -76,7 +76,7 @@ class CORE_EXPORT QgsCategorizedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone();

Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
Expand Up @@ -112,7 +112,7 @@ void QgsRendererRangeV2::setLowerValue( double lowerValue )
mLowerValue = lowerValue;
}

QString QgsRendererRangeV2::dump()
QString QgsRendererRangeV2::dump() const
{
return QString( "%1 - %2::%3::%4\n" ).arg( mLowerValue ).arg( mUpperValue ).arg( mLabel ).arg( mSymbol->dump() );
}
Expand Down Expand Up @@ -336,7 +336,7 @@ bool QgsGraduatedSymbolRendererV2::updateRangeLowerValue( int rangeIndex, double
return true;
}

QString QgsGraduatedSymbolRendererV2::dump()
QString QgsGraduatedSymbolRendererV2::dump() const
{
QString s = QString( "GRADUATED: attr %1\n" ).arg( mAttrName );
for ( int i = 0; i < mRanges.count(); i++ )
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsgraduatedsymbolrendererv2.h
Expand Up @@ -41,7 +41,7 @@ class CORE_EXPORT QgsRendererRangeV2
void setUpperValue( double upperValue );

// debugging
QString dump();
QString dump() const;

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

Expand Down Expand Up @@ -71,7 +71,7 @@ class CORE_EXPORT QgsGraduatedSymbolRendererV2 : public QgsFeatureRendererV2

virtual QList<QString> usedAttributes();

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone();

Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsrendererv2.cpp
Expand Up @@ -362,7 +362,7 @@ void QgsFeatureRendererV2::renderFeatureWithSymbol( QgsFeature& feature, QgsSymb
}
}

QString QgsFeatureRendererV2::dump()
QString QgsFeatureRendererV2::dump() const
{
return "UNKNOWN RENDERER\n";
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgsrendererv2.h
Expand Up @@ -94,15 +94,15 @@ class CORE_EXPORT QgsFeatureRendererV2
virtual bool renderFeature( QgsFeature& feature, QgsRenderContext& context, int layer = -1, bool selected = false, bool drawVertexMarker = false );

//! for debugging
virtual QString dump();
virtual QString dump() const;

enum Capabilities
{
SymbolLevels = 1, // rendering with symbol levels (i.e. implements symbols(), symbolForFeature())
RotationField = 1 << 1, // rotate symbols by attribute value
MoreSymbolsPerFeature = 1 << 2, // may use more than one symbol to render a feature: symbolsForFeature() will return them
Filter = 1 << 3, // features may be filtered, i.e. some features may not be rendered (categorized, rule based ...)
ScaleDependent = 1 << 4 // dependends on scale if feature will be rendered (rule based )
ScaleDependent = 1 << 4 // depends on scale if feature will be rendered (rule based )
};

//! returns bitwise OR-ed capabilities of the renderer
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsrulebasedrendererv2.cpp
Expand Up @@ -886,7 +886,7 @@ void QgsRuleBasedRendererV2::refineRuleScales( QgsRuleBasedRendererV2::Rule* ini
initialRule->appendChild( new Rule( symbol->clone(), oldScale, maxDenom, QString(), QString( "%1 - %2" ).arg( oldScale ).arg( maxDenom ) ) );
}

QString QgsRuleBasedRendererV2::dump()
QString QgsRuleBasedRendererV2::dump() const
{
QString msg( "Rule-based renderer:\n" );
msg += mRootRule->dump();
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgsrulebasedrendererv2.h
Expand Up @@ -223,7 +223,7 @@ class CORE_EXPORT QgsRuleBasedRendererV2 : public QgsFeatureRendererV2
virtual QgsLegendSymbolList legendSymbolItems();

//! for debugging
virtual QString dump();
virtual QString dump() const;

//! return whether the renderer will render a feature or not.
//! Must be called between startRender() and stopRender() calls.
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgssinglesymbolrendererv2.cpp
Expand Up @@ -173,7 +173,7 @@ void QgsSingleSymbolRendererV2::setScaleMethod( QgsSymbolV2::ScaleMethod scaleMe
setScaleMethodToSymbol( mSymbol, scaleMethod );
}

QString QgsSingleSymbolRendererV2::dump()
QString QgsSingleSymbolRendererV2::dump() const
{
if ( mSymbol )
{
Expand Down
2 changes: 1 addition & 1 deletion src/core/symbology-ng/qgssinglesymbolrendererv2.h
Expand Up @@ -53,7 +53,7 @@ class CORE_EXPORT QgsSingleSymbolRendererV2 : public QgsFeatureRendererV2
//! @note added in 2.0
QgsSymbolV2::ScaleMethod scaleMethod() const { return mScaleMethod; }

virtual QString dump();
virtual QString dump() const;

virtual QgsFeatureRendererV2* clone();

Expand Down
8 changes: 4 additions & 4 deletions src/core/symbology-ng/qgssymbolv2.cpp
Expand Up @@ -237,9 +237,9 @@ void QgsSymbolV2::setColor( const QColor& color )
}
}

QColor QgsSymbolV2::color()
QColor QgsSymbolV2::color() const
{
for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it )
{
// return color of the first unlocked layer
if ( !( *it )->isLocked() )
Expand Down Expand Up @@ -313,7 +313,7 @@ QImage QgsSymbolV2::bigSymbolPreviewImage()
}


QString QgsSymbolV2::dump()
QString QgsSymbolV2::dump() const
{
QString t;
switch ( type() )
Expand All @@ -325,7 +325,7 @@ QString QgsSymbolV2::dump()
}
QString s = QString( "%1 SYMBOL (%2 layers) color %3" ).arg( t ).arg( mLayers.count() ).arg( QgsSymbolLayerV2Utils::encodeColor( color() ) );

for ( QgsSymbolLayerV2List::iterator it = mLayers.begin(); it != mLayers.end(); ++it )
for ( QgsSymbolLayerV2List::const_iterator it = mLayers.begin(); it != mLayers.end(); ++it )
{
// TODO:
}
Expand Down
4 changes: 2 additions & 2 deletions src/core/symbology-ng/qgssymbolv2.h
Expand Up @@ -101,13 +101,13 @@ class CORE_EXPORT QgsSymbolV2
void stopRender( QgsRenderContext& context );

void setColor( const QColor& color );
QColor color();
QColor color() const;

void drawPreviewIcon( QPainter* painter, QSize size );

QImage bigSymbolPreviewImage();

QString dump();
QString dump() const;

virtual QgsSymbolV2* clone() const = 0;

Expand Down

0 comments on commit cf22bcf

Please sign in to comment.