Skip to content

Commit c2d2673

Browse files
author
timlinux
committedOct 7, 2008
API cleanups: getNextFeature becomes nextFeature, getFeatureAtId becomes featureAtId, getDefaultValue becomes defaultValue, allAttributeList becomes attributeIndexes and reset becomes begin on data provider api.
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@9449 c8812cc2-4d05-0410-92ff-de0c093fc19c

32 files changed

+112
-112
lines changed
 

‎ChangeLog

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ of layers and tweak their symbology etc without having delays
281281
caused by rerendering everything after each change you make.
282282

283283
2004-11-16 [larsl] 0.5.0devel24
284-
** Reimplemented getNextFeature() so features are visible again
284+
** Reimplemented nextFeature() so features are visible again
285285

286286
2004-11-13 [larsl] 0.5.0devel23
287287
** Changed QgsIdentifyResults and QgsVectorLayer to show all attributes
@@ -312,7 +312,7 @@ qgis to crash.
312312
a QgsFeature, fixed it
313313

314314
2004-10-29 [larsl] 0.5.0devel16
315-
** Added getDefaultValue() in QgsVectorLayer and QgsVectorDataProvider,
315+
** Added defaultValue() in QgsVectorLayer and QgsVectorDataProvider,
316316
implemented it in the GPX provider
317317

318318
2004-10-29 [stevehalasz] 0.5.0devel15
@@ -911,7 +911,7 @@ will hopefully speed up compile times for folks building on p133's. Changed
911911
splash image to the fluffball ready for 0.3 release.
912912

913913
2004-05-19 [larsl] 0.2.0devel27
914-
** Implemented getNextFeature(list<int>&) in the GPX provider
914+
** Implemented nextFeature(list<int>&) in the GPX provider
915915

