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 enum TileType {
146  TextureTileType, ///< Tiles that consist of bitmap data
147  VectorTileType ///< Tiles that consist of vector data
148 };
149 
150 /**
151  * @brief This enum is used to describe the type of download
152  */
154  DownloadBulk, ///< Bulk download, for example "File/Download region"
155  DownloadBrowse ///< Browsing mode, normal operation of Marble, like a web browser
156 };
157 
158 /**
159  * @brief Describes possible flight mode (interpolation between source
160  * and target camera positions)
161  */
162 enum FlyToMode {
163  Automatic, ///< A sane value is chosen automatically depending on animation settings and the action
164  Instant, ///< Change camera position immediately (no interpolation)
165  Linear, ///< Linear interpolation of lon, lat and distance to ground
166  Jump ///< Linear interpolation of lon and lat, distance increases towards the middle point, then decreases
167 };
168 
169 /**
170  * @brief Search mode: Global (worldwide) versus area (local, regional) search
171  */
173  GlobalSearch, ///< Search a whole planet
174  AreaSearch ///< Search a certain region of a planet (e.g. visible region)
175 };
176 
177 /**
178  * @brief
179  */
181  Complete, ///< All data is there and up to date
182  WaitingForUpdate, ///< Rendering is based on complete, but outdated data, data update was requested
183  WaitingForData, ///< Rendering is based on no or partial data, more data was requested (e.g. pending network queries)
184  Incomplete ///< Data is missing and some error occurred when trying to retrieve it (e.g. network failure)
185 };
186 
187 const int defaultLevelZeroColumns = 2;
188 const int defaultLevelZeroRows = 1;
189 
190 // Conversion Metric / Imperial System: km vs. miles
191 const qreal MI2KM = 1.609344;
192 const qreal KM2MI = 1.0 / MI2KM;
193 
194 // Conversion Nautical / Imperial System: nm vs. km
195 const qreal NM2KM = 1.852;
196 const qreal KM2NM = 1.0 / NM2KM;
197 const qreal NM2FT = 6080; // nm feet
198 
199 // Conversion Metric / Imperial System: meter vs. feet
200 const qreal M2FT = 3.2808;
201 const qreal FT2M = 1.0 / M2FT;
202 
203 // Conversion Metric / Imperial System: meter vs inch
204 const qreal M2IN = 39.3701;
205 const qreal IN2M = 1.0 / M2IN;
206 
207 // Interconversion between Imperial System: feet vs inch
208 const qreal FT2IN = 12.0;
209 
210 // Conversion Metric / Imperial System: meter vs yard
211 const qreal M2YD = 1.09361;
212 const qreal YD2M = 1.0 / M2YD;
213 
214 // Conversion meter vs millimeter
215 const qreal M2MM = 1000.0;
216 const qreal MM2M = 1.0 / M2MM;
217 
218 // Conversion meter vs centimeter
219 const qreal M2CM = 100.0;
220 const qreal CM2M = 1.0 / M2CM;
221 
222 // Conversion degree vs. radians
223 const qreal DEG2RAD = M_PI / 180.0;
224 const qreal RAD2DEG = 180.0 / M_PI;
225 
226 // Conversion meter vs kilometer
227 const qreal KM2METER = 1000.0;
228 const qreal METER2KM = 1.0 / KM2METER;
229 
230 //Conversion hour vs minute
231 const qreal HOUR2MIN = 60.0;
232 const qreal MIN2HOUR = 1.0 / HOUR2MIN;
233 
234 //Conversion (time) minute vs second
235 const qreal MIN2SEC = 60.0;
236 const qreal SEC2MIN = 1.0 / MIN2SEC;
237 
238 //Conversion hour vs second
239 const qreal HOUR2SEC = 3600.0;
240 const qreal SEC2HOUR = 1.0 / HOUR2SEC;
241 
242 const qreal TWOPI = 2 * M_PI;
243 
244 // Version definitions to use with an external application (as digiKam)
245 
246 // String for about dialog and http user agent
247 const QString MARBLE_VERSION_STRING = QString::fromLatin1( MARBLE_LIB_VERSION_STRING );
248 
249 // API Version id:
250 // 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
251 // now it is ((major<<16)|(minor<<8)|(patch))
252 #define MARBLE_VERSION MARBLE_LIB_VERSION
253 
254 static const char NOT_AVAILABLE[] = QT_TRANSLATE_NOOP("Marble", "not available");
255 
256 const int tileDigits = 6;
257 
258 // Average earth radius in m
259 // Deprecated: Please use model()->planetRadius() instead.
260 const qreal EARTH_RADIUS = 6378137.0;
261 
262 // Maximum level of base tiles
263 const int maxBaseTileLevel = 4;
264 
265 // Default size (width and height) of tiles
266 const unsigned int c_defaultTileSize = 675;
267 
268 class MarbleGlobalPrivate;
269 class MarbleLocale;
270 
271 class MARBLE_EXPORT MarbleGlobal
272 {
273  public:
274  static MarbleGlobal * getInstance();
275  ~MarbleGlobal();
276 
277  MarbleLocale * locale() const;
278 
279  enum Profile {
280  Default = 0x0,
281  SmallScreen = 0x1,
282  HighResolution = 0x2
283  };
284 
285  Q_DECLARE_FLAGS( Profiles, Profile )
286 
287  Profiles profiles() const;
288  void setProfiles( Profiles profiles );
289 
290  /** @deprecated Profiles are detected automatically now. This only returns profiles() anymore */
291  MARBLE_DEPRECATED static Profiles detectProfiles();
292 
293  private:
294  MarbleGlobal();
295 
296  Q_DISABLE_COPY( MarbleGlobal )
297  MarbleGlobalPrivate * const d;
298 };
299 
300 }
301 
302 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::TessellationFlags )
303 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::LabelPositionFlags )
304 Q_DECLARE_OPERATORS_FOR_FLAGS( Marble::MarbleGlobal::Profiles )
305 
306 #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:174
@ DownloadBrowse
Browsing mode, normal operation of Marble, like a web browser.
Definition: MarbleGlobal.h:155
@ 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:173
@ LowQuality
Low resolution (e.g. interlaced)
Definition: MarbleGlobal.h:76
DownloadUsage
This enum is used to describe the type of download.
Definition: MarbleGlobal.h:153
@ 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:172
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:166
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:184
FlyToMode
Describes possible flight mode (interpolation between source and target camera positions)
Definition: MarbleGlobal.h:162
@ WaitingForUpdate
Rendering is based on complete, but outdated data, data update was requested.
Definition: MarbleGlobal.h:182
@ Automatic
A sane value is chosen automatically depending on animation settings and the action.
Definition: MarbleGlobal.h:163
Projection
This enum is used to choose the projection shown in the view.
Definition: MarbleGlobal.h:41
@ TextureTileType
Tiles that consist of bitmap data.
Definition: MarbleGlobal.h:146
@ Complete
All data is there and up to date.
Definition: MarbleGlobal.h:181
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:164
@ 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:165
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:183
@ 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:154
@ 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
@ VectorTileType
Tiles that consist of vector data.
Definition: MarbleGlobal.h:147
@ Equirectangular
Flat projection ("plate carree")
Definition: MarbleGlobal.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Mar 30 2023 04:19:12 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.