Skip to content

Commit d5a82c6

Browse files
committed
Add create/remove methods to raster provider baseclass
1 parent 248d4ba commit d5a82c6

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

src/core/qgsrasterdataprovider.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,16 @@ QString QgsRasterDataProvider::capabilitiesString() const
185185
abilitiesList += tr( "Build Pyramids" );
186186
}
187187

188+
if ( abilities & QgsRasterDataProvider::Create )
189+
{
190+
abilitiesList += tr( "Create Datasources" );
191+
}
192+
193+
if ( abilities & QgsRasterDataProvider::Remove )
194+
{
195+
abilitiesList += tr( "Remove Datasources" );
196+
}
197+
188198
QgsDebugMsg( "Capability: " + abilitiesList.join( ", " ) );
189199

190200
return abilitiesList.join( ", " );

src/core/qgsrasterdataprovider.h

+21-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,9 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
6464
EstimatedMinimumMaximum = 1 << 3,
6565
BuildPyramids = 1 << 4,
6666
Histogram = 1 << 5,
67-
Size = 1 << 6 // has fixed source type
67+
Size = 1 << 6, // has fixed source type
68+
Create = 1 << 7, //create new datasets
69+
Remove = 1 << 8 //delete datasets
6870
};
6971

7072
// This is modified copy of GDALColorInterp
@@ -433,6 +435,24 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
433435
/** Current time stamp of data source */
434436
virtual QDateTime dataTimestamp() const { return QDateTime(); }
435437

438+
/** Creates a new dataset with mDataSourceURI
439+
@return true in case of success*/
440+
virtual bool create( const QString& format, int nBands,
441+
QgsRasterDataProvider::DataType type, int width, int height, double* geoTransform,
442+
const QgsCoordinateReferenceSystem& crs /*e.v. color table*/ )
443+
{
444+
Q_UNUSED( format );
445+
Q_UNUSED( nBands );
446+
Q_UNUSED( type );
447+
Q_UNUSED( width );
448+
Q_UNUSED( height );
449+
Q_UNUSED( geoTransform );
450+
Q_UNUSED( crs ); return false;
451+
}
452+
453+
/** Remove dataset*/
454+
virtual bool remove() { return false; }
455+
436456
signals:
437457
/** Emit a signal to notify of the progress event.
438458
* Emited theProgress is in percents (0.0-100.0) */

0 commit comments

Comments
 (0)