Skip to content
Permalink
Browse files

Add create/remove methods to raster provider baseclass

  • Loading branch information
mhugent committed Jul 11, 2012
1 parent 248d4ba commit d5a82c62a18cea1e802201717aba5ed3d0fac658
Showing with 31 additions and 1 deletion.
  1. +10 −0 src/core/qgsrasterdataprovider.cpp
  2. +21 −1 src/core/qgsrasterdataprovider.h
@@ -185,6 +185,16 @@ QString QgsRasterDataProvider::capabilitiesString() const
abilitiesList += tr( "Build Pyramids" );
}

if ( abilities & QgsRasterDataProvider::Create )
{
abilitiesList += tr( "Create Datasources" );
}

if ( abilities & QgsRasterDataProvider::Remove )
{
abilitiesList += tr( "Remove Datasources" );
}

QgsDebugMsg( "Capability: " + abilitiesList.join( ", " ) );

return abilitiesList.join( ", " );
@@ -64,7 +64,9 @@ class CORE_EXPORT QgsRasterDataProvider : public QgsDataProvider, public QgsRast
EstimatedMinimumMaximum = 1 << 3,
BuildPyramids = 1 << 4,
Histogram = 1 << 5,
Size = 1 << 6 // has fixed source type
Size = 1 << 6, // has fixed source type
Create = 1 << 7, //create new datasets
Remove = 1 << 8 //delete datasets
};

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

/** Creates a new dataset with mDataSourceURI
@return true in case of success*/
virtual bool create( const QString& format, int nBands,
QgsRasterDataProvider::DataType type, int width, int height, double* geoTransform,
const QgsCoordinateReferenceSystem& crs /*e.v. color table*/ )
{
Q_UNUSED( format );
Q_UNUSED( nBands );
Q_UNUSED( type );
Q_UNUSED( width );
Q_UNUSED( height );
Q_UNUSED( geoTransform );
Q_UNUSED( crs ); return false;
}

/** Remove dataset*/
virtual bool remove() { return false; }

signals:
/** Emit a signal to notify of the progress event.
* Emited theProgress is in percents (0.0-100.0) */

0 comments on commit d5a82c6

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