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@9449 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
timlinux 2008-10-07 07:36:24 +00:00
parent 9038cdeaed
commit 3072d71114
32 changed files with 112 additions and 112 deletions

View File

@ -281,7 +281,7 @@ of layers and tweak their symbology etc without having delays
caused by rerendering everything after each change you make.
2004-11-16 [larsl] 0.5.0devel24
** Reimplemented getNextFeature() so features are visible again
** Reimplemented nextFeature() so features are visible again
2004-11-13 [larsl] 0.5.0devel23
** Changed QgsIdentifyResults and QgsVectorLayer to show all attributes
@ -312,7 +312,7 @@ qgis to crash.
a QgsFeature, fixed it
2004-10-29 [larsl] 0.5.0devel16
** Added getDefaultValue() in QgsVectorLayer and QgsVectorDataProvider,
** Added defaultValue() in QgsVectorLayer and QgsVectorDataProvider,
implemented it in the GPX provider
2004-10-29 [stevehalasz] 0.5.0devel15
@ -911,7 +911,7 @@ will hopefully speed up compile times for folks building on p133's. Changed
splash image to the fluffball ready for 0.3 release.
2004-05-19 [larsl] 0.2.0devel27
** Implemented getNextFeature(list<int>&) in the GPX provider
** Implemented nextFeature(list<int>&) in the GPX provider
2004-05-18 [gsherman] 0.2.0devel26
** Saved the qgsappbase.ui and the qgsprojectpropertiesbase.ui files (modified

View File

@ -44,7 +44,7 @@ class QgsVectorDataProvider : QgsDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -70,7 +70,7 @@ class QgsVectorDataProvider : QgsDataProvider
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
* @return True when feature was found, otherwise false
*/
virtual bool getFeatureAtId(int featureId,
virtual bool featureAtId(int featureId,
QgsFeature& feature,
bool fetchGeometry = true,
QList<int> fetchAttributes = QList<int>());
@ -80,7 +80,7 @@ class QgsVectorDataProvider : QgsDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature(QgsFeature& feature) = 0;
virtual bool nextFeature(QgsFeature& feature) = 0;
/**
* Get feature type.
@ -180,7 +180,7 @@ class QgsVectorDataProvider : QgsDataProvider
/**
* Returns the default value for field specified by @c fieldId
*/
virtual QVariant getDefaultValue(int fieldId);
virtual QVariant defaultValue(int fieldId);
/**
* Changes geometries of existing features
@ -224,9 +224,9 @@ class QgsVectorDataProvider : QgsDataProvider
int fieldNameIndex(const QString& fieldName) const;
/**
* Return list of indexes to fetch all attributes in getNextFeature()
* Return list of indexes to fetch all attributes in nextFeature()
*/
QList<int> allAttributesList();
QList<int> attributeIndexes();
/**Returns the names of the numerical types*/
const QMap<QString,QVariant::Type> &supportedNativeTypes() const;

View File

@ -162,12 +162,12 @@ public:
bool fetchGeometry = true,
bool useIntersect = false);
bool getNextFeature(QgsFeature& feature);
bool nextFeature(QgsFeature& feature);
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
@return 0 in case of success*/
int getFeatureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
int featureAtId(int featureId, QgsFeature& f, bool fetchGeometries = true, bool fetchAttributes = true);
/** Adds a feature
@param alsoUpdateExtent If True, will also go to the effort of e.g. updating the extents.

View File

@ -469,7 +469,7 @@ void QgsAttributeTable::fillTable( QgsVectorLayer *layer )
layer->select( layer->pendingAllAttributesList(), QgsRect(), false );
QgsFeature f;
while ( layer->getNextFeature( f ) )
while ( layer->nextFeature( f ) )
features << f;
}
else

View File

@ -375,7 +375,7 @@ void QgsAttributeTableDisplay::doSearch( QString searchString )
mLayer->select( mLayer->pendingAllAttributesList(), QgsRect(), false );
QgsFeature f;
while ( mLayer->getNextFeature( f ) )
while ( mLayer->nextFeature( f ) )
{
if ( searchTree->checkAgainst( mLayer->pendingFields(), f.attributeMap() ) )
{

View File

@ -466,7 +466,7 @@ int QgsGraduatedSymbolDialog::quantilesFromVectorLayer( std::list<double>& resul
int index = 0;
provider->select( attList, QgsRect(), false );
while ( provider->getNextFeature( currentFeature ) )
while ( provider->nextFeature( currentFeature ) )
{
currentAttributeMap = currentFeature.attributeMap();
currentValue = currentAttributeMap[attributeIndex].toDouble();

View File

@ -171,7 +171,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
const QgsFieldMap fields = vlayer->pendingFields();
for ( QgsFieldMap::const_iterator it = fields.constBegin(); it != fields.constEnd(); ++it )
{
f->addAttribute( it.key(), provider->getDefaultValue( it.key() ) );
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
}
// show the dialog to enter attribute values
@ -441,7 +441,7 @@ void QgsMapToolAddFeature::canvasReleaseEvent( QMouseEvent * e )
const QgsFieldMap fields = vlayer->pendingFields();
for ( QgsFieldMap::const_iterator it = fields.begin(); it != fields.end(); ++it )
{
f->addAttribute( it.key(), provider->getDefaultValue( it.key() ) );
f->addAttribute( it.key(), provider->defaultValue( it.key() ) );
}
QgsAttributeDialog * mypDialog = new QgsAttributeDialog( vlayer, f );

View File

@ -268,7 +268,7 @@ void QgsMapToolIdentify::identifyVectorLayer( const QgsPoint& point )
layer->select( layer->pendingAllAttributesList(), r, true, true );
QgsFeature f;
while ( layer->getNextFeature( f ) )
while ( layer->nextFeature( f ) )
mFeatureList << QgsFeature( f );
}
catch ( QgsCsException & cse )
@ -451,7 +451,7 @@ void QgsMapToolIdentify::highlightFeature( int featureId )
mRubberBand = 0;
QgsFeature feat;
if ( layer->getFeatureAtId( featureId, feat, true, false ) != 0 )
if ( layer->featureAtId( featureId, feat, true, false ) != 0 )
{
return;
}

View File

@ -88,7 +88,7 @@ void QgsMapToolMoveFeature::canvasPressEvent( QMouseEvent * e )
QgsFeature cf;
QgsFeature f;
while ( vlayer->getNextFeature( f ) )
while ( vlayer->nextFeature( f ) )
{
if ( f.geometry() )
{

View File

@ -115,7 +115,7 @@ void QgsSearchQueryBuilder::getFieldValues( int limit )
mModelValues->blockSignals( true );
lstValues->setUpdatesEnabled( false );
while ( provider->getNextFeature( feat ) &&
while ( provider->nextFeature( feat ) &&
( limit == 0 || mModelValues->rowCount() != limit ) )
{
const QgsAttributeMap& attributes = feat.attributeMap();
@ -193,11 +193,11 @@ long QgsSearchQueryBuilder::countRecords( QString searchString )
QgsFeature feat;
QgsVectorDataProvider* provider = mLayer->dataProvider();
const QgsFieldMap& fields = provider->fields();
QgsAttributeList allAttributes = provider->allAttributesList();
QgsAttributeList allAttributes = provider->attributeIndexes();
provider->select( allAttributes, QgsRect(), false );
while ( provider->getNextFeature( feat ) )
while ( provider->nextFeature( feat ) )
{
if ( searchTree->checkAgainst( fields, feat.attributeMap() ) )
{

View File

@ -47,14 +47,14 @@ long QgsVectorDataProvider::updateFeatureCount()
return -1;
}
bool QgsVectorDataProvider::getFeatureAtId( int featureId,
bool QgsVectorDataProvider::featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry,
QgsAttributeList fetchAttributes )
{
select( fetchAttributes, QgsRect(), fetchGeometry );
while ( getNextFeature( feature ) )
while ( nextFeature( feature ) )
{
if ( feature.featureId() == featureId )
return TRUE;
@ -93,7 +93,7 @@ bool QgsVectorDataProvider::changeAttributeValues( const QgsChangedAttributesMap
return false;
}
QVariant QgsVectorDataProvider::getDefaultValue( int fieldId )
QVariant QgsVectorDataProvider::defaultValue( int fieldId )
{
return QVariant();
}
@ -246,7 +246,7 @@ QMap<QString, int> QgsVectorDataProvider::fieldNameMap() const
return resultMap;
}
QgsAttributeList QgsVectorDataProvider::allAttributesList()
QgsAttributeList QgsVectorDataProvider::attributeIndexes()
{
uint count = fieldCount();
QgsAttributeList list;
@ -316,7 +316,7 @@ void QgsVectorDataProvider::uniqueValues( int index, QList<QVariant> &values )
QSet<QString> set;
values.clear();
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
if ( !set.contains( f.attributeMap()[index].toString() ) )
{
@ -347,7 +347,7 @@ void QgsVectorDataProvider::fillMinMaxCache()
QgsAttributeList keys = mCacheMinValues.keys();
select( keys, QgsRect(), false );
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
QgsAttributeMap attrMap = f.attributeMap();
for ( QgsAttributeList::const_iterator it = keys.begin(); it != keys.end(); ++it )

View File

@ -81,7 +81,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -110,7 +110,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
* Default implementation traverses all features until it finds the one with correct ID.
* In case the provider supports reading the feature directly, override this function.
*/
virtual bool getFeatureAtId( int featureId,
virtual bool featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry = true,
QgsAttributeList fetchAttributes = QgsAttributeList() );
@ -120,7 +120,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature ) = 0;
virtual bool nextFeature( QgsFeature& feature ) = 0;
/**
* Get feature type.
@ -223,7 +223,7 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/**
* Returns the default value for field specified by @c fieldId
*/
virtual QVariant getDefaultValue( int fieldId );
virtual QVariant defaultValue( int fieldId );
/**
* Changes geometries of existing features
@ -271,9 +271,9 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
QMap<QString, int> fieldNameMap() const;
/**
* Return list of indexes to fetch all attributes in getNextFeature()
* Return list of indexes to fetch all attributes in nextFeature()
*/
virtual QgsAttributeList allAttributesList();
virtual QgsAttributeList attributeIndexes();
/**Returns the names of the numerical types*/
const QgsNativeTypeMap &supportedNativeTypes() const;
@ -298,10 +298,10 @@ class CORE_EXPORT QgsVectorDataProvider : public QgsDataProvider
/** should provider fetch also features that don't have geometry? */
bool mFetchFeaturesWithoutGeom;
/**True if geometry should be added to the features in getNextFeature calls*/
/**True if geometry should be added to the features in nextFeature calls*/
bool mFetchGeom;
/**List of attribute indices to fetch with getNextFeature calls*/
/**List of attribute indices to fetch with nextFeature calls*/
QgsAttributeList mAttributesToFetch;
/**The names of the providers native types*/

