Skip to content
Permalink
Browse files
Fix some more truncation of feature count to int
Co-authored-by: Nyall Dawson <nyall.dawson@gmail.com>
  • Loading branch information
rouault and nyalldawson committed Jun 15, 2021
1 parent 92fc435 commit 404b75630a3129a5b7866d8f28e0e26421835f9f
@@ -92,8 +92,8 @@ void QgsTinInterpolator::initialize()
}

//get number of features if we use a progress bar
int nFeatures = 0;
int nProcessedFeatures = 0;
long long nFeatures = 0;
long long nProcessedFeatures = 0;
if ( mFeedback )
{
for ( const LayerData &layer : std::as_const( mLayerData ) )
@@ -1292,8 +1292,8 @@ QVariantMap QgsMeshExportCrossSection::processAlgorithm( const QVariantMap &para
header << datagroup.metadata.name();
textStream << header.join( ',' ) << QStringLiteral( "\n" );

int featCount = featureSource->featureCount();
int featCounter = 0;
long long featCount = featureSource->featureCount();
long long featCounter = 0;
QgsFeatureIterator featIt = featureSource->getFeatures();
QgsFeature feat;
while ( featIt.nextFeature( feat ) )
@@ -117,7 +117,7 @@ QVariantMap QgsNearestNeighbourAnalysisAlgorithm::processAlgorithm( const QVaria
feedback->setProgress( i * step );
}

int count = source->featureCount() > 0 ? source->featureCount() : 1;
long long count = source->featureCount() > 0 ? source->featureCount() : 1;
double observedDistance = sumDist / count;
double expectedDistance = 0.5 / std::sqrt( count / area );
double nnIndex = observedDistance / expectedDistance;
@@ -106,7 +106,7 @@ bool QgsTinMeshCreationAlgorithm::prepareAlgorithm( const QVariantMap &parameter
continue;

const QgsCoordinateTransform transform( featureSource->sourceCrs(), destinationCrs, context.transformContext() );
int featureCount = featureSource->featureCount();
long long featureCount = featureSource->featureCount();
switch ( type )
{
case QgsProcessingParameterTinInputLayers::Vertices:
@@ -51,7 +51,7 @@ class QgsTinMeshCreationAlgorithm: public QgsProcessingAlgorithm
QgsFeatureIterator fit;
QgsCoordinateTransform transform;
int attributeIndex;
int featureCount;
long long featureCount;
};

QList<Layer> mVerticesLayer;
@@ -49,7 +49,7 @@ struct AnchorAlongSegment
};


static void buildSnapIndex( QgsFeatureIterator &fi, QgsSpatialIndex &index, QVector<AnchorPoint> &pnts, QgsFeedback *feedback, int &count, int totalCount )
static void buildSnapIndex( QgsFeatureIterator &fi, QgsSpatialIndex &index, QVector<AnchorPoint> &pnts, QgsFeedback *feedback, long long &count, long long totalCount )
{
QgsFeature f;
int pntId = 0;
@@ -305,8 +305,8 @@ int QgsGeometrySnapperSingleSource::run( const QgsFeatureSource &source, QgsFeat
{
// the logic here comes from GRASS implementation of Vect_snap_lines_list()

int count = 0;
int totalCount = source.featureCount() * 2;
long long count = 0;
long long totalCount = source.featureCount() * 2;

// step 1: record all point locations in a spatial index + extra data structure to keep
// reference to which other point they have been snapped to (in the next phase).
@@ -496,7 +496,7 @@ void QgsSnappingUtils::prepareIndex( const QList<LayerAndAreaOfInterest> &layers
// first time the layer is used? - let's set an initial guess about indexing
if ( !mHybridMaxAreaPerLayer.contains( vl->id() ) )
{
int totalFeatureCount = vl->featureCount();
long long totalFeatureCount = vl->featureCount();
if ( totalFeatureCount < mHybridPerLayerFeatureLimit )
{
// index the whole layer
@@ -647,10 +647,10 @@ void QgsRuleBasedRendererWidget::countFeatures()
req.setSubsetOfAttributes( mRenderer->usedAttributes( renderContext ), mLayer->fields() );
QgsFeatureIterator fit = mLayer->getFeatures( req );

int nFeatures = mLayer->featureCount();
QProgressDialog p( tr( "Calculating feature count." ), tr( "Abort" ), 0, nFeatures );
long long nFeatures = mLayer->featureCount();
QProgressDialog p( tr( "Calculating feature count." ), tr( "Abort" ), 0, 100 );
p.setWindowModality( Qt::WindowModal );
int featuresCounted = 0;
long long featuresCounted = 0;

QgsFeature f;
while ( fit.nextFeature( f ) )
@@ -680,7 +680,7 @@ void QgsRuleBasedRendererWidget::countFeatures()
{
p.setMaximum( 0 );
}
p.setValue( featuresCounted );
p.setValue( static_cast< double >( featuresCounted ) / nFeatures * 100.0 );
if ( p.wasCanceled() )
{
return;

0 comments on commit 404b756

Please sign in to comment.