mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Make QgsProcessingContext::temporaryLayerStore() return a pointer to store
This commit is contained in:
parent
d2ce9c69b1
commit
32e06f486a
@ -75,7 +75,7 @@ class QgsProcessingContext
|
||||
Sets the expression ``context``.
|
||||
%End
|
||||
|
||||
QgsMapLayerStore &temporaryLayerStore();
|
||||
QgsMapLayerStore *temporaryLayerStore();
|
||||
%Docstring
|
||||
Returns a reference to the layer store used for storing temporary layers during
|
||||
algorithm execution.
|
||||
|
@ -93,7 +93,7 @@ class CORE_EXPORT QgsProcessingContext
|
||||
* Returns a reference to the layer store used for storing temporary layers during
|
||||
* algorithm execution.
|
||||
*/
|
||||
QgsMapLayerStore &temporaryLayerStore() { return tempLayerStore; }
|
||||
QgsMapLayerStore *temporaryLayerStore() { return &tempLayerStore; }
|
||||
|
||||
/**
|
||||
* Returns the behavior used for checking invalid geometries in input layers.
|
||||
|
@ -183,7 +183,7 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromString( const QString &string, QgsP
|
||||
return layer;
|
||||
}
|
||||
|
||||
layer = mapLayerFromStore( string, &context.temporaryLayerStore() );
|
||||
layer = mapLayerFromStore( string, context.temporaryLayerStore() );
|
||||
if ( layer )
|
||||
return layer;
|
||||
|
||||
@ -193,7 +193,7 @@ QgsMapLayer *QgsProcessingUtils::mapLayerFromString( const QString &string, QgsP
|
||||
layer = loadMapLayerFromString( string );
|
||||
if ( layer )
|
||||
{
|
||||
context.temporaryLayerStore().addMapLayer( layer );
|
||||
context.temporaryLayerStore()->addMapLayer( layer );
|
||||
return layer;
|
||||
}
|
||||
else
|
||||
|
@ -438,7 +438,7 @@ void TestQgsProcessing::mapLayerFromString()
|
||||
// check that layers in context temporary store are used
|
||||
QgsVectorLayer *v5 = new QgsVectorLayer( "Polygon", "V5", "memory" );
|
||||
QgsVectorLayer *v6 = new QgsVectorLayer( "Point", "v6", "memory" );
|
||||
c.temporaryLayerStore().addMapLayers( QList<QgsMapLayer *>() << v5 << v6 );
|
||||
c.temporaryLayerStore()->addMapLayers( QList<QgsMapLayer *>() << v5 << v6 );
|
||||
QCOMPARE( QgsProcessingUtils::mapLayerFromString( "V5", c ), v5 );
|
||||
QCOMPARE( QgsProcessingUtils::mapLayerFromString( "v6", c ), v6 );
|
||||
QCOMPARE( QgsProcessingUtils::mapLayerFromString( v5->id(), c ), v5 );
|
||||
@ -455,7 +455,7 @@ void TestQgsProcessing::mapLayerFromString()
|
||||
QVERIFY( loadedLayer->isValid() );
|
||||
QCOMPARE( loadedLayer->type(), QgsMapLayer::RasterLayer );
|
||||
// should now be in temporary store
|
||||
QCOMPARE( c.temporaryLayerStore().mapLayer( loadedLayer->id() ), loadedLayer );
|
||||
QCOMPARE( c.temporaryLayerStore()->mapLayer( loadedLayer->id() ), loadedLayer );
|
||||
|
||||
// since it's now in temporary store, should be accessible even if we deny loading new layers
|
||||
QCOMPARE( QgsProcessingUtils::mapLayerFromString( newRaster, c, false ), loadedLayer );
|
||||
|
Loading…
x
Reference in New Issue
Block a user