Skip to content

Commit

Permalink
Restore default ctor for options and layer
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso authored and nyalldawson committed Apr 17, 2019
1 parent 0d7ccea commit 7b6f9c0
Show file tree
Hide file tree
Showing 40 changed files with 100 additions and 204 deletions.
39 changes: 6 additions & 33 deletions python/core/auto_generated/mesh/qgsmeshlayer.sip.in
Expand Up @@ -78,26 +78,20 @@ is the MDAL connection string. QGIS must be built with MDAL support to allow thi
struct LayerOptions struct LayerOptions
{ {


explicit LayerOptions( ) /Deprecated/; explicit LayerOptions( const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext( ) );
%Docstring %Docstring
Constructor for LayerOptions. Constructor for LayerOptions with optional ``transformContext``.


.. deprecated:: Use version with transformContext argument instead .. note::
%End


explicit LayerOptions( const QgsCoordinateTransformContext &transformContext );
%Docstring
Constructor for LayerOptions.


.. versionadded:: 3.10 transformContext argument was added in QGIS 3.10
%End %End


QgsCoordinateTransformContext transformContext; QgsCoordinateTransformContext transformContext;
}; };


explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory", explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory",
const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() ) /Deprecated/; const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() );
%Docstring %Docstring
Constructor - creates a mesh layer Constructor - creates a mesh layer


Expand All @@ -110,29 +104,8 @@ data.
:param baseName: The name used to represent the layer in the legend :param baseName: The name used to represent the layer in the legend
:param providerLib: The name of the data provider, e.g., "mesh_memory", "mdal" :param providerLib: The name of the data provider, e.g., "mesh_memory", "mdal"
:param options: general mesh layer options :param options: general mesh layer options

.. deprecated:: Use version with layer options as a first argument instead
%End

explicit QgsMeshLayer( const QgsMeshLayer::LayerOptions &options, const QString &path = QString(),
const QString &baseName = QString(), const QString &providerLib = "mesh_memory" );
%Docstring
Constructor - creates a mesh layer

The QgsMeshLayer is constructed by instantiating a data provider. The provider
interprets the supplied path (url) of the data source to connect to and access the
data.

:param options: general mesh layer options
:param path: The path or url of the parameter. Typically this encodes
parameters used by the data provider as url query items.
:param baseName: The name used to represent the layer in the legend
:param providerLib: The name of the data provider, e.g., "mesh_memory", "mdal"

.. versionadded:: 3.10
%End %End



~QgsMeshLayer(); ~QgsMeshLayer();




Expand Down
38 changes: 8 additions & 30 deletions python/core/auto_generated/qgsvectorlayer.sip.in
Expand Up @@ -326,18 +326,16 @@ TODO QGIS3: Remove virtual from non-inherited methods (like isModified)
struct LayerOptions struct LayerOptions
{ {


explicit LayerOptions( bool loadDefaultStyle = true, explicit LayerOptions( bool loadDefaultStyle = true,
bool readExtentFromXml = false ); bool readExtentFromXml = false );
%Docstring %Docstring
Constructor for LayerOptions. Constructor for LayerOptions.

.. deprecated:: Use version with transformContext argument instead
%End %End


explicit LayerOptions( const QgsCoordinateTransformContext & transformContext, explicit LayerOptions( const QgsCoordinateTransformContext &transformContext,
bool loadDefaultStyle = true, bool loadDefaultStyle = true,
bool readExtentFromXml = false bool readExtentFromXml = false
); );
%Docstring %Docstring
Constructor for LayerOptions. Constructor for LayerOptions.


Expand All @@ -353,8 +351,8 @@ Constructor for LayerOptions.
}; };




explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(), explicit QgsVectorLayer( const QString &path = QString(), const QString &baseName = QString(),
const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() ) /Deprecated/; const QString &providerLib = "ogr", const QgsVectorLayer::LayerOptions &options = QgsVectorLayer::LayerOptions() );
%Docstring %Docstring
Constructor - creates a vector layer Constructor - creates a vector layer


Expand All @@ -371,26 +369,6 @@ data.
.. deprecated:: Use version with options as mandatory argument instead .. deprecated:: Use version with options as mandatory argument instead
%End %End



