QGIS API Documentation 3.39.0-Master (3aed037ce22)
Loading...
Searching...
No Matches
qgsprofileexporter.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprofileexporter.h
3 ---------------
4 begin : May 2023
5 copyright : (C) 2023 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17#ifndef QGSPROFILEEXPORTER_H
18#define QGSPROFILEEXPORTER_H
19
20#include "qgis_core.h"
21#include "qgis_sip.h"
22#include "qgis.h"
24#include "qgsprofilerequest.h"
25#include "qgstaskmanager.h"
26
29
36class CORE_EXPORT QgsProfileExporter
37{
38
39 public:
40
47 QgsProfileExporter( const QList< QgsAbstractProfileSource * > &sources,
48 const QgsProfileRequest &request,
50
51 QgsProfileExporter( const QgsProfileExporter &other ) = delete;
53
55
62 void run( QgsFeedback *feedback = nullptr );
63
72 QList< QgsVectorLayer * > toLayers() SIP_FACTORY;
73
74 private:
75
76#ifdef SIP_RUN
78#endif
79
81 QgsProfileRequest mRequest;
82 std::vector< std::unique_ptr< QgsAbstractProfileGenerator > > mGenerators;
83 QVector< QgsAbstractProfileResults::Feature > mFeatures;
84
85};
86
93class CORE_EXPORT QgsProfileExporterTask : public QgsTask
94{
95 Q_OBJECT
96
97 public:
98
102 enum class ExportResult
103 {
104 Success,
105 Empty,
106 DeviceError,
107 DxfExportFailed,
108 LayerExportFailed,
109 Canceled,
110 };
112
119 QgsProfileExporterTask( const QList< QgsAbstractProfileSource * > &sources,
120 const QgsProfileRequest &request,
122 const QString &destination,
123 const QgsCoordinateTransformContext &transformContext );
124
125 bool run() override;
126 void cancel() override;
127
136 QList< QgsVectorLayer * > takeLayers() SIP_FACTORY;
137
143 QgsProfileExporterTask::ExportResult result() const;
144
148 QStringList createdFiles() const { return mCreatedFiles; }
149
153 QString error() const { return mError; }
154
155 private:
156
157 std::unique_ptr< QgsProfileExporter > mExporter;
158 QList< QgsVectorLayer * > mLayers;
159
160 std::unique_ptr< QgsFeedback > mFeedback;
161 QString mDestination;
162 QgsCoordinateTransformContext mTransformContext;
163 ExportResult mResult = ExportResult::Success;
164 QString mError;
165 QStringList mCreatedFiles;
166};
167
168
169#endif // QGSPROFILEEXPORTER_H
ProfileExportType
Types of export for elevation profiles.
Definition qgis.h:3746
@ Features3D
Export profiles as 3D features, with elevation values stored in exported geometry Z values.
Abstract base class for objects which generate elevation profiles.
Interface for classes which can generate elevation profiles.
Contains information about the context in which a coordinate transform is executed.
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition qgsfeedback.h:44
Handles exports of elevation profiles in various formats in a background task.
ExportResult
Results of exporting the profile.
Q_ENUM(ExportResult)
QString error() const
Returns a descriptive error message, if available.
Handles exports of elevation profiles in various formats.
QgsProfileExporter & operator=(const QgsProfileExporter &other)=delete
QgsProfileExporter(const QgsProfileExporter &other)=delete
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Abstract base class for long running background tasks.
#define SIP_FACTORY
Definition qgis_sip.h:76