Skip to content
Permalink
Browse files

Make QgsMapLayer::metadata() const

  • Loading branch information
nyalldawson committed Jul 14, 2016
1 parent 0935b58 commit 0d84ca74c533280aca0d0b4d433e8695ca480681
@@ -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>
@@ -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;
@@ -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();
@@ -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();
@@ -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 );
@@ -1672,7 +1672,7 @@ void QgsMapLayer::triggerRepaint()
emit repaintRequested();
}

QString QgsMapLayer::metadata()
QString QgsMapLayer::metadata() const
{
return QString();
}
@@ -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() ; }
@@ -3760,7 +3760,7 @@ void QgsVectorLayer::setDiagramLayerSettings( const QgsDiagramLayerSettings& s )
*mDiagramLayerSettings = s;
}

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

@@ -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; }
@@ -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 );
}
@@ -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>";
@@ -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 );

@@ -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" );
@@ -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();
@@ -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 );

0 comments on commit 0d84ca7

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