explicit QgsVectorLayer( const QgsVectorLayer::LayerOptions &options, const QString &path = QString(), const QString &baseName = QString(),
const QString &providerLib = "ogr" );
%Docstring
Constructor - creates a vector layer

The QgsVectorLayer is constructed by instantiating a data provider. The provider
interprets the supplied path (url) of the data source to connect to and access the
data.

:param options: layer load options
:param path: The path or url of the parameter. Typically this encodes
parameters used by the data provider as url query items.
:param baseName: The name used to represent the layer in the legend
:param providerLib: The name of the data provider, e.g., "memory", "postgres"

.. versionadded:: 3.10
%End


~QgsVectorLayer(); ~QgsVectorLayer();




Expand Down
2 changes: 1 addition & 1 deletion src/app/browser/qgsinbuiltdataitemproviders.cpp
Expand Up @@ -364,7 +364,7 @@ void QgsLayerItemGuiProvider::populateContextMenu( QgsDataItem *item, QMenu *men
case QgsMapLayerType::VectorLayer: case QgsMapLayerType::VectorLayer:
{ {
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
std::unique_ptr<QgsVectorLayer> layer( new QgsVectorLayer( options, layerItem->uri(), layerItem->name(), layerItem->providerKey() ) ); std::unique_ptr<QgsVectorLayer> layer( new QgsVectorLayer( layerItem->uri(), layerItem->name(), layerItem->providerKey(), options ) );
if ( layer && layer->isValid() ) if ( layer && layer->isValid() )
{ {
QgisApp::instance()->saveAsFile( layer.get(), false, false ); QgisApp::instance()->saveAsFile( layer.get(), false, false );
Expand Down
6 changes: 3 additions & 3 deletions src/app/dwg/qgsdwgimportdialog.cpp
Expand Up @@ -150,7 +150,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked()


QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
options.loadDefaultStyle = false; options.loadDefaultStyle = false;
std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( options, QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ) ) ); std::unique_ptr<QgsVectorLayer> d( new QgsVectorLayer( QStringLiteral( "%1|layername=drawing" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) );
if ( d && d->isValid() ) if ( d && d->isValid() )
{ {
int idxPath = d->fields().lookupField( QStringLiteral( "path" ) ); int idxPath = d->fields().lookupField( QStringLiteral( "path" ) );
Expand Down Expand Up @@ -185,7 +185,7 @@ void QgsDwgImportDialog::pbLoadDatabase_clicked()


lblMessage->setVisible( lblVisible ); lblMessage->setVisible( lblVisible );


std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( options, QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ) ) ); std::unique_ptr<QgsVectorLayer> l( new QgsVectorLayer( QStringLiteral( "%1|layername=layers" ).arg( mDatabaseFileWidget->filePath() ), QStringLiteral( "layers" ), QStringLiteral( "ogr" ), options ) );
if ( l && l->isValid() ) if ( l && l->isValid() )
{ {
int idxName = l->fields().lookupField( QStringLiteral( "name" ) ); int idxName = l->fields().lookupField( QStringLiteral( "name" ) );
Expand Down Expand Up @@ -265,7 +265,7 @@ QgsVectorLayer *QgsDwgImportDialog::layer( QgsLayerTreeGroup *layerGroup, const
{ {
QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
options.loadDefaultStyle = false; options.loadDefaultStyle = false;
QgsVectorLayer *l = new QgsVectorLayer( options, QStringLiteral( "%1|layername=%2" ).arg( mDatabaseFileWidget->filePath(), table ), table, QStringLiteral( "ogr" ) ); QgsVectorLayer *l = new QgsVectorLayer( QStringLiteral( "%1|layername=%2" ).arg( mDatabaseFileWidget->filePath(), table ), table, QStringLiteral( "ogr" ), options );
l->setSubsetString( QStringLiteral( "%1space=0 AND block=-1" ).arg( layerFilter ) ); l->setSubsetString( QStringLiteral( "%1space=0 AND block=-1" ).arg( layerFilter ) );


if ( l->featureCount() == 0 ) if ( l->featureCount() == 0 )
Expand Down
14 changes: 7 additions & 7 deletions src/app/qgisapp.cpp
Expand Up @@ -4638,7 +4638,7 @@ static void setupVectorLayer( const QString &vectorLayerPath,
QString composedURI( uriParts.value( QStringLiteral( "path" ) ).toString() ); QString composedURI( uriParts.value( QStringLiteral( "path" ) ).toString() );
composedURI += "|layername=" + rawLayerName; composedURI += "|layername=" + rawLayerName;


auto newLayer = qgis::make_unique<QgsVectorLayer>( options, composedURI, layer->name(), QStringLiteral( "ogr" ) ); auto newLayer = qgis::make_unique<QgsVectorLayer>( composedURI, layer->name(), QStringLiteral( "ogr" ), options );
if ( newLayer && newLayer->isValid() ) if ( newLayer && newLayer->isValid() )
{ {
delete layer; delete layer;
Expand Down Expand Up @@ -4716,7 +4716,7 @@ bool QgisApp::addVectorLayersPrivate( const QStringList &layerQStringList, const
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
qApp->processEvents(); qApp->processEvents();
} }
QgsVectorLayer *layer = new QgsVectorLayer( options, src, baseName, QStringLiteral( "ogr" ) ); QgsVectorLayer *layer = new QgsVectorLayer( src, baseName, QStringLiteral( "ogr" ), options );
Q_CHECK_PTR( layer ); Q_CHECK_PTR( layer );
if ( isVsiCurl || isRemoteUrl ) if ( isVsiCurl || isRemoteUrl )
{ {
Expand Down Expand Up @@ -5256,7 +5256,7 @@ QList<QgsMapLayer *> QgisApp::askUserForOGRSublayers( QgsVectorLayer *layer )
QString name = fileName + " " + def.layerName; QString name = fileName + " " + def.layerName;
QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
options.loadDefaultStyle = false; options.loadDefaultStyle = false;
QgsVectorLayer *layer = new QgsVectorLayer( options, composedURI, name, QStringLiteral( "ogr" ) ); QgsVectorLayer *layer = new QgsVectorLayer( composedURI, name, QStringLiteral( "ogr" ), options );
if ( layer && layer->isValid() ) if ( layer && layer->isValid() )
{ {
result << layer; result << layer;
Expand Down Expand Up @@ -5320,7 +5320,7 @@ void QgisApp::addDatabaseLayers( QStringList const &layerPathList, QString const


QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
options.loadDefaultStyle = false; options.loadDefaultStyle = false;
QgsVectorLayer *layer = new QgsVectorLayer( options, uri.uri( false ), uri.table(), providerKey ); QgsVectorLayer *layer = new QgsVectorLayer( uri.uri( false ), uri.table(), providerKey, options );
Q_CHECK_PTR( layer ); Q_CHECK_PTR( layer );


if ( ! layer ) if ( ! layer )
Expand Down Expand Up @@ -5398,7 +5398,7 @@ void QgisApp::replaceSelectedVectorLayer( const QString &oldId, const QString &u
return; return;
QgsVectorLayer *oldLayer = static_cast<QgsVectorLayer *>( old ); QgsVectorLayer *oldLayer = static_cast<QgsVectorLayer *>( old );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *newLayer = new QgsVectorLayer( options, uri, layerName, provider ); QgsVectorLayer *newLayer = new QgsVectorLayer( uri, layerName, provider, options );
if ( !newLayer || !newLayer->isValid() ) if ( !newLayer || !newLayer->isValid() )
return; return;


Expand Down Expand Up @@ -9855,7 +9855,7 @@ void QgisApp::layerSubsetString()
{ {
QgsVirtualLayerDefinition def = QgsVirtualLayerDefinitionUtils::fromJoinedLayer( vlayer ); QgsVirtualLayerDefinition def = QgsVirtualLayerDefinitionUtils::fromJoinedLayer( vlayer );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *newLayer = new QgsVectorLayer( options, def.toString(), vlayer->name() + " (virtual)", QStringLiteral( "virtual" ) ); QgsVectorLayer *newLayer = new QgsVectorLayer( def.toString(), vlayer->name() + " (virtual)", QStringLiteral( "virtual" ), options );
if ( newLayer->isValid() ) if ( newLayer->isValid() )
{ {
duplicateVectorStyle( vlayer, newLayer ); duplicateVectorStyle( vlayer, newLayer );
Expand Down Expand Up @@ -11113,7 +11113,7 @@ QgsVectorLayer *QgisApp::addVectorLayerPrivate( const QString &vectorLayerPath,
QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
// Default style is loaded later in this method // Default style is loaded later in this method
options.loadDefaultStyle = false; options.loadDefaultStyle = false;
QgsVectorLayer *layer = new QgsVectorLayer( options, vectorLayerPath, baseName, providerKey ); QgsVectorLayer *layer = new QgsVectorLayer( vectorLayerPath, baseName, providerKey, options );


if ( authok && layer && layer->isValid() ) if ( authok && layer && layer->isValid() )
{ {
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsappscreenshots.cpp
Expand Up @@ -43,9 +43,9 @@ QgsAppScreenShots::QgsAppScreenShots( const QString &saveDirectory )
{ {
QString layerDef = QStringLiteral( "Point?crs=epsg:4326&field=pk:integer&field=my_text:string&field=fk_polygon:integer&field=my_double:double&key=pk" ); QString layerDef = QStringLiteral( "Point?crs=epsg:4326&field=pk:integer&field=my_text:string&field=fk_polygon:integer&field=my_double:double&key=pk" );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
mLineLayer = new QgsVectorLayer( options, layerDef, QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ) ); mLineLayer = new QgsVectorLayer( layerDef, QStringLiteral( "Line Layer" ), QStringLiteral( "memory" ), options );
layerDef = QStringLiteral( "Polygon?crs=epsg:2056&field=pk:integer&field=my_text:string&field=my_integer:integer&field=height:double&key=pk" ); layerDef = QStringLiteral( "Polygon?crs=epsg:2056&field=pk:integer&field=my_text:string&field=my_integer:integer&field=height:double&key=pk" );
mPolygonLayer = new QgsVectorLayer( options, layerDef, QStringLiteral( "Polygon Layer" ), QStringLiteral( "memory" ) ); mPolygonLayer = new QgsVectorLayer( layerDef, QStringLiteral( "Polygon Layer" ), QStringLiteral( "memory" ), options );


QString dataPath( TEST_DATA_DIR ); //defined in CmakeLists.txt QString dataPath( TEST_DATA_DIR ); //defined in CmakeLists.txt
mRasterLayer = new QgsRasterLayer( dataPath + "/raster/with_color_table.tif", QStringLiteral( "raster" ), QStringLiteral( "gdal" ) ); mRasterLayer = new QgsRasterLayer( dataPath + "/raster/with_color_table.tif", QStringLiteral( "raster" ), QStringLiteral( "gdal" ) );
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsnewspatialitelayerdialog.cpp
Expand Up @@ -455,11 +455,11 @@ bool QgsNewSpatialiteLayerDialog::apply()
} }


const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *layer = new QgsVectorLayer( options, QStringLiteral( "dbname='%1' table='%2'%3 sql=" ) QgsVectorLayer *layer = new QgsVectorLayer( QStringLiteral( "dbname='%1' table='%2'%3 sql=" )
.arg( mDatabaseComboBox->currentText(), .arg( mDatabaseComboBox->currentText(),
leLayerName->text(), leLayerName->text(),
mGeometryTypeBox->currentIndex() != 0 ? QStringLiteral( "(%1)" ).arg( leGeometryColumn->text() ) : QString() ), mGeometryTypeBox->currentIndex() != 0 ? QStringLiteral( "(%1)" ).arg( leGeometryColumn->text() ) : QString() ),
leLayerName->text(), QStringLiteral( "spatialite" ) ); leLayerName->text(), QStringLiteral( "spatialite" ), options );
if ( layer->isValid() ) if ( layer->isValid() )
{ {
// Reload connections to refresh browser panel // Reload connections to refresh browser panel
Expand Down
12 changes: 6 additions & 6 deletions src/app/qgsstatusbarcoordinateswidget.cpp
Expand Up @@ -213,8 +213,8 @@ void QgsStatusBarCoordinatesWidget::contributors()
QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/contributors.json" ); QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/contributors.json" );
QFileInfo fileInfo = QFileInfo( fileName ); QFileInfo fileInfo = QFileInfo( fileName );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *layer = new QgsVectorLayer( options, fileInfo.absoluteFilePath(), QgsVectorLayer *layer = new QgsVectorLayer( fileInfo.absoluteFilePath(),
tr( "QGIS Contributors" ), QStringLiteral( "ogr" ) ); tr( "QGIS Contributors" ), QStringLiteral( "ogr" ), options );
// Register this layer with the layers registry // Register this layer with the layers registry
QgsProject::instance()->addMapLayer( layer ); QgsProject::instance()->addMapLayer( layer );
layer->setAutoRefreshInterval( 500 ); layer->setAutoRefreshInterval( 500 );
Expand All @@ -230,8 +230,8 @@ void QgsStatusBarCoordinatesWidget::world()
QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/world_map.shp" ); QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/world_map.shp" );
QFileInfo fileInfo = QFileInfo( fileName ); QFileInfo fileInfo = QFileInfo( fileName );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *layer = new QgsVectorLayer( options, fileInfo.absoluteFilePath(), QgsVectorLayer *layer = new QgsVectorLayer( fileInfo.absoluteFilePath(),
tr( "World Map" ), QStringLiteral( "ogr" ) ); tr( "World Map" ), QStringLiteral( "ogr" ), options );
// Register this layer with the layers registry // Register this layer with the layers registry
QgsProject::instance()->addMapLayer( layer ); QgsProject::instance()->addMapLayer( layer );
} }
Expand All @@ -245,8 +245,8 @@ void QgsStatusBarCoordinatesWidget::hackfests()
QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/qgis-hackfests.json" ); QString fileName = QgsApplication::pkgDataPath() + QStringLiteral( "/resources/data/qgis-hackfests.json" );
QFileInfo fileInfo = QFileInfo( fileName ); QFileInfo fileInfo = QFileInfo( fileName );
const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() }; const QgsVectorLayer::LayerOptions options { QgsProject::instance()->transformContext() };
QgsVectorLayer *layer = new QgsVectorLayer( options, fileInfo.absoluteFilePath(), QgsVectorLayer *layer = new QgsVectorLayer( fileInfo.absoluteFilePath(),
tr( "QGIS Hackfests" ), QStringLiteral( "ogr" ) ); tr( "QGIS Hackfests" ), QStringLiteral( "ogr" ), options );
// Register this layer with the layers registry // Register this layer with the layers registry
QgsProject::instance()->addMapLayer( layer ); QgsProject::instance()->addMapLayer( layer );
layer->setAutoRefreshInterval( 500 ); layer->setAutoRefreshInterval( 500 );
Expand Down
2 changes: 1 addition & 1 deletion src/core/layout/qgslayoutitemmapoverview.cpp
Expand Up @@ -33,7 +33,7 @@


QgsLayoutItemMapOverview::QgsLayoutItemMapOverview( const QString &name, QgsLayoutItemMap *map ) QgsLayoutItemMapOverview::QgsLayoutItemMapOverview( const QString &name, QgsLayoutItemMap *map )
: QgsLayoutItemMapItem( name, map ) : QgsLayoutItemMapItem( name, map )
, mExtentLayer( qgis::make_unique< QgsVectorLayer >( QgsVectorLayer::LayerOptions( QgsCoordinateTransformContext() ), QStringLiteral( "Polygon?crs=EPSG:4326" ), QStringLiteral( "overview" ), QStringLiteral( "memory" ) ) ) , mExtentLayer( qgis::make_unique< QgsVectorLayer >( QStringLiteral( "Polygon?crs=EPSG:4326" ), QStringLiteral( "overview" ), QStringLiteral( "memory" ), QgsVectorLayer::LayerOptions( QgsCoordinateTransformContext() ) ) )
{ {
createDefaultFrameSymbol(); createDefaultFrameSymbol();
} }
Expand Down
11 changes: 2 additions & 9 deletions src/core/mesh/qgsmeshlayer.cpp
Expand Up @@ -39,7 +39,7 @@
QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath, QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath,
const QString &baseName, const QString &baseName,
const QString &providerKey, const QString &providerKey,
const LayerOptions &options ) const QgsMeshLayer::LayerOptions &options )
: QgsMapLayer( QgsMapLayerType::MeshLayer, baseName, meshLayerPath ) : QgsMapLayer( QgsMapLayerType::MeshLayer, baseName, meshLayerPath )
, mOptions( options ) , mOptions( options )
{ {
Expand All @@ -55,13 +55,6 @@ QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath,
setDefaultRendererSettings(); setDefaultRendererSettings();
} // QgsMeshLayer ctor } // QgsMeshLayer ctor


QgsMeshLayer::QgsMeshLayer( const QString &meshLayerPath,
const QString &baseName,
const QString &providerKey,
const LayerOptions &options )
: QgsMeshLayer( options, meshLayerPath, baseName, providerKey )
{
}


void QgsMeshLayer::setDefaultRendererSettings() void QgsMeshLayer::setDefaultRendererSettings()
{ {
Expand Down Expand Up @@ -96,7 +89,7 @@ const QgsMeshDataProvider *QgsMeshLayer::dataProvider() const


QgsMeshLayer *QgsMeshLayer::clone() const QgsMeshLayer *QgsMeshLayer::clone() const
{ {
QgsMeshLayer *layer = new QgsMeshLayer( mOptions, source(), name(), mProviderKey ); QgsMeshLayer *layer = new QgsMeshLayer( source(), name(), mProviderKey, mOptions );
QgsMapLayer::clone( layer ); QgsMapLayer::clone( layer );
return layer; return layer;
} }
Expand Down
39 changes: 5 additions & 34 deletions src/core/mesh/qgsmeshlayer.h
Expand Up @@ -99,20 +99,10 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer
{ {


/** /**
* Constructor for LayerOptions. * Constructor for LayerOptions with optional \a transformContext.
* \deprecated Use version with transformContext argument instead * \note transformContext argument was added in QGIS 3.10
*
*/ */
Q_DECL_DEPRECATED explicit LayerOptions( ) SIP_DEPRECATED explicit LayerOptions( const QgsCoordinateTransformContext &transformContext = QgsCoordinateTransformContext( ) )
: transformContext( QgsCoordinateTransformContext() )
{}


/**
* Constructor for LayerOptions.
* \since QGIS 3.10
*/
explicit LayerOptions( const QgsCoordinateTransformContext &transformContext )
: transformContext( transformContext ) : transformContext( transformContext )
{} {}


Expand All @@ -131,28 +121,9 @@ class CORE_EXPORT QgsMeshLayer : public QgsMapLayer
* \param baseName The name used to represent the layer in the legend * \param baseName The name used to represent the layer in the legend
* \param providerLib The name of the data provider, e.g., "mesh_memory", "mdal" * \param providerLib The name of the data provider, e.g., "mesh_memory", "mdal"
* \param options general mesh layer options * \param options general mesh layer options
* \deprecated Use version with layer options as a first argument instead
*/ */
Q_DECL_DEPRECATED explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory", explicit QgsMeshLayer( const QString &path = QString(), const QString &baseName = QString(), const QString &providerLib = "mesh_memory",
const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() ) SIP_DEPRECATED; const QgsMeshLayer::LayerOptions &options = QgsMeshLayer::LayerOptions() );

/**
* Constructor - creates a mesh layer
*
* The QgsMeshLayer is constructed by instantiating a data provider. The provider
* interprets the supplied path (url) of the data source to connect to and access the
* data.
*
* \param options general mesh layer options
* \param path The path or url of the parameter. Typically this encodes
* parameters used by the data provider as url query items.
* \param baseName The name used to represent the layer in the legend
* \param providerLib The name of the data provider, e.g., "mesh_memory", "mdal"
* \since QGIS 3.10
*/
explicit QgsMeshLayer( const QgsMeshLayer::LayerOptions &options, const QString &path = QString(),
const QString &baseName = QString(), const QString &providerLib = "mesh_memory" );



~QgsMeshLayer() override; ~QgsMeshLayer() override;


Expand Down

0 comments on commit 7b6f9c0

Please sign in to comment.