MapLibre Native Core
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
constants.hpp
Go to the documentation of this file.
1 #pragma once
2 
3 #include <mbgl/util/chrono.hpp>
5 
6 #include <cmath>
7 #include <cstddef>
8 
9 namespace mbgl {
10 
11 namespace util {
12 
13 constexpr double tileSize_D = 512;
14 constexpr uint16_t tileSize_I = 512;
15 
16 /*
17  * The maximum extent of a feature that can be safely stored in the buffer.
18  * In practice, all features are converted to this extent before being added.
19  *
20  * Positions are stored as signed 16bit integers.
21  * One bit is lost for signedness to support features extending past the left edge of the tile.
22  * One bit is lost because the line vertex buffer used to pack 1 bit of other data into the int.
23  * This is no longer the case but we're reserving this bit anyway.
24  * One bit is lost to support features extending past the extent on the right edge of the tile.
25  * This leaves us with 2^13 = 8192
26  */
27 constexpr int32_t EXTENT = 8192;
28 
29 constexpr double M2PI = M_PI * 2;
30 constexpr double EARTH_RADIUS_M = 6378137;
31 constexpr double LATITUDE_MAX = 85.051128779806604;
32 constexpr double LONGITUDE_MAX = 180;
33 constexpr double DEGREES_MAX = 360;
34 constexpr double PITCH_MIN = 0.0;
35 constexpr double PITCH_MAX = M_PI / 3;
36 constexpr double MIN_ZOOM = 0.0;
37 constexpr double MAX_ZOOM = 25.5;
38 constexpr float MIN_ZOOM_F = MIN_ZOOM;
39 constexpr float MAX_ZOOM_F = MAX_ZOOM;
40 constexpr uint8_t DEFAULT_MAX_ZOOM = 22;
41 
42 // ONE_EM constant used to go between "em" units used in style spec and "points" used internally for layout.
43 constexpr float ONE_EM = 24.0f;
44 
45 constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA = 4;
46 
47 constexpr uint64_t DEFAULT_MAX_CACHE_SIZE = 50 * 1024 * 1024;
48 
49 // Default ImageManager's cache size for images added via onStyleImageMissing API.
50 // Average sprite size with 1.0 pixel ratio is ~2kB, 8kB for pixel ratio of 2.0.
51 constexpr std::size_t DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE = 100 * 8192;
52 
55 
56 constexpr UnitBezier DEFAULT_TRANSITION_EASE = { 0, 0, 0.25, 1 };
57 
58 constexpr int DEFAULT_RATE_LIMIT_TIMEOUT = 5;
59 
60 constexpr const char* ASSET_PROTOCOL = "asset://";
61 constexpr const char* FILE_PROTOCOL = "file://";
62 constexpr const char* MBTILES_PROTOCOL = "mbtiles://";
63 constexpr uint32_t DEFAULT_MAXIMUM_CONCURRENT_REQUESTS = 20;
64 
65 constexpr uint8_t TERRAIN_RGB_MAXZOOM = 15;
66 
67 constexpr const char* LAST_RESORT_ALPHABETIC_FONT = "Open Sans Regular";
68 constexpr const char* LAST_RESORT_PAN_UNICODE_FONT = "Arial Unicode MS Regular";
69 
70 } // namespace util
71 
72 namespace debug {
73 
74 extern const bool tileParseWarnings;
75 extern const bool styleParseWarnings;
76 extern const bool spriteWarnings;
77 extern const bool renderWarnings;
78 extern const bool labelTextMissingWarning;
79 extern const bool missingFontStackWarning;
80 extern const bool missingFontFaceWarning;
81 extern const bool glyphWarning;
82 extern const bool shapingWarning;
83 
84 } // namespace debug
85 
86 } // namespace mbgl
const bool labelTextMissingWarning
const bool spriteWarnings
const bool renderWarnings
const bool shapingWarning
const bool glyphWarning
const bool missingFontStackWarning
const bool styleParseWarnings
const bool missingFontFaceWarning
const bool tileParseWarnings
constexpr UnitBezier DEFAULT_TRANSITION_EASE
Definition: constants.hpp:56
constexpr uint64_t DEFAULT_MAX_CACHE_SIZE
Definition: constants.hpp:47
constexpr float ONE_EM
Definition: constants.hpp:43
constexpr const char * LAST_RESORT_ALPHABETIC_FONT
Definition: constants.hpp:67
constexpr uint8_t TERRAIN_RGB_MAXZOOM
Definition: constants.hpp:65
constexpr int DEFAULT_RATE_LIMIT_TIMEOUT
Definition: constants.hpp:58
constexpr double MAX_ZOOM
Definition: constants.hpp:37
constexpr Duration DEFAULT_TRANSITION_DURATION
Definition: constants.hpp:53
constexpr float MIN_ZOOM_F
Definition: constants.hpp:38
constexpr const char * FILE_PROTOCOL
Definition: constants.hpp:61
constexpr uint8_t DEFAULT_PREFETCH_ZOOM_DELTA
Definition: constants.hpp:45
constexpr double PITCH_MIN
Definition: constants.hpp:34
constexpr std::size_t DEFAULT_ON_DEMAND_IMAGES_CACHE_SIZE
Definition: constants.hpp:51
constexpr const char * MBTILES_PROTOCOL
Definition: constants.hpp:62
constexpr uint8_t DEFAULT_MAX_ZOOM
Definition: constants.hpp:40
constexpr double MIN_ZOOM
Definition: constants.hpp:36
constexpr double PITCH_MAX
Definition: constants.hpp:35
constexpr double M2PI
Definition: constants.hpp:29
constexpr float MAX_ZOOM_F
Definition: constants.hpp:39
constexpr double DEGREES_MAX
Definition: constants.hpp:33
constexpr double LONGITUDE_MAX
Definition: constants.hpp:32
constexpr double EARTH_RADIUS_M
Definition: constants.hpp:30
constexpr uint32_t DEFAULT_MAXIMUM_CONCURRENT_REQUESTS
Definition: constants.hpp:63
constexpr const char * LAST_RESORT_PAN_UNICODE_FONT
Definition: constants.hpp:68
constexpr const char * ASSET_PROTOCOL
Definition: constants.hpp:60
constexpr double tileSize_D
Definition: constants.hpp:13
constexpr int32_t EXTENT
Definition: constants.hpp:27
constexpr Seconds CLOCK_SKEW_RETRY_TIMEOUT
Definition: constants.hpp:54
constexpr uint16_t tileSize_I
Definition: constants.hpp:14
constexpr double LATITUDE_MAX
Definition: constants.hpp:31
Definition: actor.hpp:15
std::chrono::milliseconds Milliseconds
Definition: chrono.hpp:15
std::chrono::seconds Seconds
Definition: chrono.hpp:14
Clock::duration Duration
Definition: chrono.hpp:18