QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
elevation
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.h
"
21
#include "qgis_core.h"
22
#include "
qgis_sip.h
"
23
#include "
qgsabstractprofilegenerator.h
"
24
#include "
qgsprofilerequest.h
"
25
#include "
qgstaskmanager.h
"
26
27
class
QgsAbstractProfileSource
;
28
class
QgsAbstractProfileGenerator
;
29
36
class
CORE_EXPORT
QgsProfileExporter
37
{
38
public
:
45
QgsProfileExporter
(
const
QList< QgsAbstractProfileSource * > &sources,
const
QgsProfileRequest
&request,
Qgis::ProfileExportType
type );
46
47
QgsProfileExporter
(
const
QgsProfileExporter
&other ) =
delete
;
48
QgsProfileExporter
&
operator=
(
const
QgsProfileExporter
&other ) =
delete
;
49
50
~QgsProfileExporter
();
51
58
void
run
(
QgsFeedback
*feedback =
nullptr
);
59
68
QList< QgsVectorLayer * >
toLayers
()
SIP_FACTORY
;
69
70
private:
71
#ifdef SIP_RUN
72
QgsProfileExporter
(
const
QgsProfileExporter
&other );
73
#endif
74
75
Qgis::ProfileExportType
mType =
Qgis::ProfileExportType::Features3D
;
76
QgsProfileRequest
mRequest;
77
std::vector< std::unique_ptr< QgsAbstractProfileGenerator > > mGenerators;
78
QVector< QgsAbstractProfileResults::Feature > mFeatures;
79
};
80
87
class
CORE_EXPORT
QgsProfileExporterTask
:
public
QgsTask
88
{
89
Q_OBJECT
90
91
public
:
95
enum class
ExportResult
96
{
97
Success,
98
Empty,
99
DeviceError,
100
DxfExportFailed,
101
LayerExportFailed,
102
Canceled,
103
};
104
Q_ENUM
(
ExportResult
);
105
112
QgsProfileExporterTask
(
113
const
QList< QgsAbstractProfileSource * > &sources,
const
QgsProfileRequest
&request,
Qgis::ProfileExportType
type,
const
QString &destination,
const
QgsCoordinateTransformContext
&transformContext
114
);
115
116
bool
run
()
override
;
117
void
cancel
()
override
;
118
127
QList< QgsVectorLayer * >
takeLayers
()
SIP_FACTORY
;
128
134
QgsProfileExporterTask
::
ExportResult
result
() const;
135
139
QStringList
createdFiles
()
const
{
return
mCreatedFiles; }
140
144
QString
error
()
const
{
return
mError; }
145
146
private
:
147
std::unique_ptr< QgsProfileExporter > mExporter;
148
QList< QgsVectorLayer * > mLayers;
149
150
std::unique_ptr< QgsFeedback > mFeedback;
151
QString mDestination;
152
QgsCoordinateTransformContext
mTransformContext;
153
ExportResult mResult = ExportResult::Success;
154
QString mError;
155
QStringList mCreatedFiles;
156
};
157
158
159
#endif
// QGSPROFILEEXPORTER_H
Qgis::ProfileExportType
ProfileExportType
Types of export for elevation profiles.
Definition
qgis.h:4702
Qgis::ProfileExportType::Features3D
@ Features3D
Export profiles as 3D features, with elevation values stored in exported geometry Z values.
Definition
qgis.h:4703
QgsAbstractProfileGenerator
Abstract base class for objects which generate elevation profiles.
Definition
qgsabstractprofilegenerator.h:404
QgsAbstractProfileSource
Interface for classes which can generate elevation profiles.
Definition
qgsabstractprofilesource.h:35
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsProfileExporterTask::ExportResult
ExportResult
Results of exporting the profile.
Definition
qgsprofileexporter.h:96
QgsProfileExporterTask::QgsProfileExporterTask
QgsProfileExporterTask(const QList< QgsAbstractProfileSource * > &sources, const QgsProfileRequest &request, Qgis::ProfileExportType type, const QString &destination, const QgsCoordinateTransformContext &transformContext)
Constructor for QgsProfileExporterTask, saving results to the specified destination file.
Definition
qgsprofileexporter.cpp:140
QgsProfileExporterTask::run
bool run() override
Performs the task's operation.
Definition
qgsprofileexporter.cpp:150
QgsProfileExporterTask::result
QgsProfileExporterTask::ExportResult result() const
Returns the result of the export operation.
Definition
qgsprofileexporter.cpp:306
QgsProfileExporterTask::Q_ENUM
Q_ENUM(ExportResult)
QgsProfileExporterTask::cancel
void cancel() override
Notifies the task that it should terminate.
Definition
qgsprofileexporter.cpp:285
QgsProfileExporterTask::error
QString error() const
Returns a descriptive error message, if available.
Definition
qgsprofileexporter.h:144
QgsProfileExporterTask::createdFiles
QStringList createdFiles() const
Returns a list of layer files created during the export.
Definition
qgsprofileexporter.h:139
QgsProfileExporterTask::takeLayers
QList< QgsVectorLayer * > takeLayers()
Returns a list of vector layer containing the exported profile results.
Definition
qgsprofileexporter.cpp:293
QgsProfileExporter::~QgsProfileExporter
~QgsProfileExporter()
QgsProfileExporter::run
void run(QgsFeedback *feedback=nullptr)
Runs the profile generation.
Definition
qgsprofileexporter.cpp:51
QgsProfileExporter::QgsProfileExporter
QgsProfileExporter(const QList< QgsAbstractProfileSource * > &sources, const QgsProfileRequest &request, Qgis::ProfileExportType type)
Constructor for QgsProfileExporter, using the provided list of profile sources to generate the result...
Definition
qgsprofileexporter.cpp:35
QgsProfileExporter::operator=
QgsProfileExporter & operator=(const QgsProfileExporter &other)=delete
QgsProfileExporter::toLayers
QList< QgsVectorLayer * > toLayers()
Returns a list of vector layer containing the exported profile results.
Definition
qgsprofileexporter.cpp:63
QgsProfileExporter::QgsProfileExporter
QgsProfileExporter(const QgsProfileExporter &other)=delete
QgsProfileRequest
Encapsulates properties and constraints relating to fetching elevation profiles from different source...
Definition
qgsprofilerequest.h:38
QgsTask::QgsTask
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.
Definition
qgstaskmanager.cpp:36
qgis.h
qgis_sip.h
SIP_FACTORY
#define SIP_FACTORY
Definition
qgis_sip.h:83
qgsabstractprofilegenerator.h
qgsprofilerequest.h
qgstaskmanager.h
Generated on
for QGIS API Documentation by
1.17.0