18#ifndef QGSPOINTCLOUDLAYEREXPORTER_H
19#define QGSPOINTCLOUDLAYEREXPORTER_H
28#include <pdal/PointView.hpp>
29#include <pdal/PointTable.hpp>
30#include <pdal/Options.hpp>
67 QList< ExportFormat > formats;
84 static QString getOgrDriverName( ExportFormat format )
SIP_SKIP;
98 void setFileName(
const QString &filename ) { mFilename = filename; }
137 void setFilterGeometry(
QgsMapLayer *layer,
bool selectedFeaturesOnly =
false );
167 void setAttributes(
const QStringList &attributes );
178 void setAllAttributes();
183 QStringList
attributes()
const {
return mRequestedAttributes; }
192 mTransformContext = context;
205 bool setFormat(
const ExportFormat format );
216 void setPointsLimit( qint64 limit ) { mPointsLimit = std::max< qint64 >( limit, 0 ); }
234 void prepareExport();
258 void setLastError( QString error ) { mLastError = error; }
260 const QgsPointCloudAttributeCollection mLayerAttributeCollection;
262 QgsPointCloudIndex mIndex = QgsPointCloudIndex(
nullptr );
263 QString mName = QObject::tr(
"Exported" );
264 ExportFormat mFormat = ExportFormat::Memory;
268 = QgsRectangle( -std::numeric_limits<double>::infinity(), -std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity(), std::numeric_limits<double>::infinity(),
false );
269 std::unique_ptr< QgsGeos > mFilterGeometryEngine;
270 QgsDoubleRange mZRange;
271 QgsFeedback *mFeedback =
nullptr;
272 qint64 mPointsLimit = 0;
273 QStringList mRequestedAttributes;
274 QgsCoordinateReferenceSystem mSourceCrs;
275 QgsCoordinateReferenceSystem mTargetCrs;
276 QgsCoordinateTransformContext mTransformContext;
277 int mPointRecordFormat;
280 QgsMapLayer *mMemoryLayer =
nullptr;
281 QgsFeatureSink *mVectorSink =
nullptr;
282 QgsCoordinateTransform *mTransform =
nullptr;
288 ExporterBase() =
default;
289 virtual ~ExporterBase() =
default;
293 virtual void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber ) = 0;
294 virtual void handleNode() = 0;
295 virtual void handleAll() = 0;
296 QgsPointCloudLayerExporter *mParent =
nullptr;
299 class ExporterMemory :
public ExporterBase
302 ExporterMemory( QgsPointCloudLayerExporter *exp );
303 ~ExporterMemory()
override;
306 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
307 void handleNode()
override;
308 void handleAll()
override;
312 class ExporterVector :
public ExporterBase
315 ExporterVector( QgsPointCloudLayerExporter *exp );
316 ~ExporterVector()
override;
319 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
320 void handleNode()
override;
321 void handleAll()
override;
326 class ExporterPdal :
public ExporterBase
329 ExporterPdal( QgsPointCloudLayerExporter *exp );
332 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
333 void handleNode()
override;
334 void handleAll()
override;
335 const int mPointFormat;
336 pdal::Options mOptions;
337 pdal::PointTable mTable;
338 pdal::PointViewPtr mView;
375 void finished(
bool result )
override;
380 std::unique_ptr< QgsFeedback > mOwnedFeedback;
Abstract base class for all geometries.
Represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
QgsRange which stores a range of double values.
An interface for objects which accept features via addFeature(s) methods.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Container of fields for a vector layer.
Does vector analysis using the GEOS library and handles import, export, and exception handling.
Base class for all map layer types.
A collection of point cloud attributes.
void cancel() override
Notifies the task that it should terminate.
QgsPointCloudLayerExporterTask(QgsPointCloudLayerExporter *exporter)
Constructor for QgsPointCloudLayerExporterTask.
void exportComplete()
Emitted when exporting the layer is successfully completed.
void finished(bool result) override
If the task is managed by a QgsTaskManager, this will be called after the task has finished (whether ...
bool run() override
Performs the task's operation.
Handles exporting point cloud layers to memory layers, OGR supported files and PDAL supported files.
void setFeedback(QgsFeedback *feedback)
Sets a QgsFeedback object to allow cancellation / progress reporting.
QgsCoordinateReferenceSystem crs() const
Gets the crs for the exported file.
ExportFormat format() const
Returns the format for the exported file or layer.
void setCrs(const QgsCoordinateReferenceSystem &crs, const QgsCoordinateTransformContext &context=QgsCoordinateTransformContext())
Sets the crs for the exported file, and the transform context that will be used for reprojection if d...
QgsRectangle filterExtent() const
Gets the filter extent for points to be exported.
QString layerName() const
Gets the name for the new layer.
void setFilterExtent(const QgsRectangle extent)
Sets a filter extent for points to be exported in the target CRS Points that fall outside the extent ...
QgsDoubleRange zRange() const
Gets the inclusive range for Z values to be exported.
void setFileName(const QString &filename)
Sets the filename for the new layer.
void setActionOnExistingFile(const QgsVectorFileWriter::ActionOnExistingFile action)
Sets whether an existing output vector file should be overwritten on appended to.
ExportFormat
Supported export formats for point clouds.
@ Csv
Comma separated values.
@ Las
LAS/LAZ point cloud.
QString lastError() const
Gets the last error that occurred during the exporting operation.
void setLayerName(const QString &name)
Sets the name for the new layer.
QString fileName() const
Gets the filename for the new layer.
void setZRange(const QgsDoubleRange zRange)
Sets an inclusive range for Z values to be exported.
void setPointsLimit(qint64 limit)
Sets the maximum number of points to be exported.
QStringList attributes() const
Gets the list of point cloud attributes that will be exported.
qint64 pointsLimit()
Gets the maximum number of points to be exported.
QgsPointCloudLayerExporter(QgsPointCloudLayer *layer)
Constructor for QgsPointCloudLayerExporter, associated with the specified layer.
void setNoAttributes()
Sets that no attributes will be exported.
static QList< ExportFormat > supportedFormats()
Gets a list of the supported export formats.
QgsFeedback * feedback() const
Gets a pointer to the QgsFeedback object used for cancellation / progress reporting,...
Represents a map layer supporting display of point clouds.
A rectangle specified with double values.
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.
ActionOnExistingFile
Enumeration to describe how to handle existing files.
@ CreateOrOverwriteFile
Create or overwrite file.
#define SIP_NODEFAULTCTORS
QList< QgsFeature > QgsFeatureList