QGIS API Documentation  3.26.3-Buenos Aires (65e4edfdad)
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 
30 class 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
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:57
QgsGcpPoint
Contains properties of a ground control point (GCP).
Definition: qgsgcppoint.h:30
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsGcpPoint::operator==
bool operator==(const QgsGcpPoint &other) const
Definition: qgsgcppoint.h:118
QgsGcpPoint::setSourcePoint
void setSourcePoint(QgsPointXY point)
Sets the source coordinates.
Definition: qgsgcppoint.h:68
QgsGcpPoint::PointType
PointType
Coordinate point types.
Definition: qgsgcppoint.h:35
QgsGcpPoint::isEnabled
bool isEnabled() const
Returns true if the point is currently enabled.
Definition: qgsgcppoint.h:108
QgsGcpPoint::destinationPoint
QgsPointXY destinationPoint() const
Returns the destination coordinates.
Definition: qgsgcppoint.h:75
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:211
QgsGcpPoint::operator!=
bool operator!=(const QgsGcpPoint &other) const
Definition: qgsgcppoint.h:126
QgsPointXY
A class to represent a 2D point.
Definition: qgspointxy.h:58
QgsGcpPoint::sourcePoint
QgsPointXY sourcePoint() const
Returns the source coordinates.
Definition: qgsgcppoint.h:59
QgsGcpPoint::setDestinationPoint
void setDestinationPoint(QgsPointXY point)
Sets the destination coordinates.
Definition: qgsgcppoint.h:82
QgsGcpPoint::setEnabled
void setEnabled(bool enabled)
Sets whether the point is currently enabled.
Definition: qgsgcppoint.h:115
qgscoordinatereferencesystem.h