18#ifndef QGSPOINTCLOUDLAYEREXPORTER_H
19#define QGSPOINTCLOUDLAYEREXPORTER_H
28#include <pdal/PointView.hpp>
29#include <pdal/PointTable.hpp>
30#include <pdal/Options.hpp>
68 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; }
201 bool setFormat(
const ExportFormat format );
212 void setPointsLimit( qint64 limit ) { mPointsLimit = std::max< qint64 >( limit, 0 ); }
230 void prepareExport();
255 void setLastError( QString error ) { mLastError = error; }
257 const QgsPointCloudAttributeCollection mLayerAttributeCollection;
259 QgsPointCloudIndex mIndex = QgsPointCloudIndex(
nullptr );
260 QString mName = QObject::tr(
"Exported" );
261 ExportFormat mFormat = ExportFormat::Memory;
264 QgsRectangle mExtent = QgsRectangle( -std::numeric_limits<double>::infinity(),
265 -std::numeric_limits<double>::infinity(),
266 std::numeric_limits<double>::infinity(),
267 std::numeric_limits<double>::infinity(),
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;
292 virtual void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber ) = 0;
293 virtual void handleNode() = 0;
294 virtual void handleAll() = 0;
295 QgsPointCloudLayerExporter *mParent =
nullptr;
298 class ExporterMemory :
public ExporterBase
301 ExporterMemory( QgsPointCloudLayerExporter *exp );
302 ~ExporterMemory()
override;
305 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
306 void handleNode()
override;
307 void handleAll()
override;
311 class ExporterVector :
public ExporterBase
314 ExporterVector( QgsPointCloudLayerExporter *exp );
315 ~ExporterVector()
override;
318 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
319 void handleNode()
override;
320 void handleAll()
override;
325 class ExporterPdal :
public ExporterBase
328 ExporterPdal( QgsPointCloudLayerExporter *exp );
331 void handlePoint(
double x,
double y,
double z,
const QVariantMap &map,
const qint64 pointNumber )
override;
332 void handleNode()
override;
333 void handleAll()
override;
334 const int mPointFormat;
335 pdal::Options mOptions;
336 pdal::PointTable mTable;
337 pdal::PointViewPtr mView;
378 void finished(
bool result )
override;
383 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