Marble

MarbleAbstractPresenter.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2006-2008 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2014 Adam Dabrowski <adamdbrw@gmail.com>
6//
7
8#ifndef MARBLEABSTRACTPRESENTER_H
9#define MARBLEABSTRACTPRESENTER_H
10
11#include <QList>
12
13#include "GeoDataLatLonBox.h"
14#include "MarblePhysics.h"
15#include <marble_export.h>
16
17namespace Marble
18{
19
20class GeoDataPlacemark;
21class GeoDataLookAt;
22class MarbleMap;
23class MarbleModel;
24class ViewportParams;
25
26class MARBLE_EXPORT MarbleAbstractPresenter : public QObject
27{
28 Q_OBJECT
29
30Q_SIGNALS:
31 void zoomChanged(int zoom);
32 void distanceChanged(const QString &distanceString);
33
34 /**
35 * This signal is emit when a new rectangle region is selected over the map.
36 *
37 * @param boundingBox The geographical coordinates of the selected region
38 */
39 void regionSelected(const GeoDataLatLonBox &boundingBox);
40
41public:
42 explicit MarbleAbstractPresenter(MarbleMap *map, QObject *parent = nullptr);
43 ~MarbleAbstractPresenter() override;
44
45 qreal moveStep() const;
46 int radius() const;
47
48 GeoDataLookAt lookAt() const;
49
50 QString distanceString() const;
51
52 /**
53 * @brief Approximated altitude of the camera in km
54 */
55 qreal distance() const;
56
57 /**
58 * @brief An approximate distance from @p radius
59 * @param radius radius of planet disc in screen pixels
60 */
61 qreal distanceFromRadius(qreal radius) const;
62
63 /**
64 * @brief The radius of the rendered planet disc derived from the approximate apparent @p distance
65 */
66 qreal radiusFromDistance(qreal distance) const;
67
68 /**
69 * @brief Rotate the globe in the given direction in discrete steps
70 * @param stepsRight Number of steps to go right. Negative values go left.
71 * @param stepsDown Number of steps to go down. Negative values go up.
72 * @param mode Interpolation mode to use when traveling to the target
73 */
74 void moveByStep(int stepsRight, int stepsDown, FlyToMode mode = Automatic);
75
76 int polarity() const;
77 int zoom() const;
78 int minimumZoom() const;
79 int maximumZoom() const;
80
81 qreal distanceFromZoom(qreal zoom) const;
82 qreal zoomFromDistance(qreal distance) const;
83
84 void zoomAt(const QPoint &pos, qreal newDistance);
85 void moveTo(const QPoint &pos, qreal factor);
86
87 qreal centerLongitude() const;
88 qreal centerLatitude() const;
89
90 ViewContext viewContext() const;
91
92 qreal zoom(qreal radius) const;
93 qreal radius(qreal zoom) const;
94
95 MarbleMap *map();
96 MarbleModel *model();
97
98 const MarbleMap *map() const;
99 const MarbleModel *model() const;
100
101 int logzoom() const;
102 void setLogzoom(int value);
103
104 int zoomStep() const;
105 qreal viewAngle() const;
106
107 bool animationsEnabled() const;
108
109 ViewportParams *viewport();
110 const ViewportParams *viewport() const;
111
112public Q_SLOTS:
113 void rotateBy(const qreal deltaLon, const qreal deltaLat, FlyToMode mode = Instant);
114 void flyTo(const GeoDataLookAt &newLookAt, FlyToMode mode = Automatic);
115 void goHome(FlyToMode mode = Automatic);
116
117 void setZoom(int newZoom, FlyToMode mode = Instant);
118 void zoomView(int zoom, FlyToMode mode = Instant);
119 void zoomViewBy(int zoomStep, FlyToMode mode = Instant);
120 void zoomIn(FlyToMode mode = Automatic);
121 void zoomOut(FlyToMode mode = Automatic);
122 void zoomAtBy(const QPoint &pos, int zoomStep);
123
124 void setViewContext(ViewContext viewContext);
125
126 void centerOn(const qreal lon, const qreal lat, bool animated = false);
127 void centerOn(const GeoDataCoordinates &point, bool animated = false);
128 void centerOn(const GeoDataLatLonBox &box, bool animated = false);
129 void centerOn(const GeoDataPlacemark &placemark, bool animated = false);
130 void headingOn(qreal heading);
131 void setCenterLatitude(qreal lat, FlyToMode mode);
132 void setCenterLongitude(qreal lon, FlyToMode mode);
133
134 void setAnimationsEnabled(bool enabled);
135 void setRadius(int radius);
136 void setDistance(qreal newDistance);
137 void setSelection(const QRect &region);
138
139private:
140 MarbleMap *const m_map;
141 MarblePhysics m_physics;
142
143 bool m_animationsEnabled;
144 int m_logzoom;
145 int m_zoomStep;
146 const qreal m_viewAngle;
147};
148}
149
150#endif // MARBLEABSTRACTPRESENTER_H
QAction * zoomIn(const QObject *recvr, const char *slot, QObject *parent)
QAction * zoomOut(const QObject *recvr, const char *slot, QObject *parent)
QAction * zoom(const QObject *recvr, const char *slot, QObject *parent)
Binds a QML item to a specific geodetic location in screen coordinates.
KOSM_EXPORT double distance(const std::vector< const OSM::Node * > &path, Coordinate coord)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:52:13 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.