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;
69 formats << ExportFormat::Memory
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();
247 QString lastError()
const {
return mLastError; }
255 void setLastError( QString error ) { mLastError = error; }
260 QString mName = QObject::tr(
"Exported" );
261 ExportFormat mFormat = ExportFormat::Memory;
265 -std::numeric_limits<double>::infinity(),
266 std::numeric_limits<double>::infinity(),
267 std::numeric_limits<double>::infinity(),
269 std::unique_ptr< QgsGeos > mFilterGeometryEngine;
272 qint64 mPointsLimit = 0;
273 QStringList mRequestedAttributes;
277 int mPointRecordFormat;
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;
298 class ExporterMemory :
public ExporterBase
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
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
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;
364 void cancel()
override;
376 void finished(
bool result )
override;
381 std::unique_ptr< QgsFeedback > mOwnedFeedback;
Abstract base class for all geometries.
This class 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.
Collection of point cloud attributes.
Represents a indexed point clouds data in octree.
QgsTask task which performs a QgsPointCloudLayerExporter layer export operation as a background task.
void exportComplete()
Emitted when exporting the layer is successfully completed.
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.
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.
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.
Abstract base class for long running background tasks.
ActionOnExistingFile
Enumeration to describe how to handle existing files.
@ CreateOrOverwriteFile
Create or overwrite file.
#define SIP_NODEFAULTCTORS
QList< QgsFeature > QgsFeatureList
const QgsCoordinateReferenceSystem & crs