916916
2004-05-18 [gsherman] 0.2.0devel26
917917
** Saved the qgsappbase.ui and the qgsprojectpropertiesbase.ui files (modified

‎python/core/qgsvectordataprovider.sip

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class QgsVectorDataProvider : QgsDataProvider
4444
*/
4545
virtual QString storageType() const;
4646

47-
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
47+
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
4848
* @param fetchAttributes list of attributes which should be fetched
4949
* @param rect spatial filter
5050
* @param fetchGeometry true if the feature geometry should be fetched
@@ -70,7 +70,7 @@ class QgsVectorDataProvider : QgsDataProvider
7070
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
7171
* @return True when feature was found, otherwise false
7272
*/
73-
virtual bool getFeatureAtId(int featureId,
73+
virtual bool featureAtId(int featureId,
7474
QgsFeature& feature,
7575
bool fetchGeometry = true,
7676
QList<int> fetchAttributes = QList<int>());
@@ -80,7 +80,7 @@ class QgsVectorDataProvider : QgsDataProvider
8080
* @param feature feature which will receive data from the provider
8181
* @return true when there was a feature to fetch, false when end was hit
8282
*/
83-
virtual bool getNextFeature(QgsFeature& feature) = 0;
83+
virtual bool nextFeature(QgsFeature& feature) = 0;
8484

8585
/**
8686
* Get feature type.
@@ -180,7 +180,7 @@ class QgsVectorDataProvider : QgsDataProvider
180180
/**
181181
* Returns the default value for field specified by @c fieldId
182182
*/
183-
virtual QVariant getDefaultValue(int fieldId);
183+
virtual QVariant defaultValue(int fieldId);
184184

185185
/**
186186
* Changes geometries of existing features
@@ -224,9 +224,9 @@ class QgsVectorDataProvider : QgsDataProvider
224224
int fieldNameIndex(const QString& fieldName) const;
225225

226226
/**
227-
* Return list of indexes to fetch all attributes in getNextFeature()
227+
* Return list of indexes to fetch all attributes in nextFeature()
228228
*/
229-
QList<int> allAttributesList();
229+
QList<int> attributeIndexes();
230230

231231
/**Returns the names of the numerical types*/
232232
const QMap<QString,QVariant::Type> &supportedNativeTypes() const;

‎python/core/qgsvectorlayer.sip

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,12 +162,12 @@ public:
162162
bool fetchGeometry = true,
163163
bool useIntersect = false);
164164

165-
bool getNextFeature(QgsFeature& feature);
165+
bool nextFeature(QgsFeature& feature);
166166

167167

168168
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
169169
@return 0 in case of success*/
170-
int getFeatureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
170+
int featureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
171171

172172
/** Adds a feature
173173
@param alsoUpdateExtent If True, will also go to the effort of e.g. updating the extents.

‎src/app/qgsattributetable.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
469469
layer->select( layer->pendingAllAttributesList(), QgsRect(), false );
470470

471471
QgsFeature f;
472-
while ( layer->getNextFeature( f ) )
472+
while ( layer->nextFeature( f ) )
473473
features << f;
474474
}
475475
else

‎src/app/qgsattributetabledisplay.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void QgsAttributeTableDisplay::doSearch( QString searchString )
375375
mLayer->select( mLayer->pendingAllAttributesList(), QgsRect(), false );
376376

377377
QgsFeature f;
378-
while ( mLayer->getNextFeature( f ) )
378+
while ( mLayer->nextFeature( f ) )
379379
{
380380
if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap() ) )
381381
{

‎src/app/qgsgraduatedsymboldialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ int QgsGraduatedSymbolDialog::quantilesFromVectorLayer( std::list<double>& resul
466466
int index = 0;
467467

468468
provider->select( attList, QgsRect(), false );
469-
while ( provider->getNextFeature( currentFeature ) )
469+
while ( provider->nextFeature( currentFeature ) )
470470
{
471471
currentAttributeMap = currentFeature.attributeMap();
472472
currentValue = currentAttributeMap[attributeIndex].toDouble();

‎src/app/qgsmaptooladdfeature.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
171171
const QgsFieldMap fields = vlayer->pendingFields();
172172
for ( QgsFieldMap::const_iterator it = fields.constBegin(); it != fields.constEnd(); ++it )
173173
{
174-
f->addAttribute( it.key(), provider->getDefaultValue( it.key() ) );
174+
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
175175
}
176176

177177
// show the dialog to enter attribute values
@@ -441,7 +441,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
441441
const QgsFieldMap fields = vlayer->pendingFields();
442442
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
443443
{
444-
f->addAttribute( it.key(), provider->getDefaultValue( it.key() ) );
444+
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
445445
}
446446

447447
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );

‎src/app/qgsmaptoolidentify.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
268268

269269
layer->select( layer->pendingAllAttributesList(), r, true, true );
270270
QgsFeature f;
271-
while ( layer->getNextFeature( f ) )
271+
while ( layer->nextFeature( f ) )
272272
mFeatureList << QgsFeature( f );
273273
}
274274
catch ( QgsCsException & cse )
@@ -451,7 +451,7 @@ void QgsMapToolIdentify::highlightFeature( int featureId )
451451
mRubberBand = 0;
452452

453453
QgsFeature feat;
454-
if ( layer->getFeatureAtId( featureId, feat, true, false ) != 0 )
454+
if ( layer->featureAtId( featureId, feat, true, false ) != 0 )
455455
{
456456
return;
457457
}

‎src/app/qgsmaptoolmovefeature.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
8888

8989
QgsFeature cf;
9090
QgsFeature f;
91-
while ( vlayer->getNextFeature( f ) )
91+
while ( vlayer->nextFeature( f ) )
9292
{
9393
if ( f.geometry() )
9494
{

‎src/app/qgssearchquerybuilder.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void QgsSearchQueryBuilder::getFieldValues( int limit )
115115
mModelValues->blockSignals( true );
116116
lstValues->setUpdatesEnabled( false );
117117

118-
while ( provider->getNextFeature( feat ) &&
118+
while ( provider->nextFeature( feat ) &&
119119
( limit == 0 || mModelValues->rowCount() != limit ) )
120120
{
121121
const QgsAttributeMap& attributes = feat.attributeMap();
@@ -193,11 +193,11 @@ long QgsSearchQueryBuilder::countRecords( QString searchString )
193193
QgsFeature feat;
194194
QgsVectorDataProvider* provider = mLayer->dataProvider();
195195
const QgsFieldMap& fields = provider->fields();
196-
QgsAttributeList allAttributes = provider->allAttributesList();
196+
QgsAttributeList allAttributes = provider->attributeIndexes();
197197

198198
provider->select( allAttributes, QgsRect(), false );
199199

200-
while ( provider->getNextFeature( feat ) )
200+
while ( provider->nextFeature( feat ) )
201201
{
202202
if ( searchTree->checkAgainst( fields, feat.attributeMap() ) )
203203
{

‎src/core/qgsvectordataprovider.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,14 @@ long QgsVectorDataProvider::updateFeatureCount()
4747
return -1;
4848
}
4949

50-
bool QgsVectorDataProvider::getFeatureAtId( int featureId,
50+
bool QgsVectorDataProvider::featureAtId( int featureId,
5151
QgsFeature& feature,
5252
bool fetchGeometry,
5353
QgsAttributeList fetchAttributes )
5454
{
5555
select( fetchAttributes, QgsRect(), fetchGeometry );
5656

57-
while ( getNextFeature( feature ) )
57+
while ( nextFeature( feature ) )
5858
{
5959
if ( feature.featureId() == featureId )
6060
return TRUE;
@@ -93,7 +93,7 @@ bool QgsVectorDataProvider::changeAttributeValues( const QgsChangedAttributesMap
9393
return false;
9494
}
9595

96-
QVariant QgsVectorDataProvider::getDefaultValue( int fieldId )
96+
QVariant QgsVectorDataProvider::defaultValue( int fieldId )
9797
{
9898
return QVariant();
9999
}
@@ -246,7 +246,7 @@ QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const
246246
return resultMap;
247247
}
248248

249-
QgsAttributeList QgsVectorDataProvider::allAttributesList()
249+
QgsAttributeList QgsVectorDataProvider::attributeIndexes()
250250
{
251251
uint count = fieldCount();
252252
QgsAttributeList list;
@@ -316,7 +316,7 @@ void QgsVectorDataProvider::uniqueValues( int index, QList<QVariant> &values )
316316
QSet<QString> set;
317317
values.clear();
318318

319-
while ( getNextFeature( f ) )
319+
while ( nextFeature( f ) )
320320
{
321321
if ( !set.contains( f.attributeMap()[index].toString() ) )
322322
{
@@ -347,7 +347,7 @@ void QgsVectorDataProvider::fillMinMaxCache()
347347
QgsAttributeList keys = mCacheMinValues.keys();
348348
select( keys, QgsRect(), false );
349349

350-
while ( getNextFeature( f ) )
350+
while ( nextFeature( f ) )
351351
{
352352
QgsAttributeMap attrMap = f.attributeMap();
353353
for ( QgsAttributeList::const_iterator it = keys.begin(); it != keys.end(); ++it )

‎src/core/qgsvectordataprovider.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
8181
*/
8282
virtual QString storageType() const;
8383

84-
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
84+
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
8585
* @param fetchAttributes list of attributes which should be fetched
8686
* @param rect spatial filter
8787
* @param fetchGeometry true if the feature geometry should be fetched
@@ -110,7 +110,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
110110
* Default implementation traverses all features until it finds the one with correct ID.
111111
* In case the provider supports reading the feature directly, override this function.
112112
*/
113-
virtual bool getFeatureAtId( int featureId,
113+
virtual bool featureAtId( int featureId,
114114
QgsFeature& feature,
115115
bool fetchGeometry = true,
116116
QgsAttributeList fetchAttributes = QgsAttributeList() );
@@ -120,7 +120,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
120120
* @param feature feature which will receive data from the provider
121121
* @return true when there was a feature to fetch, false when end was hit
122122
*/
123-
virtual bool getNextFeature( QgsFeature& feature ) = 0;
123+
virtual bool nextFeature( QgsFeature& feature ) = 0;
124124

125125
/**
126126
* Get feature type.
@@ -223,7 +223,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
223223
/**
224224
* Returns the default value for field specified by @c fieldId
225225
*/
226-
virtual QVariant getDefaultValue( int fieldId );
226+
virtual QVariant defaultValue( int fieldId );
227227

228228
/**
229229
* Changes geometries of existing features
@@ -271,9 +271,9 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
271271
QMap<QString, int> fieldNameMap() const;
272272

273273
/**
274-
* Return list of indexes to fetch all attributes in getNextFeature()
274+
* Return list of indexes to fetch all attributes in nextFeature()
275275
*/
276-
virtual QgsAttributeList allAttributesList();
276+
virtual QgsAttributeList attributeIndexes();
277277

278278
/**Returns the names of the numerical types*/
279279
const QgsNativeTypeMap &supportedNativeTypes() const;
@@ -298,10 +298,10 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
298298
/** should provider fetch also features that don't have geometry? */
299299
bool mFetchFeaturesWithoutGeom;
300300

301-
/**True if geometry should be added to the features in getNextFeature calls*/
301+
/**True if geometry should be added to the features in nextFeature calls*/
302302
bool mFetchGeom;
303303

304-
/**List of attribute indices to fetch with getNextFeature calls*/
304+
/**List of attribute indices to fetch with nextFeature calls*/
305305
QgsAttributeList mAttributesToFetch;
306306

307307
/**The names of the providers native types*/

‎src/core/qgsvectorfilewriter.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,7 @@ QgsVectorFileWriter::writeAsShapefile( QgsVectorLayer* layer,
326326
return err;
327327
}
328328

329-
QgsAttributeList allAttr = provider->allAttributesList();
329+
QgsAttributeList allAttr = provider->attributeIndexes();
330330
QgsFeature fet;
331331

332332
provider->select( allAttr, QgsRect(), true );
@@ -346,7 +346,7 @@ QgsVectorFileWriter::writeAsShapefile( QgsVectorLayer* layer,
346346
}
347347

348348
// write all features
349-
while ( provider->getNextFeature( fet ) )
349+
while ( provider->nextFeature( fet ) )
350350
{
351351
if ( onlySelected && !ids.contains( fet.featureId() ) )
352352
continue;

0 commit comments

Comments
 (0)
Please sign in to comment.