Skip to content

Commit

Permalink
Add create/remove methods to raster provider baseclass
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Jul 11, 2012
1 parent 248d4ba commit d5a82c6
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
10 changes: 10 additions & 0 deletions src/core/qgsrasterdataprovider.cpp
Expand Up @@ -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( ", " );
Expand Down
22 changes: 21 additions & 1 deletion src/core/qgsrasterdataprovider.h
Expand Up @@ -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
Expand Down Expand Up @@ -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) */
Expand Down

0 comments on commit d5a82c6

Please sign in to comment.