Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] authored and Djedouas committed Dec 6, 2024
1 parent 1e22d8d commit d16face
Show file tree
Hide file tree
Showing 18 changed files with 295 additions and 332 deletions.
10 changes: 4 additions & 6 deletions src/analysis/processing/qgsalgorithmcheckgeometryangle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@ void QgsGeometryCheckAngleAlgorithm::initAlgorithm( const QVariantMap &configura
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorAnyGeometry ) );

std::unique_ptr< QgsProcessingParameterNumber > tolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "TOLERANCE" ),
QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
addParameter( tolerance.release() );
}
Expand Down Expand Up @@ -128,11 +127,11 @@ auto QgsGeometryCheckAngleAlgorithm::processAlgorithm( const QVariantMap &parame
QgsFields fields = outputFields();
fields.append( uniqueIdField );

const std::unique_ptr< QgsFeatureSink > sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
if ( !sink_output )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

const std::unique_ptr< QgsFeatureSink > sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
if ( !sink_errors )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "ERRORS" ) ) );

Expand Down Expand Up @@ -165,13 +164,12 @@ auto QgsGeometryCheckAngleAlgorithm::processAlgorithm( const QVariantMap &parame

multiStepFeedback.setCurrentStep( 3 );
feedback->setProgressText( QObject::tr( "Exporting errors…" ) );
const double step{checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1};
const double step { checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1 };
long i = 0;
feedback->setProgress( 0.0 );

for ( const QgsGeometryCheckError *error : checkErrors )
{

if ( feedback->isCanceled() )
{
break;
Expand Down
7 changes: 2 additions & 5 deletions src/analysis/processing/qgsalgorithmcheckgeometryangle.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
class QgsGeometryCheckAngleAlgorithm : public QgsProcessingAlgorithm
{
public:

QgsGeometryCheckAngleAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
QString name() const override;
Expand All @@ -42,14 +41,12 @@ class QgsGeometryCheckAngleAlgorithm : public QgsProcessingAlgorithm
QgsGeometryCheckAngleAlgorithm *createInstance() const override SIP_FACTORY;

protected:

bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;

private:
QgsFeaturePool *createFeaturePool( QgsVectorLayer *layer ) const;
int mTolerance{8};
int mTolerance { 8 };
};

///@endcond PRIVATE
Expand Down
14 changes: 6 additions & 8 deletions src/analysis/processing/qgsalgorithmcheckgeometryarea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ auto QgsGeometryCheckAreaAlgorithm::shortHelpString() const -> QString
return QObject::tr( "This algorithm check the area of geometry (polygon)." );
}

auto QgsGeometryCheckAreaAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags
auto QgsGeometryCheckAreaAlgorithm::flags() const -> Qgis::ProcessingAlgorithmFlags
{
return QgsProcessingAlgorithm::flags() | Qgis::ProcessingAlgorithmFlag::NoThreading;
}
Expand Down Expand Up @@ -83,8 +83,7 @@ void QgsGeometryCheckAreaAlgorithm::initAlgorithm( const QVariantMap &configurat
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) );

std::unique_ptr< QgsProcessingParameterNumber > tolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "TOLERANCE" ),
QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
addParameter( tolerance.release() );
}
Expand All @@ -95,7 +94,7 @@ auto QgsGeometryCheckAreaAlgorithm::prepareAlgorithm( const QVariantMap &paramet
return true;
}

static auto outputFields( ) -> QgsFields
static auto outputFields() -> QgsFields
{
QgsFields fields;
fields.append( QgsField( QStringLiteral( "gc_layerid" ), QMetaType::QString ) );
Expand Down Expand Up @@ -126,11 +125,11 @@ auto QgsGeometryCheckAreaAlgorithm::processAlgorithm( const QVariantMap &paramet
QgsFields fields = outputFields();
fields.append( uniqueIdField );

const std::unique_ptr< QgsFeatureSink > sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
if ( !sink_output )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

const std::unique_ptr< QgsFeatureSink > sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
if ( !sink_errors )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "ERRORS" ) ) );

Expand Down Expand Up @@ -163,13 +162,12 @@ auto QgsGeometryCheckAreaAlgorithm::processAlgorithm( const QVariantMap &paramet

multiStepFeedback.setCurrentStep( 3 );
feedback->setProgressText( QObject::tr( "Exporting errors…" ) );
const double step{checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1};
const double step { checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1 };
long i = 0;
feedback->setProgress( 0.0 );

for ( QgsGeometryCheckError *error : checkErrors )
{

if ( feedback->isCanceled() )
{
break;
Expand Down
7 changes: 2 additions & 5 deletions src/analysis/processing/qgsalgorithmcheckgeometryarea.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
class QgsGeometryCheckAreaAlgorithm : public QgsProcessingAlgorithm
{
public:

QgsGeometryCheckAreaAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
QString name() const override;
Expand All @@ -42,13 +41,11 @@ class QgsGeometryCheckAreaAlgorithm : public QgsProcessingAlgorithm
QgsGeometryCheckAreaAlgorithm *createInstance() const override SIP_FACTORY;

protected:

bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;

private:
int mTolerance{8};
int mTolerance { 8 };
};

///@endcond PRIVATE
Expand Down
12 changes: 5 additions & 7 deletions src/analysis/processing/qgsalgorithmcheckgeometryhole.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ void QgsGeometryCheckHoleAlgorithm::initAlgorithm( const QVariantMap &configurat
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) );

std::unique_ptr< QgsProcessingParameterNumber > tolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "TOLERANCE" ),
QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
addParameter( tolerance.release() );
}
Expand All @@ -95,7 +94,7 @@ auto QgsGeometryCheckHoleAlgorithm::prepareAlgorithm( const QVariantMap &paramet
return true;
}

