mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-06 00:07:29 -04:00
Added hook for a provider to indicate it supports saving its data to a shapefile. If supported, an item is added to the popup context menu. The save function is not implmented yet.
git-svn-id: http://svn.osgeo.org/qgis/trunk@2319 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
parent
13f37c35c1
commit
a15bae505d
@ -178,6 +178,7 @@ class QgsPostgresProvider:public QgsVectorDataProvider
|
||||
|
||||
bool supportsFeatureDeletion(){return true;}
|
||||
|
||||
bool supportsSaveAsShapefile(){return true;}
|
||||
/** Accessor for sql where clause used to limit dataset */
|
||||
QString subsetString() {return sqlWhereClause;};
|
||||
//! Get the postgres connection
|
||||
|
@ -51,3 +51,9 @@ bool QgsVectorDataProvider::supportsFeatureDeletion()
|
||||
//needs to be overwritten by providers which support this
|
||||
return false;
|
||||
}
|
||||
|
||||
bool QgsVectorDataProvider::supportsSaveAsShapefile()
|
||||
{
|
||||
// default implementation is no support
|
||||
return true;
|
||||
}
|
||||
|
@ -117,6 +117,9 @@ class QgsVectorDataProvider: public QgsDataProvider
|
||||
|
||||
/**Returns true if a provider supports deleting features*/
|
||||
virtual bool supportsFeatureDeletion();
|
||||
|
||||
/** Returns true is the provider supports saving to shapefile*/
|
||||
virtual bool supportsSaveAsShapefile();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -786,6 +786,13 @@ void QgsVectorLayer::select(int number)
|
||||
popMenu->insertItem(tr("Start editing"),this,SLOT(startEditing()));
|
||||
popMenu->insertItem(tr("Stop editing"),this,SLOT(stopEditing()));
|
||||
|
||||
// XXX Can we ask the provider if it wants to add things to the context menu?
|
||||
if(dataProvider->supportsSaveAsShapefile())
|
||||
{
|
||||
// add the save as shapefile menu item
|
||||
popMenu->insertItem(tr("Save as shapefile..."), this, SLOT(saveAsShapefile()));
|
||||
}
|
||||
|
||||
} // QgsVectorLayer::initContextMenu_(QgisApp * app)
|
||||
|
||||
|
||||
@ -2067,3 +2074,7 @@ void QgsVectorLayer::drawFeature(QPainter* p, QgsFeature* fet, QgsCoordinateTran
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QgsVectorLayer::saveAsShapefile(){
|
||||
QMessageBox::information(0,"Save As Shapefile", "Someday...");
|
||||
}
|
||||
|
@ -232,6 +232,8 @@ class QgsVectorLayer : public QgsMapLayer
|
||||
/**Returns true if the provider has been modified since the last commit*/
|
||||
virtual bool isModified() const {return mModified;}
|
||||
|
||||
//! Save as shapefile
|
||||
void saveAsShapefile();
|
||||
protected:
|
||||
/**Pointer to the table display object if there is one, else a pointer to 0*/
|
||||
QgsAttributeTableDisplay * tabledisplay;
|
||||
|
Loading…
x
Reference in New Issue
Block a user