QGIS API Documentation 3.41.0-Master (3440c17df1d)
Loading...
Searching...
No Matches
qgsgcppoint.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsgcppoint.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 QGSGCPPOINT_H
17#define QGSGCPPOINT_H
18
19#include "qgis_analysis.h"
21
23
30class ANALYSIS_EXPORT QgsGcpPoint
31{
32 public:
33
35 enum class PointType
36 {
37 Source,
38 Destination,
39 };
40
49 QgsGcpPoint( const QgsPointXY &sourcePoint, const QgsPointXY &destinationPoint,
50 const QgsCoordinateReferenceSystem &destinationPointCrs, bool enabled = true );
51
59 QgsPointXY sourcePoint() const { return mSourcePoint; }
60
68 void setSourcePoint( QgsPointXY point ) { mSourcePoint = point; }
69
75 QgsPointXY destinationPoint() const { return mDestinationPoint; }
76
82 void setDestinationPoint( QgsPointXY point ) { mDestinationPoint = point; }
83
89 QgsCoordinateReferenceSystem destinationPointCrs() const;
90
96 void setDestinationPointCrs( const QgsCoordinateReferenceSystem &crs );
97
101 QgsPointXY transformedDestinationPoint( const QgsCoordinateReferenceSystem &targetCrs, const QgsCoordinateTransformContext &context ) const;
102
108 bool isEnabled() const { return mEnabled; }
109
115 void setEnabled( bool enabled ) { mEnabled = enabled; }
116
117 // TODO c++20 - replace with = default
118 bool operator==( const QgsGcpPoint &other ) const
119 {
120 return mEnabled == other.mEnabled
121 && mSourcePoint == other.mSourcePoint
122 && mDestinationPoint == other.mDestinationPoint
123 && mDestinationCrs == other.mDestinationCrs;
124 }
125
126 bool operator!=( const QgsGcpPoint &other ) const
127 {
128 return !( *this == other );
129 }
130
131 private:
132
133 QgsPointXY mSourcePoint;
134 QgsPointXY mDestinationPoint;
135 QgsCoordinateReferenceSystem mDestinationCrs;
136 bool mEnabled = true;
137
138};
139
140#endif //QGSGCPPOINT_H
This class represents a coordinate reference system (CRS).
Contains information about the context in which a coordinate transform is executed.
Contains properties of a ground control point (GCP).
Definition qgsgcppoint.h:31
PointType
Coordinate point types.
Definition qgsgcppoint.h:36
void setSourcePoint(QgsPointXY point)
Sets the source coordinates.
Definition qgsgcppoint.h:68
void setEnabled(bool enabled)
Sets whether the point is currently enabled.
bool operator==(const QgsGcpPoint &other) const
bool operator!=(const QgsGcpPoint &other) const
QgsPointXY sourcePoint() const
Returns the source coordinates.
Definition qgsgcppoint.h:59
void setDestinationPoint(QgsPointXY point)
Sets the destination coordinates.
Definition qgsgcppoint.h:82
QgsPointXY destinationPoint() const
Returns the destination coordinates.
Definition qgsgcppoint.h:75
bool isEnabled() const
Returns true if the point is currently enabled.
A class to represent a 2D point.
Definition qgspointxy.h:60
const QgsCoordinateReferenceSystem & crs