Skip to content

Commit

Permalink
Make QgsMapLayer::metadata() const
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Jul 14, 2016
1 parent 0935b58 commit 0d84ca7
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc/api_break.dox
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ only affects third party c++ providers, and does not affect PyQGIS scripts.</li>
<li>toggleScaleBasedVisibility() was replaced by setScaleBasedVisibility()</li>
<li>lastErrorTitle(), lastError(), cacheImage(), onCacheImageDelete(), clearCacheImage() and the signals drawingProgress(),
screenUpdateRequested() were removed. These members have had no effect for a number of QGIS 2.x releases.</li>
<li>extent(), styleURI(), exportNamedStyle(), exportSldStyle(), writeXml() were made const. This has no effect on PyQGIS code, but c++ code implementing derived layer classes will need to update the signatures of these methods to match.</li>
<li>extent(), styleURI(), exportNamedStyle(), exportSldStyle(), writeXml(), metadata() were made const. This has no effect on PyQGIS code, but c++ code implementing derived layer classes will need to update the signatures of these methods to match.</li>
<li>The lyrname parameter in the QgsMapLayer constructor was renamed to 'name'.</li>
<li>The vis parameter in setSubLayerVisibility was renamed to 'visible'.</li>
<li>theResultFlag parameter in loadDefaultStyle and saveDefaultStyle were renamed to resultFlag.</li>
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsmaplayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ class QgsMapLayer : QObject
void triggerRepaint();

/** \brief Obtain Metadata for this layer */
virtual QString metadata();
virtual QString metadata() const;

/** Time stamp of data source in the moment when data/metadata were loaded by provider */
virtual QDateTime timestamp() const;
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsvectorlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -1379,7 +1379,7 @@ class QgsVectorLayer : QgsMapLayer
/** Returns the current transparency for the vector layer */
int layerTransparency() const;

QString metadata();
QString metadata() const;

/** @note not available in python bindings */
// inline QgsGeometryCache* cache();
Expand Down
4 changes: 2 additions & 2 deletions python/core/raster/qgsrasterlayer.sip
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class QgsRasterLayer : QgsMapLayer
int bandCount() const;

/** \brief Get the name of a band given its number */
const QString bandName( int theBandNoInt );
QString bandName( int theBandNoInt ) const;

/** Returns the data provider */
QgsRasterDataProvider* dataProvider();
Expand Down Expand Up @@ -147,7 +147,7 @@ class QgsRasterLayer : QgsMapLayer
virtual bool isSpatial() const;

/** \brief Obtain GDAL Metadata for this layer */
QString metadata();
QString metadata() const;

/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
QPixmap paletteAsPixmap( int theBandNumber = 1 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ void QgsMapLayer::triggerRepaint()
emit repaintRequested();
}

QString QgsMapLayer::metadata()
QString QgsMapLayer::metadata() const
{
return QString();
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsmaplayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ class CORE_EXPORT QgsMapLayer : public QObject
void triggerRepaint();

/** \brief Obtain Metadata for this layer */
virtual QString metadata();
virtual QString metadata() const;

/** Time stamp of data source in the moment when data/metadata were loaded by provider */
virtual QDateTime timestamp() const { return QDateTime() ; }
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3760,7 +3760,7 @@ void QgsVectorLayer::setDiagramLayerSettings( const QgsDiagramLayerSettings& s )
*mDiagramLayerSettings = s;
}

QString QgsVectorLayer::metadata()
QString QgsVectorLayer::metadata() const
{
QString myMetadata = "<html><body>";

Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -1772,7 +1772,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
/** Returns the current transparency for the vector layer */
int layerTransparency() const;

QString metadata() override;
QString metadata() const override;

/** @note not available in python bindings */
inline QgsGeometryCache* cache() { return mCache; }
Expand Down
9 changes: 5 additions & 4 deletions src/core/raster/qgsrasterlayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ int QgsRasterLayer::bandCount() const
return mDataProvider->bandCount();
}

const QString QgsRasterLayer::bandName( int theBandNo )
QString QgsRasterLayer::bandName( int theBandNo ) const
{
return dataProvider()->generateBandName( theBandNo );
}
Expand Down Expand Up @@ -316,8 +316,9 @@ QgsLegendColorList QgsRasterLayer::legendSymbologyItems() const
return symbolList;
}

QString QgsRasterLayer::metadata()
QString QgsRasterLayer::metadata() const
{
QgsRasterDataProvider* provider = const_cast< QgsRasterDataProvider* >( mDataProvider );
QString myMetadata;
myMetadata += "<p class=\"glossy\">" + tr( "Driver" ) + "</p>\n";
myMetadata += "<p>";
Expand Down Expand Up @@ -442,7 +443,7 @@ QString QgsRasterLayer::metadata()
myMetadata += "</p>\n";

//check if full stats for this layer have already been collected
if ( !dataProvider()->hasStatistics( myIteratorInt ) ) //not collected
if ( !provider->hasStatistics( myIteratorInt ) ) //not collected
{
QgsDebugMsgLevel( ".....no", 4 );

Expand All @@ -457,7 +458,7 @@ QString QgsRasterLayer::metadata()
{
QgsDebugMsgLevel( ".....yes", 4 );

QgsRasterBandStats myRasterBandStats = dataProvider()->bandStatistics( myIteratorInt );
QgsRasterBandStats myRasterBandStats = provider->bandStatistics( myIteratorInt );
//Min Val
myMetadata += "<p>";
myMetadata += tr( "Min Val" );
Expand Down
4 changes: 2 additions & 2 deletions src/core/raster/qgsrasterlayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
int bandCount() const;

/** \brief Get the name of a band given its number */
const QString bandName( int theBandNoInt );
QString bandName( int theBandNoInt ) const;

/** Returns the data provider */
QgsRasterDataProvider* dataProvider();
Expand Down Expand Up @@ -283,7 +283,7 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
virtual bool isSpatial() const override { return true; }

/** \brief Obtain GDAL Metadata for this layer */
QString metadata() override;
QString metadata() const override;

/** \brief Get an 100x100 pixmap of the color palette. If the layer has no palette a white pixmap will be returned */
QPixmap paletteAsPixmap( int theBandNumber = 1 );
Expand Down

0 comments on commit 0d84ca7

Please sign in to comment.