static auto outputFields( ) -> QgsFields
static auto outputFields() -> QgsFields
{
QgsFields fields;
fields.append( QgsField( QStringLiteral( "gc_layerid" ), QMetaType::QString ) );
Expand Down Expand Up @@ -126,11 +125,11 @@ auto QgsGeometryCheckHoleAlgorithm::processAlgorithm( const QVariantMap &paramet
QgsFields fields = outputFields();
fields.append( uniqueIdField );

const std::unique_ptr< QgsFeatureSink > sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
if ( !sink_output )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

const std::unique_ptr< QgsFeatureSink > sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
if ( !sink_errors )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "ERRORS" ) ) );

Expand Down Expand Up @@ -159,13 +158,12 @@ auto QgsGeometryCheckHoleAlgorithm::processAlgorithm( const QVariantMap &paramet

multiStepFeedback.setCurrentStep( 3 );
feedback->setProgressText( QObject::tr( "Exporting errors…" ) );
const double step{checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1};
const double step { checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1 };
long i = 0;
feedback->setProgress( 0.0 );

for ( QgsGeometryCheckError *error : checkErrors )
{

if ( feedback->isCanceled() )
{
break;
Expand Down
7 changes: 2 additions & 5 deletions src/analysis/processing/qgsalgorithmcheckgeometryhole.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
class QgsGeometryCheckHoleAlgorithm : public QgsProcessingAlgorithm
{
public:

QgsGeometryCheckHoleAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
QString name() const override;
Expand All @@ -41,13 +40,11 @@ class QgsGeometryCheckHoleAlgorithm : public QgsProcessingAlgorithm
QgsGeometryCheckHoleAlgorithm *createInstance() const override SIP_FACTORY;

protected:

bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;

private:
int mTolerance{8};
int mTolerance { 8 };
};

///@endcond PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ void QgsGeometryCheckMissingVertexAlgorithm::initAlgorithm( const QVariantMap &c
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "ERRORS" ), QObject::tr( "Errors layer" ), Qgis::ProcessingSourceType::VectorPoint ) );
addParameter( new QgsProcessingParameterFeatureSink( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ), Qgis::ProcessingSourceType::VectorPolygon ) );

std::unique_ptr< QgsProcessingParameterNumber > tolerance = std::make_unique< QgsProcessingParameterNumber >( QStringLiteral( "TOLERANCE" ),
QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
std::unique_ptr<QgsProcessingParameterNumber> tolerance = std::make_unique<QgsProcessingParameterNumber>( QStringLiteral( "TOLERANCE" ), QObject::tr( "Tolerance" ), Qgis::ProcessingNumberParameterType::Integer, 8, false, 1, 13 );
tolerance->setFlags( tolerance->flags() | Qgis::ProcessingParameterFlag::Advanced );
addParameter( tolerance.release() );
}
Expand All @@ -95,7 +94,7 @@ auto QgsGeometryCheckMissingVertexAlgorithm::prepareAlgorithm( const QVariantMap
return true;
}

static auto outputFields( ) -> QgsFields
static auto outputFields() -> QgsFields
{
QgsFields fields;
fields.append( QgsField( QStringLiteral( "gc_layerid" ), QMetaType::QString ) );
Expand Down Expand Up @@ -126,11 +125,11 @@ auto QgsGeometryCheckMissingVertexAlgorithm::processAlgorithm( const QVariantMap
QgsFields fields = outputFields();
fields.append( uniqueIdField );

const std::unique_ptr< QgsFeatureSink > sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_output( parameterAsSink( parameters, QStringLiteral( "OUTPUT" ), context, dest_output, fields, input->wkbType(), input->sourceCrs() ) );
if ( !sink_output )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "OUTPUT" ) ) );

const std::unique_ptr< QgsFeatureSink > sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
const std::unique_ptr<QgsFeatureSink> sink_errors( parameterAsSink( parameters, QStringLiteral( "ERRORS" ), context, dest_errors, fields, Qgis::WkbType::Point, input->sourceCrs() ) );
if ( !sink_errors )
throw QgsProcessingException( invalidSinkError( parameters, QStringLiteral( "ERRORS" ) ) );

Expand Down Expand Up @@ -158,13 +157,12 @@ auto QgsGeometryCheckMissingVertexAlgorithm::processAlgorithm( const QVariantMap

multiStepFeedback.setCurrentStep( 3 );
feedback->setProgressText( QObject::tr( "Exporting errors…" ) );
const double step{checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1};
const double step { checkErrors.size() > 0 ? 100.0 / checkErrors.size() : 1 };
long i = 0;
feedback->setProgress( 0.0 );

for ( QgsGeometryCheckError *error : checkErrors )
{

if ( feedback->isCanceled() )
{
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
class QgsGeometryCheckMissingVertexAlgorithm : public QgsProcessingAlgorithm
{
public:

QgsGeometryCheckMissingVertexAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
QString name() const override;
Expand All @@ -41,13 +40,11 @@ class QgsGeometryCheckMissingVertexAlgorithm : public QgsProcessingAlgorithm
QgsGeometryCheckMissingVertexAlgorithm *createInstance() const override SIP_FACTORY;

protected:

bool prepareAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
QVariantMap processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;

private:
int mTolerance{8};
int mTolerance { 8 };
};

///@endcond PRIVATE
Expand Down
Loading

0 comments on commit d16face

Please sign in to comment.