View File

@ -326,7 +326,7 @@ QgsVectorFileWriter::writeAsShapefile( QgsVectorLayer* layer,
return err;
}
QgsAttributeList allAttr = provider->allAttributesList();
QgsAttributeList allAttr = provider->attributeIndexes();
QgsFeature fet;
provider->select( allAttr, QgsRect(), true );
@ -346,7 +346,7 @@ QgsVectorFileWriter::writeAsShapefile( QgsVectorLayer* layer,
}
// write all features
while ( provider->getNextFeature( fet ) )
while ( provider->nextFeature( fet ) )
{
if ( onlySelected && !ids.contains( fet.featureId() ) )
continue;

View File

@ -314,7 +314,7 @@ void QgsVectorLayer::drawLabels( QPainter * p, const QgsRect& viewExtent, const
select( attributes, viewExtent );
QgsFeature fet;
while ( getNextFeature( fet ) )
while ( nextFeature( fet ) )
{
if ( mRenderer->willRenderFeature( &fet ) )
{
@ -715,7 +715,7 @@ bool QgsVectorLayer::draw( QgsRenderContext& rendererContext )
try
{
while ( getNextFeature( fet ) )
while ( nextFeature( fet ) )
{
if ( rendererContext.renderingStopped() )
@ -841,7 +841,7 @@ void QgsVectorLayer::select( QgsRect & rect, bool lock )
select( QgsAttributeList(), rect, false, true );
QgsFeature f;
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
select( f.featureId(), false ); // don't emit signal (not to redraw it everytime)
}
@ -859,7 +859,7 @@ void QgsVectorLayer::invertSelection()
select( QgsAttributeList(), QgsRect(), false );
QgsFeature fet;
while ( getNextFeature( fet ) )
while ( nextFeature( fet ) )
{
select( fet.featureId(), false ); // don't emit signal
}
@ -992,7 +992,7 @@ QgsRect QgsVectorLayer::boundingBoxOfSelected()
retval.setMinimal();
QgsFeature fet;
while ( getNextFeature( fet ) )
while ( nextFeature( fet ) )
{
if ( mSelectedFeatureIds.contains( fet.featureId() ) )
{
@ -1082,7 +1082,7 @@ void QgsVectorLayer::updateExtents()
select( QgsAttributeList(), QgsRect(), true );
QgsFeature fet;
while ( getNextFeature( fet ) )
while ( nextFeature( fet ) )
{
if ( fet.geometry() )
{
@ -1196,7 +1196,7 @@ void QgsVectorLayer::select( QgsAttributeList attributes, QgsRect rect, bool fet
}
}
bool QgsVectorLayer::getNextFeature( QgsFeature &f )
bool QgsVectorLayer::nextFeature( QgsFeature &f )
{
if ( !mFetching )
return false;
@ -1249,7 +1249,7 @@ bool QgsVectorLayer::getNextFeature( QgsFeature &f )
{
// retrieve attributes from provider
QgsFeature tmp;
mDataProvider->getFeatureAtId( fid, tmp, false, mDataProvider->allAttributesList() );
mDataProvider->featureAtId( fid, tmp, false, mDataProvider->attributeIndexes() );
updateFeatureAttributes( tmp );
f.setAttributeMap( tmp.attributeMap() );
}
@ -1295,7 +1295,7 @@ bool QgsVectorLayer::getNextFeature( QgsFeature &f )
// no more added features
}
while ( dataProvider()->getNextFeature( f ) )
while ( dataProvider()->nextFeature( f ) )
{
if ( mFetchConsidered.contains( f.featureId() ) )
continue;
@ -1311,7 +1311,7 @@ bool QgsVectorLayer::getNextFeature( QgsFeature &f )
return false;
}
int QgsVectorLayer::getFeatureAtId( int featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes )
int QgsVectorLayer::featureAtId( int featureId, QgsFeature& f, bool fetchGeometries, bool fetchAttributes )
{
if ( !mDataProvider )
return 1;
@ -1348,7 +1348,7 @@ int QgsVectorLayer::getFeatureAtId( int featureId, QgsFeature& f, bool fetchGeom
{
// retrieve attributes from provider
QgsFeature tmp;
mDataProvider->getFeatureAtId( featureId, tmp, false, mDataProvider->allAttributesList() );
mDataProvider->featureAtId( featureId, tmp, false, mDataProvider->attributeIndexes() );
updateFeatureAttributes( tmp );
f.setAttributeMap( tmp.attributeMap() );
}
@ -1376,7 +1376,7 @@ int QgsVectorLayer::getFeatureAtId( int featureId, QgsFeature& f, bool fetchGeom
// regular features
if ( fetchAttributes )
{
if ( mDataProvider->getFeatureAtId( featureId, f, fetchGeometries, mDataProvider->allAttributesList() ) )
if ( mDataProvider->featureAtId( featureId, f, fetchGeometries, mDataProvider->attributeIndexes() ) )
{
updateFeatureAttributes( f );
return 0;
@ -1384,7 +1384,7 @@ int QgsVectorLayer::getFeatureAtId( int featureId, QgsFeature& f, bool fetchGeom
}
else
{
if ( mDataProvider->getFeatureAtId( featureId, f, fetchGeometries, QgsAttributeList() ) )
if ( mDataProvider->featureAtId( featureId, f, fetchGeometries, QgsAttributeList() ) )
{
return 0;
}
@ -1569,7 +1569,7 @@ int QgsVectorLayer::addRing( const QList<QgsPoint>& ring )
select( QgsAttributeList(), bBox, true, true );
QgsFeature f;
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
addRingReturnCode = f.geometry()->addRing( ring );
if ( addRingReturnCode == 0 )
@ -1714,7 +1714,7 @@ int QgsVectorLayer::splitFeatures( const QList<QgsPoint>& splitLine, bool topolo
select( QgsAttributeList(), bBox, true, true );
QgsFeature f;
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
featureList << QgsFeature( f );
}
@ -1779,7 +1779,7 @@ int QgsVectorLayer::removePolygonIntersections( QgsGeometry* geom )
select( QgsAttributeList(), geomBBox, true, true );
QgsFeature f;
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
//call geometry->makeDifference for each feature
QgsGeometry *currentGeom = f.geometry();
@ -2573,7 +2573,7 @@ const QgsFieldMap &QgsVectorLayer::pendingFields()
QgsAttributeList QgsVectorLayer::pendingAllAttributesList()
{
return isEditable() ? mUpdatedFields.keys() : mDataProvider->allAttributesList();
return isEditable() ? mUpdatedFields.keys() : mDataProvider->attributeIndexes();
}
int QgsVectorLayer::pendingFeatureCount()
@ -2942,7 +2942,7 @@ QgsFeatureList QgsVectorLayer::selectedFeatures()
QgsFeatureList features;
QgsAttributeList allAttrs = mDataProvider->allAttributesList();
QgsAttributeList allAttrs = mDataProvider->attributeIndexes();
for ( QgsFeatureIds::iterator it = mSelectedFeatureIds.begin(); it != mSelectedFeatureIds.end(); ++it )
{
@ -2964,7 +2964,7 @@ QgsFeatureList QgsVectorLayer::selectedFeatures()
// if the geometry is not newly added, get it from provider
if ( !selectionIsAddedFeature )
{
mDataProvider->getFeatureAtId( *it, feat, true, allAttrs );
mDataProvider->featureAtId( *it, feat, true, allAttrs );
}
updateFeatureAttributes( feat );
@ -3124,7 +3124,7 @@ int QgsVectorLayer::snapWithContext( const QgsPoint& startPoint, double snapping
int n = 0;
QgsFeature f;
while ( getNextFeature( f ) )
while ( nextFeature( f ) )
{
snapToGeometry( startPoint, f.featureId(), f.geometry(), sqrSnappingTolerance, snappingResults, snap_to );
}

View File

@ -222,11 +222,11 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
bool fetchGeometry = true,
bool useIntersect = false );
bool getNextFeature( QgsFeature& feature );
bool nextFeature( QgsFeature& feature );
/**Gets the feature at the given feature id. Considers the changed, added, deleted and permanent features
@return 0 in case of success*/
int getFeatureAtId( int featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
int featureAtId( int featureId, QgsFeature &f, bool fetchGeometries = true, bool fetchAttributes = true );
/** Adds a feature
@param lastFeatureInBatch If True, will also go to the effort of e.g. updating the extents.

View File

@ -98,7 +98,7 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPoint & mapPosition, Qgs
// Get the data provider
QgsVectorDataProvider* dataProvider = dynamic_cast<QgsVectorLayer*>( layer )->dataProvider();
// Fetch the attribute list for the layer
QgsAttributeList allAttributes = dataProvider->allAttributesList();
QgsAttributeList allAttributes = dataProvider->attributeIndexes();
// Select all attributes within the search radius
dataProvider->select( allAttributes, r, true, true );
// Feature to hold the results of the fetch
@ -107,7 +107,7 @@ QString QgsMapTip::fetchFeature( QgsMapLayer *layer, QgsPoint & mapPosition, Qgs
const QgsFieldMap& fields = dataProvider->fields();
// Get the label (display) field for the layer
QString fieldIndex = dynamic_cast<QgsVectorLayer*>( layer )->displayField();
if ( dataProvider->getNextFeature( feature ) )
if ( dataProvider->nextFeature( feature ) )
{
// if we get a feature, pull out the display field and set the maptip text to its value
QgsAttributeMap attributes = feature.attributeMap();

View File

@ -2954,7 +2954,7 @@ void QgsGrassModuleSelection::updateSelection()
QgsVectorLayer *vector = dynamic_cast<QgsVectorLayer*>( layer );
QgsGrassProvider *provider = ( QgsGrassProvider * ) vector->dataProvider();
QgsAttributeList allAttributes = provider->allAttributesList();
QgsAttributeList allAttributes = provider->attributeIndexes();
const QgsFeatureIds& selected = vector->selectedFeaturesIds();
int keyField = provider->keyField();
@ -2965,7 +2965,7 @@ void QgsGrassModuleSelection::updateSelection()
QgsFeature feature;
int i = 0;
while ( provider->getNextFeature( feature ) )
while ( provider->nextFeature( feature ) )
{
if ( !selected.contains( feature.featureId() ) )
continue;

View File

@ -76,7 +76,7 @@ int QgsInterpolator::cacheBaseData()
QgsFeature theFeature;
double attributeValue = 0.0;
while ( provider->getNextFeature( theFeature ) )
while ( provider->nextFeature( theFeature ) )
{
if ( !zCoordInterpolation )
{

View File

@ -191,7 +191,7 @@ QgsDelimitedTextProvider::QgsDelimitedTextProvider( QString uri )
else
parts = line.split( mDelimiter );
// Skip malformed lines silently. Report line number with getNextFeature()
// Skip malformed lines silently. Report line number with nextFeature()
if ( attributeFields.size() != parts.size() )
{
continue;
@ -281,7 +281,7 @@ QString QgsDelimitedTextProvider::storageType() const
}
bool QgsDelimitedTextProvider::getNextFeature( QgsFeature& feature )
bool QgsDelimitedTextProvider::nextFeature( QgsFeature& feature )
{
// before we do anything else, assume that there's something wrong with
// the feature
@ -415,7 +415,7 @@ bool QgsDelimitedTextProvider::getNextFeature( QgsFeature& feature )
return false;
} // getNextFeature
} // nextFeature
void QgsDelimitedTextProvider::select( QgsAttributeList fetchAttributes,

View File

@ -57,7 +57,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -77,7 +77,7 @@ class QgsDelimitedTextProvider : public QgsVectorDataProvider
* mFile should be open with the file pointer at the record of the next
* feature, or EOF. The feature found on the current line is parsed.
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**
* Get feature type.

View File

@ -126,7 +126,7 @@ int QgsGPXProvider::capabilities() const
QgsVectorDataProvider::ChangeAttributeValues;
}
bool QgsGPXProvider::getNextFeature( QgsFeature& feature )
bool QgsGPXProvider::nextFeature( QgsFeature& feature )
{
bool result = false;
@ -765,7 +765,7 @@ void QgsGPXProvider::changeAttributeValues( GPSObject& obj, const QgsAttributeMa
}
QVariant QgsGPXProvider::getDefaultValue( int fieldId )
QVariant QgsGPXProvider::defaultValue( int fieldId )
{
if ( fieldId == SrcAttr )
return tr( "Digitized in QGIS" );

View File

@ -51,7 +51,7 @@ class QgsGPXProvider : public QgsVectorDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -68,7 +68,7 @@ class QgsGPXProvider : public QgsVectorDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**
* Get feature type.
@ -120,7 +120,7 @@ class QgsGPXProvider : public QgsVectorDataProvider
/**
* Returns the default value for field specified by @c fieldId
*/
virtual QVariant getDefaultValue( int fieldId );
virtual QVariant defaultValue( int fieldId );
/* Functions inherited from QgsDataProvider */

View File

@ -287,7 +287,7 @@ QString QgsGrassProvider::storageType() const
return "GRASS (Geographic Resources Analysis and Support System) file";
}
bool QgsGrassProvider::getNextFeature( QgsFeature& feature )
bool QgsGrassProvider::nextFeature( QgsFeature& feature )
{
int cat, type, id;
unsigned char *wkb;

View File

@ -46,7 +46,7 @@ class QgsField;
* is set to true. All data loaded from the map to QgsGrassProvider remain unchanged
* untill closeEdit is called.
* During editing:
* getNextFeature() and getFirstFeature() returns 0
* nextFeature() and getFirstFeature() returns 0
* featureCount() returns 0
* fieldCount() returns original (old) number of fields
*/
@ -96,7 +96,7 @@ struct GMAP
struct Map_info *map; // map header
int nUsers; // number layers using this map
int update; // true if the map is opened in update mode -> disabled standard reading
// through getNextFeature(), featureCount() returns 0
// through nextFeature(), featureCount() returns 0
QDateTime lastModified; // last modified time of the vector directory, when the map was opened
QDateTime lastAttributesModified; // last modified time of the vector 'dbln' file, when the map was opened
// or attributes were updated. The 'dbln' file is updated by v.to.db etc.
@ -122,7 +122,7 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -141,7 +141,7 @@ class GRASS_EXPORT QgsGrassProvider : public QgsVectorDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**

View File

@ -60,7 +60,7 @@ QString QgsMemoryProvider::storageType() const
return "Memory storage";
}
bool QgsMemoryProvider::getNextFeature( QgsFeature& feature )
bool QgsMemoryProvider::nextFeature( QgsFeature& feature )
{
bool hasFeature = FALSE;
@ -134,7 +134,7 @@ bool QgsMemoryProvider::getNextFeature( QgsFeature& feature )
}
bool QgsMemoryProvider::getFeatureAtId( int featureId,
bool QgsMemoryProvider::featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry,
QgsAttributeList fetchAttributes )

View File

@ -34,7 +34,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -54,7 +54,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
* mFile should be open with the file pointer at the record of the next
* feature, or EOF. The feature found on the current line is parsed.
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**
* Gets the feature at the given feature ID.
@ -64,7 +64,7 @@ class QgsMemoryProvider : public QgsVectorDataProvider
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
* @return True when feature was found, otherwise false
*/
virtual bool getFeatureAtId( int featureId,
virtual bool featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry = true,
QgsAttributeList fetchAttributes = QgsAttributeList() );

View File

@ -213,7 +213,7 @@ QString QgsOgrProvider::storageType() const
}
bool QgsOgrProvider::getFeatureAtId( int featureId,
bool QgsOgrProvider::featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry,
QgsAttributeList fetchAttributes )
@ -245,7 +245,7 @@ bool QgsOgrProvider::getFeatureAtId( int featureId,
return true;
}
bool QgsOgrProvider::getNextFeature( QgsFeature& feature )
bool QgsOgrProvider::nextFeature( QgsFeature& feature )
{
if ( !valid )
{

View File

@ -53,7 +53,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
*/
virtual QString storageType() const;
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -70,7 +70,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**
* Gets the feature at the given feature ID.
@ -80,7 +80,7 @@ class QgsOgrProvider : public QgsVectorDataProvider
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
* @return True when feature was found, otherwise false
*/
virtual bool getFeatureAtId( int featureId,
virtual bool featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry = true,
QgsAttributeList fetchAttributes = QgsAttributeList() );

View File

@ -565,7 +565,7 @@ void QgsPostgresProvider::select( QgsAttributeList fetchAttributes, QgsRect rect
mFetching = true;
}
bool QgsPostgresProvider::getNextFeature( QgsFeature& feature )
bool QgsPostgresProvider::nextFeature( QgsFeature& feature )
{
QString cursorName = QString( "qgisf%1" ).arg( providerId );
@ -624,7 +624,7 @@ bool QgsPostgresProvider::getNextFeature( QgsFeature& feature )
return true;
}
bool QgsPostgresProvider::getFeatureAtId( int featureId, QgsFeature& feature, bool fetchGeometry, QgsAttributeList fetchAttributes )
bool QgsPostgresProvider::featureAtId( int featureId, QgsFeature& feature, bool fetchGeometry, QgsAttributeList fetchAttributes )
{
QString cursorName = QString( "qgisfid%1" ).arg( providerId );
if ( !declareCursor( cursorName, fetchAttributes, fetchGeometry, QString( "%2=%3" ).arg( quotedIdentifier( primaryKey ) ).arg( featureId ) ) )
@ -1612,7 +1612,7 @@ bool QgsPostgresProvider::isValid()
return valid;
}
QVariant QgsPostgresProvider::getDefaultValue( QString fieldName )
QVariant QgsPostgresProvider::defaultValue( QString fieldName )
{
// Get the default column value from the Postgres information
// schema. If there is no default we return an empty string.
@ -1639,11 +1639,11 @@ QVariant QgsPostgresProvider::getDefaultValue( QString fieldName )
return defaultValue;
}
QVariant QgsPostgresProvider::getDefaultValue( int fieldId )
QVariant QgsPostgresProvider::defaultValue( int fieldId )
{
try
{
return getDefaultValue( field( fieldId ).name() );
return defaultValue( field( fieldId ).name() );
}
catch ( PGFieldNotFound )
{
@ -1754,7 +1754,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList & flist )
const QgsAttributeMap &attributevec = flist[0].attributeMap();
QStringList defaultValue;
QStringList defaultValues;
QList<int> fieldId;
// look for unique attribute values to place in statement instead of passing as parameter
@ -1787,7 +1787,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList & flist )
insert += "," + quotedIdentifier( fieldname );
QString defVal = getDefaultValue( it.key() ).toString();
QString defVal = defaultValue( it.key() ).toString();
if ( i == flist.size() )
{
@ -1810,8 +1810,8 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList & flist )
else
{
// value is not unique => add parameter
values += QString( ",$%1" ).arg( defaultValue.size() + 3 );
defaultValue.append( defVal );
values += QString( ",$%1" ).arg( defaultValues.size() + 3 );
defaultValues.append( defVal );
fieldId.append( it.key() );
}
}
@ -1824,7 +1824,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList & flist )
throw PGException( stmt );
PQclear( stmt );
QString keyDefault = getDefaultValue( primaryKey ).toString();
QString keyDefault = defaultValue( primaryKey ).toString();
int primaryKeyHighWater = -1;
if ( keyDefault.isNull() )
primaryKeyHighWater = maxPrimaryKeyValue();
@ -1854,7 +1854,7 @@ bool QgsPostgresProvider::addFeatures( QgsFeatureList & flist )
}
for ( int i = 0; i < fieldId.size(); i++ )
params << paramValue( attributevec[ fieldId[i] ].toString(), defaultValue[i] );
params << paramValue( attributevec[ fieldId[i] ].toString(), defaultValues[i] );
PGresult *result = connectionRW->PQexecPrepared( "addfeatures", params );
if ( result == 0 || PQresultStatus( result ) == PGRES_FATAL_ERROR )
@ -2155,7 +2155,7 @@ bool QgsPostgresProvider::changeGeometryValues( QgsGeometryMap & geometry_map )
return returnvalue;
}
QgsAttributeList QgsPostgresProvider::allAttributesList()
QgsAttributeList QgsPostgresProvider::attributeIndexes()
{
QgsAttributeList attributes;
for ( QgsFieldMap::const_iterator it = attributeFields.constBegin(); it != attributeFields.constEnd(); ++it )

View File

@ -75,7 +75,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
*/
virtual QgsCoordinateReferenceSystem getCRS();
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -92,7 +92,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
/**
* Gets the feature at the given feature ID.
@ -102,7 +102,7 @@ class QgsPostgresProvider : public QgsVectorDataProvider
* @param fetchAttributes a list containing the indexes of the attribute fields to copy
* @return True when feature was found, otherwise false
*/
virtual bool getFeatureAtId( int featureId,
virtual bool featureAtId( int featureId,
QgsFeature& feature,
bool fetchGeometry = true,
QgsAttributeList fetchAttributes = QgsAttributeList() );
@ -195,13 +195,13 @@ class QgsPostgresProvider : public QgsVectorDataProvider
*/
bool isValid();
QgsAttributeList allAttributesList();
QgsAttributeList attributeIndexes();
/**Returns the default value for field specified by @c fieldName */
QVariant getDefaultValue( QString fieldName );
QVariant defaultValue( QString fieldName );
/**Returns the default value for field specified by @c fieldId */
QVariant getDefaultValue( int fieldId );
QVariant defaultValue( int fieldId );
/**Adds a list of features
@return true in case of success and false in case of failure*/

View File

@ -63,7 +63,7 @@ QgsWFSProvider::~QgsWFSProvider()
delete mSpatialIndex;
}
bool QgsWFSProvider::getNextFeature( QgsFeature& feature )
bool QgsWFSProvider::nextFeature( QgsFeature& feature )
{
while ( true ) //go through the loop until we find a feature in the filter
{

View File

@ -46,7 +46,7 @@ class QgsWFSProvider: public QgsVectorDataProvider
/* Inherited from QgsVectorDataProvider */
/** Select features based on a bounding rectangle. Features can be retrieved with calls to getNextFeature.
/** Select features based on a bounding rectangle. Features can be retrieved with calls to nextFeature.
* @param fetchAttributes list of attributes which should be fetched
* @param rect spatial filter
* @param fetchGeometry true if the feature geometry should be fetched
@ -63,7 +63,7 @@ class QgsWFSProvider: public QgsVectorDataProvider
* @param feature feature which will receive data from the provider
* @return true when there was a feature to fetch, false when end was hit
*/
virtual bool getNextFeature( QgsFeature& feature );
virtual bool nextFeature( QgsFeature& feature );
QGis::WKBTYPE geometryType() const;
long featureCount() const;
@ -114,7 +114,7 @@ class QgsWFSProvider: public QgsVectorDataProvider
QgsSpatialIndex *mSpatialIndex;
/**Vector where the ids of the selected features are inserted*/
QList<int> mSelectedFeatures;
/**Iterator on the feature vector for use in begin(), getNextFeature(), etc...*/
/**Iterator on the feature vector for use in begin(), nextFeature(), etc...*/
QList<int>::iterator mFeatureIterator;
/**Vector where the features are inserted*/
QList<QgsFeature*> mFeatures;