QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
georeferencing
qgsgcpgeometrytransformer.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsgcpgeometrytransformer.cpp
3
----------------------
4
begin : February 2021
5
copyright : (C) 2021 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
18
#include "
qgsgcpgeometrytransformer.h
"
19
20
#include "
qgsgeometry.h
"
21
22
QgsGcpGeometryTransformer::QgsGcpGeometryTransformer
(
QgsGcpTransformerInterface
*
gcpTransformer
)
23
: mGcpTransformer(
gcpTransformer
)
24
{}
25
26
QgsGcpGeometryTransformer::QgsGcpGeometryTransformer
(
QgsGcpTransformerInterface::TransformMethod
method,
const
QVector<QgsPointXY> &sourceCoordinates,
const
QVector<QgsPointXY> &destinationCoordinates )
27
: mGcpTransformer(
QgsGcpTransformerInterface
::createFromParameters( method, sourceCoordinates, destinationCoordinates ) )
28
{}
29
30
QgsGcpGeometryTransformer::~QgsGcpGeometryTransformer
() =
default
;
31
32
bool
QgsGcpGeometryTransformer::transformPoint
(
double
&x,
double
&y,
double
&,
double
& )
33
{
34
if
( !mGcpTransformer )
35
return
false
;
36
37
return
mGcpTransformer->transform( x, y );
38
}
39
40
QgsGeometry
QgsGcpGeometryTransformer::transform
(
const
QgsGeometry
&geometry,
bool
&ok,
QgsFeedback
*feedback )
41
{
42
ok =
false
;
43
if
( geometry.
isNull
() )
44
{
45
ok =
true
;
46
return
QgsGeometry
();
47
}
48
49
std::unique_ptr<QgsAbstractGeometry> res( geometry.
constGet
()->
clone
() );
50
51
ok = res->transform(
this
, feedback );
52
53
return
QgsGeometry
( std::move( res ) );
54
}
55
56
QgsGcpTransformerInterface
*
QgsGcpGeometryTransformer::gcpTransformer
()
const
57
{
58
return
mGcpTransformer.get();
59
}
60
61
void
QgsGcpGeometryTransformer::setGcpTransformer
(
QgsGcpTransformerInterface
*
gcpTransformer
)
62
{
63
mGcpTransformer.reset(
gcpTransformer
);
64
}
QgsAbstractGeometry::clone
virtual QgsAbstractGeometry * clone() const =0
Clones the geometry by performing a deep copy.
QgsFeedback
Base class for feedback objects to be used for cancellation of something running in a worker thread.
Definition
qgsfeedback.h:44
QgsGcpGeometryTransformer::setGcpTransformer
void setGcpTransformer(QgsGcpTransformerInterface *transformer)
Sets the underlying GCP transformer used to transform geometries.
Definition
qgsgcpgeometrytransformer.cpp:61
QgsGcpGeometryTransformer::transform
QgsGeometry transform(const QgsGeometry &geometry, bool &ok, QgsFeedback *feedback=nullptr)
Transforms the specified input geometry using the GCP based transform.
Definition
qgsgcpgeometrytransformer.cpp:40
QgsGcpGeometryTransformer::~QgsGcpGeometryTransformer
~QgsGcpGeometryTransformer() override
QgsGcpGeometryTransformer::QgsGcpGeometryTransformer
QgsGcpGeometryTransformer(QgsGcpTransformerInterface *gcpTransformer)
Constructor for QgsGcpGeometryTransformer, which uses the specified gcpTransformer to modify geometri...
Definition
qgsgcpgeometrytransformer.cpp:22
QgsGcpGeometryTransformer::transformPoint
bool transformPoint(double &x, double &y, double &z, double &m) override
Transforms the point defined by the coordinates (x, y, z) and the specified m value.
Definition
qgsgcpgeometrytransformer.cpp:32
QgsGcpGeometryTransformer::gcpTransformer
QgsGcpTransformerInterface * gcpTransformer() const
Returns the underlying GCP transformer used to transform geometries.
Definition
qgsgcpgeometrytransformer.cpp:56
QgsGcpTransformerInterface
An interface for Ground Control Points (GCP) based transformations.
Definition
qgsgcptransformer.h:37
QgsGcpTransformerInterface::TransformMethod
TransformMethod
Available transformation methods.
Definition
qgsgcptransformer.h:45
QgsGeometry
A geometry is the spatial representation of a feature.
Definition
qgsgeometry.h:267
QgsGeometry::constGet
const QgsAbstractGeometry * constGet() const
Returns a non-modifiable (const) reference to the underlying abstract geometry primitive.
Definition
qgsgeometry.cpp:144
QgsGeometry::isNull
bool isNull
Definition
qgsgeometry.h:269
qgsgcpgeometrytransformer.h
qgsgeometry.h
Generated on
for QGIS API Documentation by
1.17.0