Skip to content
Permalink
Browse files
update calls to new api
  • Loading branch information
jef-n committed Jan 29, 2013
1 parent 94491b8 commit dc728f6c3939fa12b98ce651e48b08b234674bb5
Showing with 338 additions and 284 deletions.
  1. +4 −3 src/analysis/interpolation/qgsinterpolator.cpp
  2. +4 −2 src/analysis/interpolation/qgstininterpolator.cpp
  3. +7 −6 src/analysis/network/qgslinevectorlayerdirector.cpp
  4. +24 −27 src/analysis/vector/qgsgeometryanalyzer.cpp
  5. +10 −9 src/analysis/vector/qgsoverlayanalyzer.cpp
  6. +0 −1 src/analysis/vector/qgszonalstatistics.cpp
  7. +2 −2 src/app/legend/qgslegendlayer.cpp
  8. +1 −1 src/app/nodetool/qgsmaptoolnodetool.cpp
  9. +1 −1 src/app/nodetool/qgsselectedfeature.cpp
  10. +1 −1 src/app/qgsattributedialog.cpp
  11. +6 −3 src/app/qgsattributetabledialog.cpp
  12. +5 −3 src/app/qgsattributetypedialog.cpp
  13. +6 −4 src/app/qgsattributetypeloaddialog.cpp
  14. +2 −2 src/app/qgsfieldcalculator.cpp
  15. +2 −2 src/app/qgsgraduatedsymboldialog.cpp
  16. +3 −3 src/app/qgsidentifyresults.cpp
  17. +1 −1 src/app/qgslabelpropertydialog.cpp
  18. +1 −1 src/app/qgsmaptooldeletepart.cpp
  19. +1 −1 src/app/qgsmaptooldeletering.cpp
  20. +2 −2 src/app/qgsmaptoolfeatureaction.cpp
  21. +2 −2 src/app/qgsmaptoolidentify.cpp
  22. +9 −6 src/app/qgsmaptoollabel.cpp
  23. +2 −2 src/app/qgsmaptoolmovefeature.cpp
  24. +1 −1 src/app/qgsmaptooloffsetcurve.cpp
  25. +2 −2 src/app/qgsmaptoolreshape.cpp
  26. +3 −3 src/app/qgsmaptoolrotatefeature.cpp
  27. +1 −1 src/app/qgsmaptoolrotatepointsymbols.cpp
  28. +2 −2 src/app/qgsmaptoolselectutils.cpp
  29. +3 −3 src/app/qgsmaptoolshowhidelabels.cpp
  30. +3 −3 src/app/qgsmaptoolsimplify.cpp
  31. +1 −1 src/app/qgsmergeattributesdialog.cpp
  32. +12 −12 src/core/composer/qgsatlascomposition.cpp
  33. +8 −9 src/core/composer/qgscomposerattributetable.cpp
  34. +4 −3 src/core/qgsfeaturerequest.h
  35. +9 −7 src/core/qgsofflineediting.cpp
  36. +13 −10 src/core/qgsvectorfilewriter.cpp
  37. +6 −7 src/core/qgsvectorlayereditutils.cpp
  38. +8 −2 src/core/qgsvectorlayerimport.cpp
  39. +9 −8 src/core/qgsvectorlayerjoinbuffer.cpp
  40. +30 −30 src/core/qgsvectorlayerundocommand.cpp
  41. +3 −2 src/core/symbology-ng/qgsgraduatedsymbolrendererv2.cpp
  42. +3 −5 src/core/symbology-ng/qgspointdisplacementrenderer.cpp
  43. +2 −2 src/gui/attributetable/qgsattributetablememorymodel.cpp
  44. +5 −5 src/gui/attributetable/qgsattributetablemodel.cpp
  45. +3 −2 src/gui/qgsattributeeditor.cpp
  46. +1 −2 src/gui/qgsexpressionbuilderwidget.cpp
  47. +4 −4 src/gui/qgsformannotationitem.cpp
  48. +3 −3 src/gui/qgshtmlannotationitem.cpp
  49. +1 −2 src/gui/qgsmaptip.cpp
  50. +4 −5 src/gui/qgssearchquerybuilder.cpp
  51. +4 −4 src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
  52. +60 −23 src/mapserver/qgswfsserver.cpp
  53. +5 −2 src/mapserver/qgswmsserver.cpp
  54. +4 −4 src/plugins/diagram_overlay/qgsdiagramoverlay.cpp
  55. +1 −1 src/plugins/evis/eventbrowser/evisgenericeventbrowsergui.cpp
  56. +2 −2 src/plugins/evis/idtool/eviseventidtool.cpp
  57. +2 −3 src/plugins/globe/globe_plugin.cpp
  58. +2 −2 src/plugins/heatmap/heatmap.cpp
  59. +8 −12 src/plugins/spatialquery/qgsreaderfeatures.cpp
  60. +1 −0 src/plugins/spatialquery/qgsreaderfeatures.h
  61. +1 −1 src/plugins/spatialquery/qgsrubberselectid.cpp
  62. +2 −2 src/plugins/spatialquery/qgsspatialquery.cpp
  63. +1 −1 src/plugins/spatialquery/qgsspatialquerydialog.cpp
  64. +3 −4 tests/src/core/testqgscomposerlabel.cpp
  65. +2 −2 tests/src/core/testqgsvectorlayer.cpp
