QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
georeferencing
qgsvectorwarper.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsvectorwarper.h
3
--------------------------------------
4
Date : February 2022
5
Copyright : (C) 2022 by Nyall Dawson
6
Email : nyall dot dawson at gmail dot com
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
16
#ifndef QGSVECTORWARPER_H
17
#define QGSVECTORWARPER_H
18
19
#include "qgis_analysis.h"
20
#include "
qgis_sip.h
"
21
#include "
qgsfeatureiterator.h
"
22
#include "
qgsgcppoint.h
"
23
#include "
qgsgcptransformer.h
"
24
#include "
qgstaskmanager.h
"
25
#include "
qgsvectorlayerfeatureiterator.h
"
26
27
class
QgsFeatureSink
;
28
35
class
ANALYSIS_EXPORT
QgsVectorWarper
36
{
37
public
:
45
explicit
QgsVectorWarper
(
QgsGcpTransformerInterface::TransformMethod
method,
const
QList<QgsGcpPoint> &points,
const
QgsCoordinateReferenceSystem
&destinationCrs );
46
54
bool
transformFeatures
(
QgsFeatureIterator
&iterator,
QgsFeatureSink
*sink,
const
QgsCoordinateTransformContext
&context,
QgsFeedback
*feedback =
nullptr
)
const
;
55
59
QString
error
()
const
{
return
mError; }
60
61
private
:
62
QgsGcpTransformerInterface::TransformMethod
mMethod =
QgsGcpTransformerInterface::TransformMethod::Linear
;
63
QList<QgsGcpPoint> mPoints;
64
QgsCoordinateReferenceSystem
mDestinationCrs;
65
66
mutable
QString mError;
67
};
68
69
76
class
ANALYSIS_EXPORT
QgsVectorWarperTask
:
public
QgsTask
77
{
78
Q_OBJECT
79
80
public
:
90
QgsVectorWarperTask
(
91
QgsGcpTransformerInterface::TransformMethod
method,
const
QList<QgsGcpPoint> &points,
const
QgsCoordinateReferenceSystem
&destinationCrs,
QgsVectorLayer
*layer,
const
QString &fileName
92
);
93
94
void
cancel
()
override
;
95
97
enum class
Result
98
{
99
Success,
100
Canceled,
101
Error,
102
};
103
107
Result
result
()
const
{
return
mResult; }
108
112
QString
errorMessage
()
const
{
return
mErrorMessage; }
113
114
protected
:
115
bool
run()
override
;
116
117
private
:
118
QgsGcpTransformerInterface::TransformMethod
mMethod =
QgsGcpTransformerInterface::TransformMethod::Linear
;
119
long
long
mFeatureCount = 0;
120
std::unique_ptr<QgsVectorLayerFeatureSource> mSource;
121
QList<QgsGcpPoint> mPoints;
122
QgsCoordinateReferenceSystem
mDestinationCrs;
123
124
QString mDestFileName;
125
126
std::unique_ptr<QgsFeedback> mFeedback;
127
128
QgsCoordinateTransformContext
mTransformContext;
129
QgsFields
mFields;
130
Qgis::WkbType
mWkbType =
Qgis::WkbType::Unknown
;
131
132
Result mResult = Result::Success;
133
QString mErrorMessage;
134
double
mLastProgress = 0;
135
};
136
137
138
#endif
//QGSVECTORWARPER_H
Qgis::WkbType
WkbType
The WKB type describes the number of dimensions a geometry has.
Definition
qgis.h:314
Qgis::WkbType::Unknown
@ Unknown
Unknown.
Definition
qgis.h:315
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition
qgscoordinatetransformcontext.h:61
QgsFeatureIterator
Wrapper for iterator of features from vector data provider or vector layer.
Definition
qgsfeatureiterator.h:284
QgsFeatureSink
An interface for objects which accept features via addFeature(s) methods.
Definition
qgsfeaturesink.h:33
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsFields
Container of fields for a vector layer.
Definition
qgsfields.h:45
QgsGcpTransformerInterface::TransformMethod
TransformMethod
Available transformation methods.
Definition
qgsgcptransformer.h:45
QgsGcpTransformerInterface::TransformMethod::Linear
@ Linear
Linear transform.
Definition
qgsgcptransformer.h:46
QgsTask::QgsTask
QgsTask(const QString &description=QString(), QgsTask::Flags flags=AllFlags)
Constructor for QgsTask.
Definition
qgstaskmanager.cpp:36
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
QgsVectorWarperTask::errorMessage
QString errorMessage() const
Returns the descriptive error message, if an error occurred.
Definition
qgsvectorwarper.h:112
QgsVectorWarperTask::result
Result result() const
Returns the result of running the task.
Definition
qgsvectorwarper.h:107
QgsVectorWarperTask::Result
Result
Task results.
Definition
qgsvectorwarper.h:98
QgsVectorWarperTask::cancel
void cancel() override
Notifies the task that it should terminate.
Definition
qgsvectorwarper.cpp:116
QgsVectorWarperTask::QgsVectorWarperTask
QgsVectorWarperTask(QgsGcpTransformerInterface::TransformMethod method, const QList< QgsGcpPoint > &points, const QgsCoordinateReferenceSystem &destinationCrs, QgsVectorLayer *layer, const QString &fileName)
Constructor for QgsVectorWarperTask.
Definition
qgsvectorwarper.cpp:97
QgsVectorWarper::error
QString error() const
Returns the last error obtained during transformation.
Definition
qgsvectorwarper.h:59
QgsVectorWarper::transformFeatures
bool transformFeatures(QgsFeatureIterator &iterator, QgsFeatureSink *sink, const QgsCoordinateTransformContext &context, QgsFeedback *feedback=nullptr) const
Transforms the features from iterator and adds the results to the specified sink.
Definition
qgsvectorwarper.cpp:37
QgsVectorWarper::QgsVectorWarper
QgsVectorWarper(QgsGcpTransformerInterface::TransformMethod method, const QList< QgsGcpPoint > &points, const QgsCoordinateReferenceSystem &destinationCrs)
Constructor for QgsVectorWarper.
Definition
qgsvectorwarper.cpp:31
qgis_sip.h
qgsfeatureiterator.h
qgsgcppoint.h
qgsgcptransformer.h
qgstaskmanager.h
qgsvectorlayerfeatureiterator.h
Generated on
for QGIS API Documentation by
1.17.0