Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
rename "Fix projection" PDAL algorithm to "Assign projection" to be
consistent with the native and GDAL algorithms
  • Loading branch information
alexbruy committed May 1, 2023
1 parent 1de12f3 commit 080ccdd
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion src/analysis/CMakeLists.txt
Expand Up @@ -423,6 +423,7 @@ if (WITH_PDAL AND PDAL_2_5_OR_HIGHER)

processing/pdal/qgspdalalgorithmbase.cpp

processing/pdal/qgsalgorithmpdalassignprojection.cpp
processing/pdal/qgsalgorithmpdalboundary.cpp
processing/pdal/qgsalgorithmpdalbuildvpc.cpp
processing/pdal/qgsalgorithmpdalclip.cpp
Expand All @@ -432,7 +433,6 @@ if (WITH_PDAL AND PDAL_2_5_OR_HIGHER)
processing/pdal/qgsalgorithmpdalexportrastertin.cpp
processing/pdal/qgsalgorithmpdalexportvector.cpp
processing/pdal/qgsalgorithmpdalfilter.cpp
processing/pdal/qgsalgorithmpdalfixprojection.cpp
processing/pdal/qgsalgorithmpdalinformation.cpp
processing/pdal/qgsalgorithmpdalmerge.cpp
processing/pdal/qgsalgorithmpdalreproject.cpp
Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgsalgorithmpdalfixprojection.cpp
qgsalgorithmpdalassignprojection.cpp
---------------------
begin : February 2023
copyright : (C) 2023 by Alexander Bruy
Expand All @@ -15,56 +15,56 @@
* *
***************************************************************************/

#include "qgsalgorithmpdalfixprojection.h"
#include "qgsalgorithmpdalassignprojection.h"

#include "qgsrunprocess.h"
#include "qgspointcloudlayer.h"

///@cond PRIVATE

QString QgsPdalFixProjectionAlgorithm::name() const
QString QgsPdalAssignProjectionAlgorithm::name() const
{
return QStringLiteral( "fixprojection" );
return QStringLiteral( "assignprojection" );
}

QString QgsPdalFixProjectionAlgorithm::displayName() const
QString QgsPdalAssignProjectionAlgorithm::displayName() const
{
return QObject::tr( "Fix projection" );
return QObject::tr( "Assign projection" );
}

QString QgsPdalFixProjectionAlgorithm::group() const
QString QgsPdalAssignProjectionAlgorithm::group() const
{
return QObject::tr( "Point cloud data management" );
}

QString QgsPdalFixProjectionAlgorithm::groupId() const
QString QgsPdalAssignProjectionAlgorithm::groupId() const
{
return QStringLiteral( "pointclouddatamanagement" );
}

QStringList QgsPdalFixProjectionAlgorithm::tags() const
QStringList QgsPdalAssignProjectionAlgorithm::tags() const
{
return QObject::tr( "assign,set,fix,crs,srs" ).split( ',' );
}

QString QgsPdalFixProjectionAlgorithm::shortHelpString() const
QString QgsPdalAssignProjectionAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm fixes (assigns) point cloud CRS if it is not present or wrong." );
return QObject::tr( "This algorithm assigns point cloud CRS if it is not present or wrong." );
}

QgsPdalFixProjectionAlgorithm *QgsPdalFixProjectionAlgorithm::createInstance() const
QgsPdalAssignProjectionAlgorithm *QgsPdalAssignProjectionAlgorithm::createInstance() const
{
return new QgsPdalFixProjectionAlgorithm();
return new QgsPdalAssignProjectionAlgorithm();
}

