diff --git a/src/analysis/processing/qgsalgorithmdifference.cpp b/src/analysis/processing/qgsalgorithmdifference.cpp index 401acabe40b7..76fa3b7e15f8 100644 --- a/src/analysis/processing/qgsalgorithmdifference.cpp +++ b/src/analysis/processing/qgsalgorithmdifference.cpp @@ -106,8 +106,8 @@ QVariantMap QgsDifferenceAlgorithm::processAlgorithm( const QVariantMap ¶met QVariantMap outputs; outputs.insert( QStringLiteral( "OUTPUT" ), dest ); - int count = 0; - int total = sourceA->featureCount(); + long count = 0; + const long total = sourceA->featureCount(); QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputA ); return outputs; diff --git a/src/analysis/processing/qgsalgorithmintersection.cpp b/src/analysis/processing/qgsalgorithmintersection.cpp index f07bdfcb87b6..d8c3c3ec61ba 100644 --- a/src/analysis/processing/qgsalgorithmintersection.cpp +++ b/src/analysis/processing/qgsalgorithmintersection.cpp @@ -109,8 +109,8 @@ QVariantMap QgsIntersectionAlgorithm::processAlgorithm( const QVariantMap ¶m QVariantMap outputs; outputs.insert( QStringLiteral( "OUTPUT" ), dest ); - int count = 0; - int total = sourceA->featureCount(); + long count = 0; + const long total = sourceA->featureCount(); QgsOverlayUtils::intersection( *sourceA, *sourceB, *sink, context, feedback, count, total, fieldIndicesA, fieldIndicesB ); diff --git a/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp b/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp index 692ba652e43c..a806c9420c89 100644 --- a/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp +++ b/src/analysis/processing/qgsalgorithmsymmetricaldifference.cpp @@ -92,8 +92,8 @@ QVariantMap QgsSymmetricalDifferenceAlgorithm::processAlgorithm( const QVariantM QVariantMap outputs; outputs.insert( QStringLiteral( "OUTPUT" ), dest ); - int count = 0; - int total = sourceA->featureCount() + sourceB->featureCount(); + long count = 0; + const long total = sourceA->featureCount() + sourceB->featureCount(); QgsOverlayUtils::difference( *sourceA, *sourceB, *sink, context, feedback, count, total, QgsOverlayUtils::OutputAB ); if ( feedback->isCanceled() ) diff --git a/src/analysis/processing/qgsalgorithmunion.cpp b/src/analysis/processing/qgsalgorithmunion.cpp index 1cdeedec6d4d..06591ef2e847 100644 --- a/src/analysis/processing/qgsalgorithmunion.cpp +++ b/src/analysis/processing/qgsalgorithmunion.cpp @@ -102,8 +102,8 @@ QVariantMap QgsUnionAlgorithm::processAlgorithm( const QVariantMap ¶meters, QList fieldIndicesA = QgsProcessingUtils::fieldNamesToIndices( QStringList(), sourceA->fields() ); QList fieldIndicesB = QgsProcessingUtils::fieldNamesToIndices( QStringList(), sourceB->fields() ); - int count = 0; - int total = sourceA->featureCount() * 2 + sourceB->featureCount(); + long count = 0; + const long total = sourceA->featureCount() * 2 + sourceB->featureCount(); QgsOverlayUtils::intersection( *sourceA, *sourceB, *sink, context, feedback, count, total, fieldIndicesA, fieldIndicesB ); if ( feedback->isCanceled() ) diff --git a/src/analysis/processing/qgsoverlayutils.cpp b/src/analysis/processing/qgsoverlayutils.cpp index 01d1a2009a88..e077e365faa1 100644 --- a/src/analysis/processing/qgsoverlayutils.cpp +++ b/src/analysis/processing/qgsoverlayutils.cpp @@ -82,7 +82,7 @@ static bool sanitizeDifferenceResult( QgsGeometry &geom, QgsWkbTypes::GeometryTy } -void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, int &count, int totalCount, QgsOverlayUtils::DifferenceOutput outputAttrs ) +void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long &count, long totalCount, QgsOverlayUtils::DifferenceOutput outputAttrs ) { QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::geometryType( QgsWkbTypes::multiType( sourceA.wkbType() ) ); QgsFeatureRequest requestB; @@ -189,12 +189,12 @@ void QgsOverlayUtils::difference( const QgsFeatureSource &sourceA, const QgsFeat } ++count; - feedback->setProgress( count / ( double ) totalCount * 100. ); + feedback->setProgress( count / static_cast< double >( totalCount ) * 100. ); } } -void QgsOverlayUtils::intersection( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, int &count, int totalCount, const QList &fieldIndicesA, const QList &fieldIndicesB ) +void QgsOverlayUtils::intersection( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long &count, long totalCount, const QList &fieldIndicesA, const QList &fieldIndicesB ) { QgsWkbTypes::GeometryType geometryType = QgsWkbTypes::geometryType( QgsWkbTypes::multiType( sourceA.wkbType() ) ); int attrCount = fieldIndicesA.count() + fieldIndicesB.count(); @@ -267,14 +267,14 @@ void QgsOverlayUtils::intersection( const QgsFeatureSource &sourceA, const QgsFe } ++count; - feedback->setProgress( count / ( double ) totalCount * 100. ); + feedback->setProgress( count / static_cast( totalCount ) * 100. ); } } void QgsOverlayUtils::resolveOverlaps( const QgsFeatureSource &source, QgsFeatureSink &sink, QgsProcessingFeedback *feedback ) { - int count = 0; - int totalCount = source.featureCount(); + long count = 0; + const long totalCount = source.featureCount(); if ( totalCount == 0 ) return; // nothing to do here @@ -418,7 +418,7 @@ void QgsOverlayUtils::resolveOverlaps( const QgsFeatureSource &source, QgsFeatur } ++count; - feedback->setProgress( count / ( double ) totalCount * 100. ); + feedback->setProgress( count / static_cast< double >( totalCount ) * 100. ); } if ( feedback->isCanceled() ) return; diff --git a/src/analysis/processing/qgsoverlayutils.h b/src/analysis/processing/qgsoverlayutils.h index 75ecddf12bae..7b841c4fffbc 100644 --- a/src/analysis/processing/qgsoverlayutils.h +++ b/src/analysis/processing/qgsoverlayutils.h @@ -41,9 +41,9 @@ namespace QgsOverlayUtils OutputBA, //!< Write attributes of both layers, inverted (first attributes of B, then attributes of A) }; - void difference( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, int &count, int totalCount, DifferenceOutput outputAttrs ); + void difference( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long &count, long totalCount, DifferenceOutput outputAttrs ); - void intersection( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, int &count, int totalCount, const QList &fieldIndicesA, const QList &fieldIndicesB ); + void intersection( const QgsFeatureSource &sourceA, const QgsFeatureSource &sourceB, QgsFeatureSink &sink, QgsProcessingContext &context, QgsProcessingFeedback *feedback, long &count, long totalCount, const QList &fieldIndicesA, const QList &fieldIndicesB ); //! Makes sure that what came out from intersection of two geometries is good to be used in the output bool sanitizeIntersectionResult( QgsGeometry &geom, QgsWkbTypes::GeometryType geometryType );