diff --git a/src/analysis/processing/pdal/qgsalgorithmpdalbuildvpc.cpp b/src/analysis/processing/pdal/qgsalgorithmpdalbuildvpc.cpp index e2986f5555f..88bfcd2f007 100644 --- a/src/analysis/processing/pdal/qgsalgorithmpdalbuildvpc.cpp +++ b/src/analysis/processing/pdal/qgsalgorithmpdalbuildvpc.cpp @@ -60,6 +60,9 @@ QgsPdalBuildVpcAlgorithm *QgsPdalBuildVpcAlgorithm::createInstance() const void QgsPdalBuildVpcAlgorithm::initAlgorithm( const QVariantMap & ) { addParameter( new QgsProcessingParameterMultipleLayers( QStringLiteral( "LAYERS" ), QObject::tr( "Input layers" ), QgsProcessing::TypePointCloud ) ); + addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "BOUNDARY" ), QObject::tr( "Calculate boundary polygons" ), false ) ); + addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "STATISTICS" ), QObject::tr( "Calculate statistics" ), false ) ); + addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "OVERVIEW" ), QObject::tr( "Build overview point cloud" ), false ) ); addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "Virtual point cloud file" ), QObject::tr( "VPC files (*.vpc *.VPC)" ) ) ); } @@ -77,11 +80,26 @@ QStringList QgsPdalBuildVpcAlgorithm::createArgumentLists( const QVariantMap &pa setOutputValue( QStringLiteral( "OUTPUT" ), outputFile ); QStringList args; - args.reserve( layers.count() + 2 ); + args.reserve( layers.count() + 5 ); args << QStringLiteral( "build_vpc" ) << QStringLiteral( "--output=%1" ).arg( outputFile ); + if ( parameterAsBool( parameters, QStringLiteral( "BOUNDARY" ), context ) ) + { + args << "--boundary"; + } + + if ( parameterAsBool( parameters, QStringLiteral( "STATISTICS" ), context ) ) + { + args << "--stats"; + } + + if ( parameterAsBool( parameters, QStringLiteral( "OVERVIEW" ), context ) ) + { + args << "--overview"; + } + addThreadsParameter( args ); for ( const QgsMapLayer *layer : std::as_const( layers ) ) diff --git a/tests/src/analysis/testqgsprocessingpdalalgs.cpp b/tests/src/analysis/testqgsprocessingpdalalgs.cpp index e5ae8472086..5d2dacfbfeb 100644 --- a/tests/src/analysis/testqgsprocessingpdalalgs.cpp +++ b/tests/src/analysis/testqgsprocessingpdalalgs.cpp @@ -154,7 +154,7 @@ void TestQgsProcessingPdalAlgs::reproject() QCOMPARE( args, QStringList() << QStringLiteral( "translate" ) << QStringLiteral( "--input=%1" ).arg( mPointCloudLayerPath ) << QStringLiteral( "--output=%1" ).arg( outputPointCloud ) - << QStringLiteral( "--transform-crs=%1" ).arg( QLatin1String( "EPSG:4326") ) + << QStringLiteral( "--transform-crs=%1" ).arg( QLatin1String( "EPSG:4326" ) ) ); // set max threads to 2, a --threads argument should be added @@ -163,7 +163,7 @@ void TestQgsProcessingPdalAlgs::reproject() QCOMPARE( args, QStringList() << QStringLiteral( "translate" ) << QStringLiteral( "--input=%1" ).arg( mPointCloudLayerPath ) << QStringLiteral( "--output=%1" ).arg( outputPointCloud ) - << QStringLiteral( "--transform-crs=%1" ).arg( QLatin1String( "EPSG:4326") ) + << QStringLiteral( "--transform-crs=%1" ).arg( QLatin1String( "EPSG:4326" ) ) << QStringLiteral( "--threads=2" ) ); } @@ -188,7 +188,7 @@ void TestQgsProcessingPdalAlgs::fixProjection() QCOMPARE( args, QStringList() << QStringLiteral( "translate" ) << QStringLiteral( "--input=%1" ).arg( mPointCloudLayerPath ) << QStringLiteral( "--output=%1" ).arg( outputPointCloud ) - << QStringLiteral( "--assign-crs=%1" ).arg( QLatin1String( "EPSG:4326") ) + << QStringLiteral( "--assign-crs=%1" ).arg( QLatin1String( "EPSG:4326" ) ) ); // set max threads to 2, a --threads argument should be added @@ -197,7 +197,7 @@ void TestQgsProcessingPdalAlgs::fixProjection() QCOMPARE( args, QStringList() << QStringLiteral( "translate" ) << QStringLiteral( "--input=%1" ).arg( mPointCloudLayerPath ) << QStringLiteral( "--output=%1" ).arg( outputPointCloud ) - << QStringLiteral( "--assign-crs=%1" ).arg( QLatin1String( "EPSG:4326") ) + << QStringLiteral( "--assign-crs=%1" ).arg( QLatin1String( "EPSG:4326" ) ) << QStringLiteral( "--threads=2" ) ); } @@ -749,11 +749,47 @@ void TestQgsProcessingPdalAlgs::buildVpc() << pointCloud2 ); + // calculate exact boundaries + parameters.insert( QStringLiteral( "BOUNDARY" ), true ); + args = alg->createArgumentLists( parameters, *context, &feedback ); + QCOMPARE( args, QStringList() << QStringLiteral( "build_vpc" ) + << QStringLiteral( "--output=%1" ).arg( outputFile ) + << QStringLiteral( "--boundary" ) + << pointCloud1 + << pointCloud2 + ); + + // calculate statistics + parameters.insert( QStringLiteral( "STATISTICS" ), true ); + args = alg->createArgumentLists( parameters, *context, &feedback ); + QCOMPARE( args, QStringList() << QStringLiteral( "build_vpc" ) + << QStringLiteral( "--output=%1" ).arg( outputFile ) + << QStringLiteral( "--boundary" ) + << QStringLiteral( "--stats" ) + << pointCloud1 + << pointCloud2 + ); + + // build overview + parameters.insert( QStringLiteral( "OVERVIEW" ), true ); + args = alg->createArgumentLists( parameters, *context, &feedback ); + QCOMPARE( args, QStringList() << QStringLiteral( "build_vpc" ) + << QStringLiteral( "--output=%1" ).arg( outputFile ) + << QStringLiteral( "--boundary" ) + << QStringLiteral( "--stats" ) + << QStringLiteral( "--overview" ) + << pointCloud1 + << pointCloud2 + ); + // set max threads to 2, a --threads argument should be added QgsSettings().setValue( QStringLiteral( "/Processing/Configuration/MAX_THREADS" ), 2 ); args = alg->createArgumentLists( parameters, *context, &feedback ); QCOMPARE( args, QStringList() << QStringLiteral( "build_vpc" ) << QStringLiteral( "--output=%1" ).arg( outputFile ) + << QStringLiteral( "--boundary" ) + << QStringLiteral( "--stats" ) + << QStringLiteral( "--overview" ) << QStringLiteral( "--threads=2" ) << pointCloud1 << pointCloud2