Skip to content

Commit

Permalink
Merge pull request #4067 from nyalldawson/raster_ctor
Browse files Browse the repository at this point in the history
Remove duplicate QgsRasterLayer constructor
  • Loading branch information
nyalldawson committed Jan 27, 2017
2 parents 0341478 + 6c7e2f1 commit f4a9797
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 58 deletions.
3 changes: 3 additions & 0 deletions doc/api_break.dox
Expand Up @@ -1576,6 +1576,9 @@ QgsRasterInterface {#qgis_api_break_3_0_QgsRasterInterface}
QgsRasterLayer {#qgis_api_break_3_0_QgsRasterLayer}
--------------

- The constructor variant with loadDefaultStyleFlag as the 3rd parameter was removed. Use the
constructor variant which accepts a data provider string and loadDefaultStyleFlag as the
4th parameter instead.
- setDrawingStyle() was removed. Use setRendererForDrawingStyle() or setRenderer() instead.
- previewAsPixmap() was removed. Use previewAsImage() instead.
- updateProgress() had no effect and was removed.
Expand Down
2 changes: 1 addition & 1 deletion python/core/qgsvectorlayer.sip
Expand Up @@ -357,7 +357,7 @@ class QgsVectorLayer : QgsMapLayer, QgsExpressionContextGenerator
*
*/
QgsVectorLayer( const QString& path = QString::null, const QString& baseName = QString::null,
const QString& providerLib = QString::null, bool loadDefaultStyleFlag = true );
const QString& providerLib = "ogr", bool loadDefaultStyleFlag = true );

/** Destructor */
virtual ~QgsVectorLayer();
Expand Down
14 changes: 2 additions & 12 deletions python/core/raster/qgsrasterlayer.sip
Expand Up @@ -33,19 +33,9 @@ class QgsRasterLayer : QgsMapLayer
*
* -
* */
QgsRasterLayer( const QString &path,
const QString &baseName = QString::null,
bool loadDefaultStyleFlag = true );

//TODO - QGIS 3.0
//This constructor is confusing if used with string literals for providerKey,
//as the previous constructor will be called with the literal for providerKey
//implicitly converted to a bool.
//for QGIS 3.0, make either constructor explicit or alter the signatures
/** \brief [ data provider interface ] Constructor in provider mode */
QgsRasterLayer( const QString &uri,
const QString &baseName,
const QString &providerKey,
const QString &baseName = QString(),
const QString &providerKey = "gdal",
bool loadDefaultStyleFlag = true );

/** \brief The destructor */
Expand Down
2 changes: 1 addition & 1 deletion src/core/qgsvectorlayer.h
Expand Up @@ -453,7 +453,7 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer, public QgsExpressionConte
*
*/
QgsVectorLayer( const QString& path = QString::null, const QString& baseName = QString::null,
const QString& providerLib = QString::null, bool loadDefaultStyleFlag = true );
const QString& providerLib = "ogr", bool loadDefaultStyleFlag = true );


virtual ~QgsVectorLayer();
Expand Down
32 changes: 0 additions & 32 deletions src/core/raster/qgsrasterlayer.cpp
Expand Up @@ -104,38 +104,6 @@ QgsRasterLayer::QgsRasterLayer()
mValid = false;
}

QgsRasterLayer::QgsRasterLayer(
const QString& path,
const QString& baseName,
bool loadDefaultStyleFlag )
: QgsMapLayer( RasterLayer, baseName, path )
, QSTRING_NOT_SET( QStringLiteral( "Not Set" ) )
, TRSTRING_NOT_SET( tr( "Not Set" ) )
, mDataProvider( nullptr )
{
QgsDebugMsgLevel( "Entered", 4 );

// TODO, call constructor with provider key
init();
setDataProvider( QStringLiteral( "gdal" ) );
if ( !mValid ) return;

bool defaultLoadedFlag = false;
if ( mValid && loadDefaultStyleFlag )
{
loadDefaultStyle( defaultLoadedFlag );
}
if ( !defaultLoadedFlag )
{
setDefaultContrastEnhancement();
}
return;
} // QgsRasterLayer ctor

/**
* @todo Rename into a general constructor when the old raster interface is retired
* parameter dummy is just there to distinguish this function signature from the old non-provider one.
*/
QgsRasterLayer::QgsRasterLayer( const QString & uri,
const QString & baseName,
const QString & providerKey,
Expand Down
14 changes: 2 additions & 12 deletions src/core/raster/qgsrasterlayer.h
Expand Up @@ -179,19 +179,9 @@ class CORE_EXPORT QgsRasterLayer : public QgsMapLayer
*
* -
* */
QgsRasterLayer( const QString &path,
const QString &baseName = QString::null,
bool loadDefaultStyleFlag = true );

//TODO - QGIS 3.0
//This constructor is confusing if used with string literals for providerKey,
//as the previous constructor will be called with the literal for providerKey
//implicitly converted to a bool.
//for QGIS 3.0, make either constructor explicit or alter the signatures
//! \brief [ data provider interface ] Constructor in provider mode
QgsRasterLayer( const QString &uri,
const QString &baseName,
const QString &providerKey,
const QString &baseName = QString(),
const QString &providerKey = "gdal",
bool loadDefaultStyleFlag = true );

~QgsRasterLayer();
Expand Down

0 comments on commit f4a9797

Please sign in to comment.