void QgsPdalFixProjectionAlgorithm::initAlgorithm( const QVariantMap & )
void QgsPdalAssignProjectionAlgorithm::initAlgorithm( const QVariantMap & )
{
addParameter( new QgsProcessingParameterPointCloudLayer( QStringLiteral( "INPUT" ), QObject::tr( "Input layer" ) ) );
addParameter( new QgsProcessingParameterCrs( QStringLiteral( "CRS" ), QObject::tr( "Desired CRS" ), QStringLiteral( "EPSG:4326" ) ) );
addParameter( new QgsProcessingParameterPointCloudDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Output layer" ) ) );
}

QStringList QgsPdalFixProjectionAlgorithm::createArgumentLists( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
QStringList QgsPdalAssignProjectionAlgorithm::createArgumentLists( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
Q_UNUSED( feedback );

Expand Down
@@ -1,5 +1,5 @@
/***************************************************************************
qgsalgorithmpdalfixprojection.h
qgsalgorithmpdalassignprojection.h
---------------------
begin : February 2023
copyright : (C) 2023 by Alexander Bruy
Expand All @@ -15,8 +15,8 @@
* *
***************************************************************************/

#ifndef QGSALGORITHMPDALFIXPROJECTION_H
#define QGSALGORITHMPDALFIXPROJECTION_H
#ifndef QGSALGORITHMPDALASSIGNPROJECTION_H
#define QGSALGORITHMPDALASSIGNPROJECTION_H

#define SIP_NO_FILE

Expand All @@ -26,22 +26,22 @@
///@cond PRIVATE

/**
* Native fix (assign) projection algorithm for point clouds.
* Native assign projection algorithm for point clouds.
*/
class QgsPdalFixProjectionAlgorithm : public QgsPdalAlgorithmBase
class QgsPdalAssignProjectionAlgorithm : public QgsPdalAlgorithmBase
{

public:

QgsPdalFixProjectionAlgorithm() = default;
QgsPdalAssignProjectionAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
QString name() const override;
QString displayName() const override;
QString group() const override;
QString groupId() const override;
QStringList tags() const override;
QString shortHelpString() const override;
QgsPdalFixProjectionAlgorithm *createInstance() const override SIP_FACTORY;
QgsPdalAssignProjectionAlgorithm *createInstance() const override SIP_FACTORY;

QStringList createArgumentLists( const QVariantMap &parameters,
QgsProcessingContext &context, QgsProcessingFeedback *feedback ) override;
Expand All @@ -51,4 +51,4 @@ class QgsPdalFixProjectionAlgorithm : public QgsPdalAlgorithmBase

///@endcond PRIVATE

#endif // QGSALGORITHMPDALFIXPROJECTION_H
#endif // QGSALGORITHMPDALASSIGNPROJECTION_H
4 changes: 2 additions & 2 deletions src/analysis/processing/pdal/qgspdalalgorithms.cpp
Expand Up @@ -19,6 +19,7 @@
#include "qgsruntimeprofiler.h"
#include "qgsapplication.h"

#include "qgsalgorithmpdalassignprojection.h"
#include "qgsalgorithmpdalboundary.h"
#include "qgsalgorithmpdalbuildvpc.h"
#include "qgsalgorithmpdalclip.h"
Expand All @@ -28,7 +29,6 @@
#include "qgsalgorithmpdalexportrastertin.h"
#include "qgsalgorithmpdalexportvector.h"
#include "qgsalgorithmpdalfilter.h"
#include "qgsalgorithmpdalfixprojection.h"
#include "qgsalgorithmpdalinformation.h"
#include "qgsalgorithmpdalmerge.h"
#include "qgsalgorithmpdalreproject.h"
Expand Down Expand Up @@ -90,6 +90,7 @@ void QgsPdalAlgorithms::loadAlgorithms()
{
const QgsScopedRuntimeProfile profile( QObject::tr( "QGIS PDAL provider" ) );

addAlgorithm( new QgsPdalAssignProjectionAlgorithm() );
addAlgorithm( new QgsPdalBoundaryAlgorithm() );
addAlgorithm( new QgsPdalBuildVpcAlgorithm() );
addAlgorithm( new QgsPdalClipAlgorithm() );
Expand All @@ -99,7 +100,6 @@ void QgsPdalAlgorithms::loadAlgorithms()
addAlgorithm( new QgsPdalExportRasterTinAlgorithm() );
addAlgorithm( new QgsPdalExportVectorAlgorithm() );
addAlgorithm( new QgsPdalFilterAlgorithm() );
addAlgorithm( new QgsPdalFixProjectionAlgorithm() );
addAlgorithm( new QgsPdalInformationAlgorithm() );
addAlgorithm( new QgsPdalMergeAlgorithm() );
addAlgorithm( new QgsPdalReprojectAlgorithm() );
Expand Down
6 changes: 3 additions & 3 deletions tests/src/analysis/testqgsprocessingpdalalgs.cpp
Expand Up @@ -34,6 +34,7 @@ class TestQgsProcessingPdalAlgs: public QObject
void init(); // will be called before each testfunction is executed.
void cleanup() {} // will be called after every testfunction.

void assignProjection();
void boundary();
void buildVpc();
void clip();
Expand All @@ -43,7 +44,6 @@ class TestQgsProcessingPdalAlgs: public QObject
void exportRasterTin();
void exportVector();
void filter();
void fixProjection();
void info();
void merge();
void reproject();
Expand Down Expand Up @@ -168,9 +168,9 @@ void TestQgsProcessingPdalAlgs::reproject()
);
}

void TestQgsProcessingPdalAlgs::fixProjection()
void TestQgsProcessingPdalAlgs::assignProjection()
{
QgsPdalAlgorithmBase *alg = const_cast<QgsPdalAlgorithmBase *>( static_cast< const QgsPdalAlgorithmBase * >( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:fixprojection" ) ) ) );
QgsPdalAlgorithmBase *alg = const_cast<QgsPdalAlgorithmBase *>( static_cast< const QgsPdalAlgorithmBase * >( QgsApplication::processingRegistry()->algorithmById( QStringLiteral( "pdal:assignprojection" ) ) ) );

std::unique_ptr< QgsProcessingContext > context = std::make_unique< QgsProcessingContext >();
context->setProject( QgsProject::instance() );
Expand Down

0 comments on commit 080ccdd

Please sign in to comment.