Skip to content

Commit

Permalink
Display a progress bar
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Feb 1, 2012
1 parent 8cfefb0 commit c509e43
Showing 1 changed file with 25 additions and 35 deletions.
60 changes: 25 additions & 35 deletions src/analysis/vector/qgsgeometryanalyzer.cpp
Expand Up @@ -949,8 +949,29 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
QgsFeature lineFeature;
double measure1, measure2;

int nEventFeatures = eventLayer->pendingFeatureCount();
int featureCounter = 0;
if( p )
{
p->setWindowModality(Qt::WindowModal);
p->setMinimum( 0 );
p->setMaximum( nEventFeatures );
p->show();
}

while ( eventLayer->nextFeature( fet ) )
{
//update progress dialog
if( p )
{
if( p->wasCanceled() )
{
break;
}
p->setValue( featureCounter );
++featureCounter;
}

measure1 = fet.attributeMap()[locationField1].toDouble();
if ( locationField2 != -1 )
{
Expand Down Expand Up @@ -988,42 +1009,11 @@ bool QgsGeometryAnalyzer::eventLayer( QgsVectorLayer* lineLayer, QgsVectorLayer*
}
}
}
#if 0
//get corresponding line feature
QHash< QString, QgsFeatureId >::const_iterator layerIdIt = lineLayerIdMap.find( fet.attributeMap()[eventField].toString() );
if ( layerIdIt == lineLayerIdMap.constEnd() )
{
continue;
}
if ( !lineLayer->featureAtId( *layerIdIt, lineFeature, true, false ) )
{
continue;
}

measure1 = fet.attributeMap()[locationField1].toDouble();
if ( locationField2 == -1 )
{
lrsGeom = locateAlongMeasure( measure1, lineFeature.geometry() );
}
else
{
measure2 = fet.attributeMap()[locationField2].toDouble();
lrsGeom = locateBetweenMeasures( measure1, measure2, lineFeature.geometry() );
}
}

if ( lrsGeom )
{
fet.setGeometry( lrsGeom );
if ( memoryProvider )
{
memoryProvider->addFeatures( QgsFeatureList() << fet );
}
else
{
fileWriter->addFeature( fet );
}
}
#endif //0
if( p )
{
p->setValue( nEventFeatures );
}

return true;
Expand Down

0 comments on commit c509e43

Please sign in to comment.