Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create class QgsGcpGeometryTransformer, which allows transformation
of geometry objects via a ground control points based transformation
- Loading branch information
1 parent
ce54321
commit fd7149a
Showing
5 changed files
with
213 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
python/analysis/auto_generated/georeferencing/qgsgcpgeometrytransformer.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/analysis/georeferencing/qgsgcpgeometrytransformer.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsGcpGeometryTransformer : QgsAbstractGeometryTransformer | ||
{ | ||
%Docstring | ||
A geometry transformer which uses an underlying Ground Control Points (GCP) based transformation to modify geometries. | ||
|
||
.. versionadded:: 3.18 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgsgcpgeometrytransformer.h" | ||
%End | ||
public: | ||
|
||
QgsGcpGeometryTransformer( QgsGcpTransformerInterface *gcpTransformer /Transfer/ ); | ||
%Docstring | ||
Constructor for QgsGcpGeometryTransformer, which uses the specified ``gcpTransformer`` to | ||
modify geometries. | ||
|
||
Ownership of ``gcpTransformer`` is transferred to the geometry transformer. | ||
%End | ||
|
||
QgsGcpGeometryTransformer( QgsGcpTransformerInterface::TransformMethod method, const QVector<QgsPointXY> &sourceCoordinates, const QVector<QgsPointXY> &destinationCoordinates ); | ||
%Docstring | ||
Constructor for QgsGcpGeometryTransformer, which uses the specified transform ``method`` and | ||
list of source and destination coordinates to transform geometries. | ||
%End | ||
|
||
~QgsGcpGeometryTransformer(); | ||
|
||
|
||
|
||
virtual bool transformPoint( double &x /In,Out/, double &y /In,Out/, double &z /In,Out/, double &m /In,Out/ ); | ||
|
||
%Docstring | ||
QgsGcpGeometryTransformer cannot be copied | ||
%End | ||
|
||
QgsGcpTransformerInterface *gcpTransformer() const; | ||
%Docstring | ||
Returns the underlying GCP transformer used to transform geometries. | ||
|
||
.. seealso:: :py:func:`setGcpTransformer` | ||
%End | ||
|
||
void setGcpTransformer( QgsGcpTransformerInterface *transformer /Transfer/ ); | ||
%Docstring | ||
Sets the underlying GCP ``transformer`` used to transform geometries. | ||
|
||
Ownership is transferred to this object. | ||
|
||
.. seealso:: :py:func:`gcpTransformer` | ||
%End | ||
|
||
private: | ||
QgsGcpGeometryTransformer( const QgsGcpGeometryTransformer &other ); | ||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/analysis/georeferencing/qgsgcpgeometrytransformer.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/*************************************************************************** | ||
qgsgcpgeometrytransformer.cpp | ||
---------------------- | ||
begin : February 2021 | ||
copyright : (C) 2021 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#include "qgsgcpgeometrytransformer.h" | ||
|
||
|
||
QgsGcpGeometryTransformer::QgsGcpGeometryTransformer( QgsGcpTransformerInterface *gcpTransformer ) | ||
: mGcpTransformer( gcpTransformer ) | ||
{ | ||
|
||
} | ||
|
||
QgsGcpGeometryTransformer::QgsGcpGeometryTransformer( QgsGcpTransformerInterface::TransformMethod method, const QVector<QgsPointXY> &sourceCoordinates, const QVector<QgsPointXY> &destinationCoordinates ) | ||
: mGcpTransformer( QgsGcpTransformerInterface::createFromParameters( method, sourceCoordinates, destinationCoordinates ) ) | ||
{ | ||
|
||
} | ||
|
||
QgsGcpGeometryTransformer::~QgsGcpGeometryTransformer() = default; | ||
|
||
bool QgsGcpGeometryTransformer::transformPoint( double &x, double &y, double &, double & ) | ||
{ | ||
return mGcpTransformer->transform( x, y ); | ||
} | ||
|
||
QgsGcpTransformerInterface *QgsGcpGeometryTransformer::gcpTransformer() const | ||
{ | ||
return mGcpTransformer.get(); | ||
} | ||
|
||
void QgsGcpGeometryTransformer::setGcpTransformer( QgsGcpTransformerInterface *gcpTransformer ) | ||
{ | ||
mGcpTransformer.reset( gcpTransformer ); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
/*************************************************************************** | ||
qgsgcpgeometrytransformer.h | ||
---------------------- | ||
begin : February 2021 | ||
copyright : (C) 2021 by Nyall Dawson | ||
email : nyall dot dawson at gmail dot com | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the GNU General Public License as published by * | ||
* the Free Software Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef QGSGCPGEOMETRYTRANSFORMER_H | ||
#define QGSGCPGEOMETRYTRANSFORMER_H | ||
|
||
#include "qgis_analysis.h" | ||
#include "qgsgeometrytransformer.h" | ||
#include "qgsgcptransformer.h" | ||
#include <memory> | ||
|
||
/** | ||
* \class QgsGcpGeometryTransformer | ||
* \ingroup analysis | ||
* A geometry transformer which uses an underlying Ground Control Points (GCP) based transformation to modify geometries. | ||
* | ||
* \since QGIS 3.18 | ||
*/ | ||
class ANALYSIS_EXPORT QgsGcpGeometryTransformer : public QgsAbstractGeometryTransformer | ||
{ | ||
public: | ||
|
||
/** | ||
* Constructor for QgsGcpGeometryTransformer, which uses the specified \a gcpTransformer to | ||
* modify geometries. | ||
* | ||
* Ownership of \a gcpTransformer is transferred to the geometry transformer. | ||
*/ | ||
QgsGcpGeometryTransformer( QgsGcpTransformerInterface *gcpTransformer SIP_TRANSFER ); | ||
|
||
/** | ||
* Constructor for QgsGcpGeometryTransformer, which uses the specified transform \a method and | ||
* list of source and destination coordinates to transform geometries. | ||
*/ | ||
QgsGcpGeometryTransformer( QgsGcpTransformerInterface::TransformMethod method, const QVector<QgsPointXY> &sourceCoordinates, const QVector<QgsPointXY> &destinationCoordinates ); | ||
|
||
~QgsGcpGeometryTransformer() override; | ||
|
||
//! QgsGcpGeometryTransformer cannot be copied | ||
QgsGcpGeometryTransformer( const QgsGcpGeometryTransformer &other ) = delete; | ||
|
||
//! QgsGcpGeometryTransformer cannot be copied | ||
QgsGcpGeometryTransformer &operator=( const QgsGcpGeometryTransformer &other ) = delete; | ||
|
||
bool transformPoint( double &x SIP_INOUT, double &y SIP_INOUT, double &z SIP_INOUT, double &m SIP_INOUT ) override; | ||
|
||
/** | ||
* Returns the underlying GCP transformer used to transform geometries. | ||
* | ||
* \see setGcpTransformer() | ||
*/ | ||
QgsGcpTransformerInterface *gcpTransformer() const; | ||
|
||
/** | ||
* Sets the underlying GCP \a transformer used to transform geometries. | ||
* | ||
* Ownership is transferred to this object. | ||
* | ||
* \see gcpTransformer() | ||
*/ | ||
void setGcpTransformer( QgsGcpTransformerInterface *transformer SIP_TRANSFER ); | ||
|
||
private: | ||
#ifdef SIP_RUN | ||
QgsGcpGeometryTransformer( const QgsGcpGeometryTransformer &other ); | ||
#endif | ||
|
||
std::unique_ptr< QgsGcpTransformerInterface > mGcpTransformer; | ||
|
||
}; | ||
|
||
#endif // QGSGCPGEOMETRYTRANSFORMER_H |