Marble

MarbleGlobal.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2007-2009 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 //
6 
7 #ifndef MARBLE_GLOBAL_H
8 #define MARBLE_GLOBAL_H
9 
10 
11 #include <cmath>
12 
13 #include <QString>
14 
15 #include "marble_export.h"
16 #include "marble_version.h"
17 
18 // #define QT_STRICT_ITERATORS
19 
20 /* M_PI is a #define that may or may not be handled in <cmath> */
21 #ifndef M_PI
22 #define M_PI 3.14159265358979323846264338327950288419717
23 #endif
24 
25 namespace Marble
26 {
27 
28 enum TessellationFlag {
29  NoTessellation = 0x0,
30  Tessellate = 0x1,
31  RespectLatitudeCircle = 0x2,
32  FollowGround = 0x4,
33  PreventNodeFiltering = 0x8
34 };
35 
36 Q_DECLARE_FLAGS(TessellationFlags, TessellationFlag)
37 
38 /**
39  * @brief This enum is used to choose the projection shown in the view.
40  */
41 enum Projection {
42  Spherical, ///< Spherical projection ("Orthographic")
43  Equirectangular, ///< Flat projection ("plate carree")
44  Mercator, ///< Mercator projection
45  Gnomonic, ///< Gnomonic projection
46  Stereographic, ///< Stereographic projection
47  LambertAzimuthal, ///< Lambert Azimuthal Equal-Area projection
48  AzimuthalEquidistant, ///< Azimuthal Equidistant projection
49  VerticalPerspective ///< Vertical perspective projection
50  // NOTE: MarbleWidget::setProjection(int) relies on VerticalPerspective being the last
51  // value above. Adjust that method if you do changes here
52 };
53 
54 /**
55  * @brief This enum is used to choose the unit chosen to measure angles.
56  */
57 enum AngleUnit {
58  DMSDegree, ///< Degrees in DMS notation
59  DecimalDegree, ///< Degrees in decimal notation
60  UTM ///< UTM
61 };
62 
63 /**
64  * @brief This enum is used to choose context in which map quality gets used.
65  */
67  Still, ///< still image
68  Animation ///< animated view (e.g. while rotating the globe)
69 };
70 
71 /**
72  * @brief This enum is used to choose the map quality shown in the view.
73  */
74 enum MapQuality {
75  OutlineQuality, ///< Only a wire representation is drawn
76  LowQuality, ///< Low resolution (e.g. interlaced)
77  NormalQuality, ///< Normal quality
78  HighQuality, ///< High quality (e.g. antialiasing for lines)
79  PrintQuality ///< Print quality
80 };
81 
82 /**
83  * @brief This enum is used to specify the proxy that is used.
84  */
85 enum ProxyType {
86  HttpProxy, ///< Uses an Http proxy
87  Socks5Proxy ///< Uses a Socks5Proxy
88 };
89 
90 /**
91  * @brief This enum is used to choose the localization of the labels.
92  */
94  NoLabel = 0x0,
95  LineStart = 0x1,
96  LineCenter = 0x2,
97  LineEnd = 0x4,
98  IgnoreXMargin = 0x8,
99  IgnoreYMargin = 0x10,
100  FollowLine = 0x20
101 };
102 
103 Q_DECLARE_FLAGS(LabelPositionFlags, LabelPositionFlag)
104 
105 /**
106  * @brief This enum is used to choose the localization of the labels.
107  */
109  CustomAndNative, ///< Custom and native labels
110  Custom, ///< Shows the name in the user's language
111  Native ///< Display the name in the official language and
112  /// glyphs of the labeled place.
113 };
114 
115 /**
116  * @brief This enum is used to choose how the globe behaves while dragging.
117  */
119  KeepAxisVertically, ///< Keep planet axis vertically
120  FollowMousePointer ///< Follow mouse pointer exactly
121 };
122 
123 /**
124  * @brief This enum is used to choose how the globe behaves while dragging.
125  */
126 enum OnStartup {
127  ShowHomeLocation, ///< Show home location on startup
128  LastLocationVisited ///< Show last location visited on quit
129 };
130 
132  ClampToGround, ///< Altitude always sticks to ground level
133  RelativeToGround, ///< Altitude is always given relative to ground level
134  Absolute, ///< Altitude is given relative to the sealevel
135  RelativeToSeaFloor, ///< Altitude is given relative to the sea floor
136  ClampToSeaFloor ///< Altitude always sticks to sea floor
137 };
138 
139 enum Pole {
140  AnyPole, ///< Any pole
141  NorthPole, ///< Only North Pole
142  SouthPole ///< Only South Pole
143 };
144 
145 /**
146  * @brief This enum is used to describe the type of download
147  */
149  DownloadBulk, ///< Bulk download, for example "File/Download region"
150  DownloadBrowse ///< Browsing mode, normal operation of Marble, like a web browser
151 };
152 
153 /**
154  * @brief Describes possible flight mode (interpolation between source
155  * and target camera positions)
156  */
157 enum FlyToMode {
158  Automatic, ///< A sane value is chosen automatically depending on animation settings and the action
159  Instant, ///< Change camera position immediately (no interpolation)
160  Linear, ///< Linear interpolation of lon, lat and distance to ground
161  Jump ///< Linear interpolation of lon and lat, distance increases towards the middle point, then decreases
162 };
163 
164 /**
165  * @brief Search mode: Global (worldwide) versus area (local, regional) search
166  */
168  GlobalSearch, ///< Search a whole planet
169  AreaSearch ///< Search a certain region of a planet (e.g. visible region)
170 };
171 
172 /**
173  * @brief
174  */
176  Complete, ///< All data is there and up to date
177  WaitingForUpdate, ///< Rendering is based on complete, but outdated data, data update was requested
178  WaitingForData, ///< Rendering is based on no or partial data, more data was requested (e.g. pending network queries)
179  Incomplete ///< Data is missing and some error occurred when trying to retrieve it (e.g. network failure)
180 };
181 
182 const int defaultLevelZeroColumns = 2;
183 const int defaultLevelZeroRows = 1;
184 
185 // Conversion Metric / Imperial System: km vs. miles
186 const qreal MI2KM = 1.609344;
187 const qreal KM2MI = 1.0 / MI2KM;
188 
189 // Conversion Nautical / Imperial System: nm vs. km
190 const qreal NM2KM = 1.852;
191 const qreal KM2NM = 1.0 / NM2KM;
192 const qreal NM2FT = 6080; // nm feet
193 
194 // Conversion Metric / Imperial System: meter vs. feet
195 const qreal M2FT = 3.2808;
196 const qreal FT2M = 1.0 / M2FT;
197 
198 // Conversion Metric / Imperial System: meter vs inch
199 const qreal M2IN = 39.3701;
200 const qreal IN2M = 1.0 / M2IN;
201 
202 // Interconversion between Imperial System: feet vs inch
203 const qreal FT2IN = 12.0;
204 
205 // Conversion Metric / Imperial System: meter vs yard
206 const qreal M2YD = 1.09361;
207 const qreal YD2M = 1.0 / M2YD;
208 
209 // Conversion meter vs millimeter
210 const qreal M2MM = 1000.0;
211 const qreal MM2M = 1.0 / M2MM;
212 
213 // Conversion meter vs centimeter
214 const qreal M2CM = 100.0;
215 const qreal CM2M = 1.0 / M2CM;
216 
217 // Conversion degree vs. radians
218 const qreal DEG2RAD = M_PI / 180.0;
219 const qreal RAD2DEG = 180.0 / M_PI;
220 
221 // Conversion meter vs kilometer
222 const qreal KM2METER = 1000.0;
223 const qreal METER2KM = 1.0 / KM2METER;
224 
225 //Conversion hour vs minute
226 const qreal HOUR2MIN = 60.0;
227 const qreal MIN2HOUR = 1.0 / HOUR2MIN;
228 
229 //Conversion (time) minute vs second
230 const qreal MIN2SEC = 60.0;
231 const qreal SEC2MIN = 1.0 / MIN2SEC;
232 
233 //Conversion hour vs second
234 const qreal HOUR2SEC = 3600.0;
235 const qreal SEC2HOUR = 1.0 / HOUR2SEC;
236 
237 const qreal TWOPI = 2 * M_PI;
238 
239 // Version definitions to use with an external application (as digiKam)
240 
241 // String for about dialog and http user agent
242 const QString MARBLE_VERSION_STRING = QString::fromLatin1( MARBLE_LIB_VERSION_STRING );
243 
244 // API Version id:
245 // up until the 21.04 release, this was supposed to be 0xMMmmpp (major,minor,patch), but in reality it was stuck at version 0.27.0
246 // now it is ((major<<16)|(minor<<8)|(patch))
247 #define MARBLE_VERSION MARBLE_LIB_VERSION
248 
249 static const char NOT_AVAILABLE[] = QT_TRANSLATE_NOOP("Marble", "not available");
250 
251 const int tileDigits = 6;
252 
253 // Average earth radius in m
254 // Deprecated: Please use model()->planetRadius() instead.
255 const qreal EARTH_RADIUS = 6378137.0;
256 
257 // Maximum level of base tiles
258 const int maxBaseTileLevel = 4;
259 
260 // Default size (width and height) of tiles
261 const unsigned int c_defaultTileSize = 675;
262 
263 class MarbleGlobalPrivate;
264 class MarbleLocale;
265 
266 class MARBLE_EXPORT MarbleGlobal
267 {
268  public:
269  static MarbleGlobal * getInstance();
270  ~MarbleGlobal();
271 
272  MarbleLocale * locale() const;
273 
274  enum Profile {
275  Default = 0x0,
276  SmallScreen = 0x1,
277  HighResolution = 0x2
278  };
279 
280  Q_DECLARE_FLAGS( Profiles, Profile )
281 
282  Profiles profiles() const;
283  void setProfiles( Profiles profiles );
284 
285  /** @deprecated Profiles are detected automatically now. This only returns profiles() anymore */
286  MARBLE_DEPRECATED static Profiles detectProfiles();
287 
288  private:
289  MarbleGlobal();
290 
291  Q_DISABLE_COPY( MarbleGlobal )
292  MarbleGlobalPrivate * const d;
293 };
294 
295 }
296 
297 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::TessellationFlags )
298 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::LabelPositionFlags )
299 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::MarbleGlobal::Profiles )
300 
301 #endif
@ DecimalDegree
Degrees in decimal notation.
Definition: MarbleGlobal.h:59
ViewContext
This enum is used to choose context in which map quality gets used.
Definition: MarbleGlobal.h:66
@ RelativeToSeaFloor
Altitude is given relative to the sea floor.
Definition: MarbleGlobal.h:135
@ AreaSearch
Search a certain region of a planet (e.g. visible region)
Definition: MarbleGlobal.h:169
@ DownloadBrowse
Browsing mode, normal operation of Marble, like a web browser.
Definition: MarbleGlobal.h:150
@ AnyPole
Any pole.
Definition: MarbleGlobal.h:140
@ VerticalPerspective
Vertical perspective projection.
Definition: MarbleGlobal.h:49
@ AzimuthalEquidistant
Azimuthal Equidistant projection.
Definition: MarbleGlobal.h:48
@ GlobalSearch
Search a whole planet.
Definition: MarbleGlobal.h:168
@ LowQuality
Low resolution (e.g. interlaced)
Definition: MarbleGlobal.h:76
DownloadUsage
This enum is used to describe the type of download.
Definition: MarbleGlobal.h:148
@ Animation
animated view (e.g. while rotating the globe)
Definition: MarbleGlobal.h:68
@ Socks5Proxy
Uses a Socks5Proxy.
Definition: MarbleGlobal.h:87
SearchMode
Search mode: Global (worldwide) versus area (local, regional) search.
Definition: MarbleGlobal.h:167
LabelLocalization
This enum is used to choose the localization of the labels.
Definition: MarbleGlobal.h:108
@ SouthPole
Only South Pole.
Definition: MarbleGlobal.h:142
@ UTM
UTM.
Definition: MarbleGlobal.h:60
@ Still
still image
Definition: MarbleGlobal.h:67
@ KeepAxisVertically
Keep planet axis vertically.
Definition: MarbleGlobal.h:119
@ LastLocationVisited
Show last location visited on quit.
Definition: MarbleGlobal.h:128
@ HttpProxy
Uses an Http proxy.
Definition: MarbleGlobal.h:86
@ Stereographic
Stereographic projection.
Definition: MarbleGlobal.h:46
@ Jump
Linear interpolation of lon and lat, distance increases towards the middle point, then decreases
Definition: MarbleGlobal.h:161
OnStartup
This enum is used to choose how the globe behaves while dragging.
Definition: MarbleGlobal.h:126
@ Spherical
Spherical projection ("Orthographic")
Definition: MarbleGlobal.h:42
MapQuality
This enum is used to choose the map quality shown in the view.
Definition: MarbleGlobal.h:74
@ LambertAzimuthal
Lambert Azimuthal Equal-Area projection.
Definition: MarbleGlobal.h:47
@ ClampToSeaFloor
Altitude always sticks to sea floor.
Definition: MarbleGlobal.h:136
Binds a QML item to a specific geodetic location in screen coordinates.
@ DMSDegree
Degrees in DMS notation.
Definition: MarbleGlobal.h:58
DragLocation
This enum is used to choose how the globe behaves while dragging.
Definition: MarbleGlobal.h:118
@ Incomplete
Data is missing and some error occurred when trying to retrieve it (e.g. network failure)
Definition: MarbleGlobal.h:179
FlyToMode
Describes possible flight mode (interpolation between source and target camera positions)
Definition: MarbleGlobal.h:157
@ WaitingForUpdate
Rendering is based on complete, but outdated data, data update was requested.
Definition: MarbleGlobal.h:177
@ Automatic
A sane value is chosen automatically depending on animation settings and the action.
Definition: MarbleGlobal.h:158
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:41
@ Complete
All data is there and up to date.
Definition: MarbleGlobal.h:176
AngleUnit
This enum is used to choose the unit chosen to measure angles.
Definition: MarbleGlobal.h:57
@ Native
Display the name in the official language and glyphs of the labeled place.
Definition: MarbleGlobal.h:111
LabelPositionFlag
This enum is used to choose the localization of the labels.
Definition: MarbleGlobal.h:93
@ Instant
Change camera position immediately (no interpolation)
Definition: MarbleGlobal.h:159
@ Absolute
Altitude is given relative to the sealevel.
Definition: MarbleGlobal.h:134
@ CustomAndNative
Custom and native labels.
Definition: MarbleGlobal.h:109
@ HighQuality
High quality (e.g. antialiasing for lines)
Definition: MarbleGlobal.h:78
@ NormalQuality
Normal quality.
Definition: MarbleGlobal.h:77
@ NorthPole
Only North Pole.
Definition: MarbleGlobal.h:141
@ Linear
Linear interpolation of lon, lat and distance to ground.
Definition: MarbleGlobal.h:160
QString fromLatin1(const char *str, int size)
@ ClampToGround
Altitude always sticks to ground level.
Definition: MarbleGlobal.h:132
@ WaitingForData
Rendering is based on no or partial data, more data was requested (e.g. pending network queries)
Definition: MarbleGlobal.h:178
@ Custom
Shows the name in the user's language.
Definition: MarbleGlobal.h:110
@ ShowHomeLocation
Show home location on startup.
Definition: MarbleGlobal.h:127
@ RelativeToGround
Altitude is always given relative to ground level.
Definition: MarbleGlobal.h:133
@ FollowMousePointer
Follow mouse pointer exactly.
Definition: MarbleGlobal.h:120
@ DownloadBulk
Bulk download, for example "File/Download region".
Definition: MarbleGlobal.h:149
@ Mercator
Mercator projection.
Definition: MarbleGlobal.h:44
@ PrintQuality
Print quality.
Definition: MarbleGlobal.h:79
@ OutlineQuality
Only a wire representation is drawn.
Definition: MarbleGlobal.h:75
@ Gnomonic
Gnomonic projection.
Definition: MarbleGlobal.h:45
ProxyType
This enum is used to specify the proxy that is used.
Definition: MarbleGlobal.h:85
@ Equirectangular
Flat projection ("plate carree")
Definition: MarbleGlobal.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Dec 9 2022 03:54:52 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.