QgsVectorLayer: deprecate old API: select(), nextFeature(), featureAtId()

This commit is contained in:
Martin Dobias 2013-01-26 19:42:46 +01:00
parent 5ad61f535a
commit 8da06cb97d
5 changed files with 6 additions and 44 deletions

View File

@ -54,12 +54,6 @@ class QgsVectorDataProvider : QgsDataProvider
*/
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() ) = 0;
// temporary
QgsFeatureIterator select( QList<int> fetchAttributes = QList<int>(),
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false ) /Deprecated/;
/**
* Get feature type.
* @return int representing the feature type

View File

@ -302,7 +302,7 @@ class QgsVectorLayer : QgsMapLayer
void select( QList<int> fetchAttributes,
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false );
bool useIntersect = false ) /Deprecated/;
/**
* Query the provider for features specified in request.
@ -314,11 +314,11 @@ class QgsVectorLayer : QgsMapLayer
* @param feature buffer to read the feature into
* @return true, if a feature was fetched, false, if there are no more features
*/
bool nextFeature( QgsFeature& feature );
bool nextFeature( QgsFeature& feature ) /Deprecated/;
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
@return true in case of success*/
bool featureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
bool featureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true ) /Deprecated/;
/** Adds a feature
@param f feature to add

View File

@ -491,25 +491,4 @@ void QgsVectorDataProvider::pushError( QString msg )
mErrors << msg;
}
QgsFeatureIterator QgsVectorDataProvider::select( QgsAttributeList fetchAttributes,
QgsRectangle rect,
bool fetchGeometry,
bool useIntersect )
{
qDebug( "OLD SELECT!" );
QgsFeatureRequest request;
if ( !rect.isEmpty() )
{
request.setFilterRect( rect );
}
if ( !fetchGeometry )
request.setFlags( QgsFeatureRequest::NoGeometry );
if ( useIntersect )
request.setFlags( request.flags() | QgsFeatureRequest::ExactIntersect );
request.setSubsetOfAttributes( fetchAttributes );
return getFeatures( request );
}
QStringList QgsVectorDataProvider::smEncodings;

View File

@ -111,12 +111,6 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
*/
virtual QgsFeatureIterator getFeatures( const QgsFeatureRequest& request = QgsFeatureRequest() ) = 0;
// temporary
QgsFeatureIterator select( QgsAttributeList fetchAttributes,
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false );
/**
* Get feature type.
* @return int representing the feature type

View File

@ -448,16 +448,11 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
* @param fetchGeometry fetch features with geometry
* @param useIntersect fetch only features that actually intersect the window (not just the bounding box)
*/
void select( QgsAttributeList fetchAttributes,
Q_DECL_DEPRECATED void select( QgsAttributeList fetchAttributes,
QgsRectangle rect = QgsRectangle(),
bool fetchGeometry = true,
bool useIntersect = false );
/** Select features based on criteria specified in the request
* @note added in 2.0
*/
//void select( const QgsFeatureRequest& request );
/**
* Query the provider for features specified in request.
*/
@ -468,11 +463,11 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
* @param feature buffer to read the feature into
* @return true, if a feature was fetched, false, if there are no more features
*/
bool nextFeature( QgsFeature& feature );
Q_DECL_DEPRECATED bool nextFeature( QgsFeature& feature );
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
@return true in case of success*/
bool featureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
Q_DECL_DEPRECATED bool featureAtId( QgsFeatureId featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
/** Adds a feature
@param f feature to add