QGIS API Documentation 3.41.0-Master (af5edcb665c)
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:
34 enum class PointType
35 {
36 Source,
37 Destination,
38 };
39
48 QgsGcpPoint( const QgsPointXY &sourcePoint, const QgsPointXY &destinationPoint, const QgsCoordinateReferenceSystem &destinationPointCrs, bool enabled = true );
49
57 QgsPointXY sourcePoint() const { return mSourcePoint; }
58
66 void setSourcePoint( QgsPointXY point ) { mSourcePoint = point; }
67
73 QgsPointXY destinationPoint() const { return mDestinationPoint; }
74
80 void setDestinationPoint( QgsPointXY point ) { mDestinationPoint = point; }
81
87 QgsCoordinateReferenceSystem destinationPointCrs() const;
88
94 void setDestinationPointCrs( const QgsCoordinateReferenceSystem &crs );
95
99 QgsPointXY transformedDestinationPoint( const QgsCoordinateReferenceSystem &targetCrs, const QgsCoordinateTransformContext &context ) const;
100
106 bool isEnabled() const { return mEnabled; }
107
113 void setEnabled( bool enabled ) { mEnabled = enabled; }
114
115 // TODO c++20 - replace with = default
116 bool operator==( const QgsGcpPoint &other ) const
117 {
118 return mEnabled == other.mEnabled
119 && mSourcePoint == other.mSourcePoint
120 && mDestinationPoint == other.mDestinationPoint
121 && mDestinationCrs == other.mDestinationCrs;
122 }
123
124 bool operator!=( const QgsGcpPoint &other ) const
125 {
126 return !( *this == other );
127 }
128
129 private:
130 QgsPointXY mSourcePoint;
131 QgsPointXY mDestinationPoint;
132 QgsCoordinateReferenceSystem mDestinationCrs;
133 bool mEnabled = true;
134};
135
136#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:35
void setSourcePoint(QgsPointXY point)
Sets the source coordinates.
Definition qgsgcppoint.h:66
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:57
void setDestinationPoint(QgsPointXY point)
Sets the destination coordinates.
Definition qgsgcppoint.h:80
QgsPointXY destinationPoint() const
Returns the destination coordinates.
Definition qgsgcppoint.h:73
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