QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
qgsquickcoordinatetransformer.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsquickcoordinatetransformer.h
3  --------------------------------------
4  Date : 1.6.2017
5  Copyright : (C) 2017 by Matthias Kuhn
6  Email : matthias (at) opengis.ch
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 QGSQUICKCOORDINATETRANSFORMER_H
17 #define QGSQUICKCOORDINATETRANSFORMER_H
18 
19 #include <QObject>
20 
21 #include "qgspoint.h"
22 
23 #include "qgis_quick.h"
26 #include "qgspoint.h"
27 
39 class QUICK_EXPORT QgsQuickCoordinateTransformer : public QObject
40 {
41  Q_OBJECT
42 
44  Q_PROPERTY( QgsPoint projectedPosition READ projectedPosition NOTIFY projectedPositionChanged )
45 
46 
47  Q_PROPERTY( QgsPoint sourcePosition READ sourcePosition WRITE setSourcePosition NOTIFY sourcePositionChanged )
48 
49 
50  Q_PROPERTY( QgsCoordinateReferenceSystem destinationCrs READ destinationCrs WRITE setDestinationCrs NOTIFY destinationCrsChanged )
51 
52 
53  Q_PROPERTY( QgsCoordinateReferenceSystem sourceCrs READ sourceCrs WRITE setSourceCrs NOTIFY sourceCrsChanged )
54 
55 
56  Q_PROPERTY( QgsCoordinateTransformContext transformContext READ transformContext WRITE setTransformContext NOTIFY transformContextChanged )
57 
58  public:
60  explicit QgsQuickCoordinateTransformer( QObject *parent = nullptr );
61 
63  QgsPoint projectedPosition() const;
64 
66  QgsPoint sourcePosition() const;
67 
69  void setSourcePosition( const QgsPoint &sourcePosition );
70 
72  QgsCoordinateReferenceSystem destinationCrs() const;
73 
75  void setDestinationCrs( const QgsCoordinateReferenceSystem &destinationCrs );
76 
78  QgsCoordinateReferenceSystem sourceCrs() const;
79 
81  void setSourceCrs( const QgsCoordinateReferenceSystem &sourceCrs );
82 
84  void setTransformContext( const QgsCoordinateTransformContext &context );
85 
87  QgsCoordinateTransformContext transformContext() const;
88 
89  signals:
92 
95 
98 
101 
104 
105  private:
106  void updatePosition();
107 
108  QgsPoint mProjectedPosition;
109  QgsPoint mSourcePosition;
110  QgsCoordinateTransform mCoordinateTransform;
111 };
112 
113 #endif // QGSQUICKCOORDINATETRANSFORMER_H
QgsQuickCoordinateTransformer::projectedPositionChanged
void projectedPositionChanged()
Projected (destination) position (in destination CRS)
QgsCoordinateTransformContext
Contains information about the context in which a coordinate transform is executed.
Definition: qgscoordinatetransformcontext.h:58
QgsPoint
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:38
qgscoordinatetransformcontext.h
QgsQuickCoordinateTransformer::destinationCrsChanged
void destinationCrsChanged()
Destination CRS.
QgsQuickCoordinateTransformer::sourcePositionChanged
void sourcePositionChanged()
Source position (in source CRS)
qgspoint.h
QgsCoordinateReferenceSystem
This class represents a coordinate reference system (CRS).
Definition: qgscoordinatereferencesystem.h:206
QgsQuickCoordinateTransformer
Helper class for transform of coordinates (QgsPoint) to a different coordinate reference system.
Definition: qgsquickcoordinatetransformer.h:40
QgsQuickCoordinateTransformer::transformContextChanged
void transformContextChanged()
Transformation context, can be set from QgsQuickMapSettings::transformContext()
QgsQuickCoordinateTransformer::sourceCrsChanged
void sourceCrsChanged()
Source CRS, default 4326.
QgsCoordinateTransform
Class for doing transforms between two map coordinate systems.
Definition: qgscoordinatetransform.h:53
qgscoordinatereferencesystem.h