QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
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
52 QgsProfileExporter( const QgsProfileExporter &other ) = delete;
53
56
58
65 void run( QgsFeedback *feedback = nullptr );
66
75 QList< QgsVectorLayer * > toLayers() SIP_FACTORY;
76
77 private:
78
79#ifdef SIP_RUN
81#endif
82
84 QgsProfileRequest mRequest;
85 std::vector< std::unique_ptr< QgsAbstractProfileGenerator > > mGenerators;
86 QVector< QgsAbstractProfileResults::Feature > mFeatures;
87
88};
89
96class CORE_EXPORT QgsProfileExporterTask : public QgsTask
97{
98 Q_OBJECT
99
100 public:
101
105 enum class ExportResult
106 {
107 Success,
108 Empty,
109 DeviceError,
110 DxfExportFailed,
111 LayerExportFailed,
112 Canceled,
113 };
115
122 QgsProfileExporterTask( const QList< QgsAbstractProfileSource * > &sources,
123 const QgsProfileRequest &request,
125 const QString &destination,
126 const QgsCoordinateTransformContext &transformContext );
127
128 bool run() override;
129 void cancel() override;
130
139 QList< QgsVectorLayer * > takeLayers() SIP_FACTORY;
140
146 QgsProfileExporterTask::ExportResult result() const;
147
151 QStringList createdFiles() const { return mCreatedFiles; }
152
156 QString error() const { return mError; }
157
158 private:
159
160 std::unique_ptr< QgsProfileExporter > mExporter;
161 QList< QgsVectorLayer * > mLayers;
162
163 std::unique_ptr< QgsFeedback > mFeedback;
164 QString mDestination;
165 QgsCoordinateTransformContext mTransformContext;
166 ExportResult mResult = ExportResult::Success;
167 QString mError;
168 QStringList mCreatedFiles;
169};
170
171
172#endif // QGSPROFILEEXPORTER_H
ProfileExportType
Types of export for elevation profiles.
Definition qgis.h:2863
@ 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:45
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 cannot be copied.
QgsProfileExporter(const QgsProfileExporter &other)=delete
QgsProfileExporter cannot be copied.
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