QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
qgsquickmaptoscreen.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsquickmaptoscreen.h
3 ----------------------------------------------------
4 Date : 22.08.2018
5 Copyright : (C) 2018 by Denis Rouzaud
6 Email : denis (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 QGSQUICKMAPTOSCREEN_H
17#define QGSQUICKMAPTOSCREEN_H
18
19#include "qgsquickmapsettings.h"
20
21#include <QObject>
22#include <QPointF>
23#include <qgspoint.h>
24
34class QUICK_EXPORT QgsQuickMapToScreen : public QObject
35{
36 Q_OBJECT
37
39 Q_PROPERTY( QgsQuickMapSettings *mapSettings READ mapSettings WRITE setMapSettings NOTIFY mapSettingsChanged )
40
41
42 Q_PROPERTY( QgsPoint mapPoint READ mapPoint WRITE setMapPoint NOTIFY mapPointChanged )
44 Q_PROPERTY( QPointF screenPoint READ screenPoint NOTIFY screenPointChanged )
45
46
47 Q_PROPERTY( double mapDistance READ mapDistance WRITE setMapDistance NOTIFY mapDistanceChanged )
49 Q_PROPERTY( double screenDistance READ screenDistance NOTIFY screenDistanceChanged )
50
51 public:
52
54 explicit QgsQuickMapToScreen( QObject *parent = nullptr );
55
57 void setMapSettings( QgsQuickMapSettings *mapSettings );
59 QgsQuickMapSettings *mapSettings() const;
60
62 void setMapPoint( const QgsPoint &point );
64 QgsPoint mapPoint() const;
65
67 void setMapDistance( const double distance );
69 double mapDistance() const;
70
72 QPointF screenPoint() const;
73
75 double screenDistance() const;
76
77 signals:
78
89
90 private slots:
91 void transformPoint();
92 void transformDistance();
93
94 private:
95 QgsQuickMapSettings *mMapSettings = nullptr;
96 QgsPoint mMapPoint = QgsPoint();
97 double mMapDistance = 0.0;
98 QPointF mScreenPoint = QPointF();
99 double mScreenDistance = 0.0;
100};
101
102#endif // QGSQUICKMAPTOSCREEN_H
Point geometry type, with support for z-dimension and m-values.
Definition: qgspoint.h:49
The QgsQuickMapSettings class encapsulates QgsMapSettings class to offer settings of configuration of...
The QgsQuickMapToScreen class transform map points to screen coordinates as well as distances from ma...
void mapPointChanged()
Point in map coordinates.
void mapDistanceChanged()
Distance in map unit.
void mapSettingsChanged()
Map settings used to define the map canvas CRS and detect any extent change.
void screenPointChanged()
Point in screen coordinates (read-only)
void screenDistanceChanged()
Distance in screen coordinates (read-only)