@@ -67,13 +67,14 @@ int QgsInterpolator::cacheBaseData()
attList.push_back( v_it->interpolationAttribute );
}

vlayer->select( attList );

QgsFeature theFeature;
double attributeValue = 0.0;
bool attributeConversionOk = false;

while ( vlayer->nextFeature( theFeature ) )
QgsFeatureIterator fit = vlayer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( attList ) );

QgsFeature theFeature;
while ( fit.nextFeature( theFeature ) )
{
if ( !v_it->zCoordInterpolation )
{
@@ -113,8 +113,10 @@ void QgsTINInterpolator::initialize()
{
attList.push_back( layerDataIt->interpolationAttribute );
}
layerDataIt->vectorLayer->select( attList );
while ( layerDataIt->vectorLayer->nextFeature( f ) )

QgsFeatureIterator fit = layerDataIt->vectorLayer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( attList ) );

while ( fit.nextFeature( f ) )
{
if ( mShowProgressDialog )
{
@@ -158,11 +158,12 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
//Graph's points;
QVector< QgsPoint > points;

QgsFeatureIterator fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QgsAttributeList() ) );

// begin: tie points to the graph
QgsAttributeList la;
vl->select( la );
QgsFeature feature;
while ( vl->nextFeature( feature ) )
while ( fit.nextFeature( feature ) )
{
QgsMultiPolyline mpl;
if ( feature.geometry()->wkbType() == QGis::WKBMultiLineString )
@@ -233,7 +234,6 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
QVector< QgsPoint >::iterator tmp = std::unique( points.begin(), points.end() );
points.resize( tmp - points.begin() );


for ( i = 0;i < points.size();++i )
builder->addVertex( i, points[ i ] );

@@ -242,7 +242,8 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c

qSort( pointLengthMap.begin(), pointLengthMap.end(), TiePointInfoCompare );

{ // fill attribute list 'la'
{
// fill attribute list 'la'
QgsAttributeList tmpAttr;
if ( mDirectionFieldId != -1 )
{
@@ -277,8 +278,8 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
} // end fill attribute list 'la'

// begin graph construction
vl->select( la );
while ( vl->nextFeature( feature ) )
fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( la ) );
while ( fit.nextFeature( feature ) )
{
int directionType = mDefaultDirection;

@@ -73,7 +73,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer,
{
break;
}
if ( !layer->featureAtId( *it, currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -89,8 +89,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer,
//take all features
else
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), true, false );

QgsFeatureIterator fit = layer->getFeatures();

int featureCount = layer->featureCount();
if ( p )
@@ -99,7 +98,7 @@ bool QgsGeometryAnalyzer::simplify( QgsVectorLayer* layer,
}
int processedFeatures = 0;

while ( layer->nextFeature( currentFeature ) )
while ( fit.nextFeature( currentFeature ) )
{
if ( p )
{
@@ -189,7 +188,7 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
{
break;
}
if ( !layer->featureAtId( *it, currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -205,7 +204,7 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
//take all features
else
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), true, false );
QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( QgsAttributeList() ) );

int featureCount = layer->featureCount();
if ( p )
@@ -214,7 +213,7 @@ bool QgsGeometryAnalyzer::centroids( QgsVectorLayer* layer, const QString& shape
}
int processedFeatures = 0;

while ( layer->nextFeature( currentFeature ) )
while ( fit.nextFeature( currentFeature ) )
{
if ( p )
{
@@ -435,7 +434,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
return false;
}
#endif
if ( !layer->featureAtId( *it, currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -444,8 +443,8 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
}
else
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), true, false );
while ( layer->nextFeature( currentFeature ) )
QgsFeatureIterator fit = layer->getFeatures();
while ( fit.nextFeature( currentFeature ) )
{
#if 0
if ( p )
@@ -489,7 +488,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
{
p->setValue( processedFeatures );
}
if ( !layer->featureAtId( jt.value(), currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( jt.value() ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -535,7 +534,7 @@ bool QgsGeometryAnalyzer::convexHull( QgsVectorLayer* layer, const QString& shap
{
break;
}
if ( !layer->featureAtId( jt.value(), currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( jt.value() ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -629,7 +628,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
QgsFeatureIds::const_iterator it = selection.constBegin();
for ( ; it != selection.constEnd(); ++it )
{
if ( !layer->featureAtId( *it, currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -638,8 +637,8 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
}
else
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), true, false );
while ( layer->nextFeature( currentFeature ) )
QgsFeatureIterator fit = layer->getFeatures();
while ( fit.nextFeature( currentFeature ) )
{
map.insert( currentFeature.attribute( uniqueIdField ).toString(), currentFeature.id() );
}
@@ -674,7 +673,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
{
p->setValue( processedFeatures );
}
if ( !layer->featureAtId( jt.value(), currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( jt.value() ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -708,7 +707,7 @@ bool QgsGeometryAnalyzer::dissolve( QgsVectorLayer* layer, const QString& shapef
{
break;
}
if ( !layer->featureAtId( jt.value(), currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( jt.value() ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -798,7 +797,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
{
break;
}
if ( !layer->featureAtId( *it, currentFeature, true, true ) )
if ( !layer->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -814,8 +813,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
//take all features
else
{
layer->select( layer->pendingAllAttributesList(), QgsRectangle(), true, false );

QgsFeatureIterator fit = layer->getFeatures();

int featureCount = layer->featureCount();
if ( p )
@@ -824,7 +822,7 @@ bool QgsGeometryAnalyzer::buffer( QgsVectorLayer* layer, const QString& shapefil
}
int processedFeatures = 0;

while ( layer->nextFeature( currentFeature ) )
while ( fit.nextFeature( currentFeature ) )
{
if ( p )
{
@@ -920,10 +918,9 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*

//create line field / id map for line layer
QMultiHash< QString, QgsFeatureId > lineLayerIdMap; //1:n possible (e.g. several linear reference geometries for one feature in the event layer)
lineLayer->select( QgsAttributeList() << lineField,
QgsRectangle(), false, false );
QgsFeatureIterator fit = lineLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ).setSubsetOfAttributes( QgsAttributeList() << lineField ) );
QgsFeature fet;
while ( lineLayer->nextFeature( fet ) )
while ( fit.nextFeature( fet ) )
{
lineLayerIdMap.insert( fet.attribute( lineField ).toString(), fet.id() );
}
@@ -955,7 +952,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
}

//iterate over eventLayer and write new features to output file or layer
eventLayer->select( eventLayer->pendingAllAttributesList(), QgsRectangle(), false, false );
fit = eventLayer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ) );
QgsGeometry* lrsGeom = 0;
QgsFeature lineFeature;
double measure1, measure2 = 0.0;
@@ -971,7 +968,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
p->show();
}

while ( eventLayer->nextFeature( fet ) )
while ( fit.nextFeature( fet ) )
{
nOutputFeatures = 0;

@@ -996,7 +993,7 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
QList<QgsFeatureId>::const_iterator featureIdIt = featureIdList.constBegin();
for ( ; featureIdIt != featureIdList.constEnd(); ++featureIdIt )
{
if ( !lineLayer->featureAtId( *featureIdIt, lineFeature, true, false ) )
if ( !lineLayer->getFeatures( QgsFeatureRequest().setFilterFid( *featureIdIt ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( lineFeature ) )
{
continue;
}
@@ -60,7 +60,7 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
QgsFeatureIds::const_iterator it = selectionB.constBegin();
for ( ; it != selectionB.constEnd(); ++it )
{
if ( !layerB->featureAtId( *it, currentFeature, true, true ) )
if ( !layerB->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -86,7 +86,7 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
{
break;
}
if ( !layerA->featureAtId( *it, currentFeature, true, true ) )
if ( !layerA->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( currentFeature ) )
{
continue;
}
@@ -102,13 +102,11 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
//take all features
else
{
layerB->select( layerB->pendingAllAttributesList(), QgsRectangle(), true, false );
while ( layerB->nextFeature( currentFeature ) )
QgsFeatureIterator fit = layerB->getFeatures();
while ( fit.nextFeature( currentFeature ) )
{
index.insertFeature( currentFeature );
}
QgsFeature currentFeature;
layerA->select( layerA->pendingAllAttributesList(), QgsRectangle(), true, false );

int featureCount = layerA->featureCount();
if ( p )
@@ -117,7 +115,10 @@ bool QgsOverlayAnalyzer::intersection( QgsVectorLayer* layerA, QgsVectorLayer* l
}
int processedFeatures = 0;

while ( layerA->nextFeature( currentFeature ) )
fit = layerA->getFeatures();

QgsFeature currentFeature;
while ( fit.nextFeature( currentFeature ) )
{
if ( p )
{
@@ -156,7 +157,7 @@ void QgsOverlayAnalyzer::intersectFeature( QgsFeature& f, QgsVectorFileWriter* v
QgsFeature outFeature;
for ( ; it != intersects.constEnd(); ++it )
{
if ( !vl->featureAtId( *it, overlayFeature, true, true ) )
if ( !vl->getFeatures( QgsFeatureRequest().setFilterFid( *it ) ).nextFeature( overlayFeature ) )
{
continue;
}
@@ -192,7 +193,7 @@ void QgsOverlayAnalyzer::combineFieldLists( QgsFields& fieldListA, const QgsFiel
int count = 0;
while ( names.contains( field.name() ) )
{
QString name = QString("%1_%2").arg( field.name() ).arg( count );
QString name = QString( "%1_%2" ).arg( field.name() ).arg( count );
field = QgsField( name, field.type() );
++count;
}
@@ -140,7 +140,6 @@ int QgsZonalStatistics::calculateStatistics( QProgressDialog* p )
QgsFeatureRequest request;
request.setSubsetOfAttributes( QgsAttributeList() );
QgsFeatureIterator fi = vectorProvider->getFeatures( request );
//vectorProvider->select( QgsAttributeList(), QgsRectangle(), true, false );
QgsFeature f;
double count = 0;
double sum = 0;
@@ -687,11 +687,11 @@ void QgsLegendLayer::updateItemListCount( QgsVectorLayer* layer, const QList<Qgs
p.setWindowModality( Qt::WindowModal );
int featuresCounted = 0;

layer->select( layer->pendingAllAttributesList(), QgsRectangle(), false, false );
QgsFeatureIterator fit = layer->getFeatures( QgsFeatureRequest().setFlags( QgsFeatureRequest::NoGeometry ) );
QgsFeature f;
QgsSymbol* currentSymbol = 0;

while ( layer->nextFeature( f ) )
while ( fit.nextFeature( f ) )
{
currentSymbol = renderer->symbolForFeature( &f );
if ( currentSymbol )
@@ -148,7 +148,7 @@ void QgsMapToolNodeTool::createTopologyRubberBands( QgsVectorLayer* vlayer, cons
int tVertexFirst = tVertex; // vertex number to check for cycling
QgsFeature topolFeature;

vlayer->featureAtId( resultIt.value().snappedAtGeometry, topolFeature, true, false );
vlayer->getFeatures( QgsFeatureRequest().setFilterFid( resultIt.value().snappedAtGeometry ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( topolFeature );
QgsGeometry* topolGeometry = topolFeature.geometry();

while ( tVertex != -1 ) // looking for first vertex to rubberband
@@ -75,7 +75,7 @@ void QgsSelectedFeature::updateGeometry( QgsGeometry *geom )
if ( !geom )
{
QgsFeature f;
mVlayer->featureAtId( mFeatureId, f );
mVlayer->getFeatures( QgsFeatureRequest().setFilterFid( mFeatureId ) ).nextFeature( f );
mGeometry = new QgsGeometry( *f.geometry() );
}
else
@@ -261,7 +261,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
if ( !mFeature->geometry() && exp.needsGeometry() )
{
QgsFeature f;
if ( vl->featureAtId( mFeature->id(), f, true, false ) && f.geometry() )
if ( vl->getFeatures( QgsFeatureRequest().setFilterFid( mFeature->id() ).setSubsetOfAttributes( QgsAttributeList() ) ).nextFeature( f ) && f.geometry() )
{
mFeature->setGeometry( *f.geometry() );
}
Loading

2 comments on commit dc728f6

@NathanW2

This comment has been minimized.

Copy link
Member

@NathanW2 NathanW2 replied Jan 29, 2013

Sometimes it's scary how quick you work Jurgen.

@wonder-sk

This comment has been minimized.

Copy link
Member

@wonder-sk wonder-sk replied Jan 29, 2013

Thanks a lot for this update!

Please sign in to comment.