summaryrefslogtreecommitdiff
path: root/include/mbgl/map/map_options.hpp
blob: 1a72837c4c48b1761a45a16ac72ec4965deee162 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
#pragma once

#include <mbgl/map/mode.hpp>

#include <memory>
#include <string>

namespace mbgl {

/**
 * @brief Holds values for Map options.
 */
class MapOptions {
public:
    /**
     * @brief Constructs a MapOptions object with default values.
     */
    MapOptions();
    ~MapOptions();

    /**
     * @brief Sets the map rendering mode. By default, it is set to Continuous
     * so the map will render as data arrives from the network and react
     * immediately to state changes.
     *
     * @param mode Map rendering mode.
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withMapMode(MapMode mode);

    /**
     * @brief Gets the previously set (or default) map mode.
     *
     * @return map mode.
     */
    MapMode mapMode() const;

    /**
     * @brief Sets the viewport mode. This can be used to flip the vertical
     * orientation of the map as some devices may use inverted orientation.
     *
     * @param mode Viewport mode.
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withViewportMode(ViewportMode mode);

    /**
     * @brief Gets the previously set (or default) viewport mode.
     *
     * @return viewport mode.
     */
    ViewportMode viewportMode() const;

    /**
     * @brief Sets the cache path.
     *
     * @param path Cache path.
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withCachePath(std::string path);

    /**
     * @brief Gets the previously set (or default) cache path.
     *
     * @return cache path
     */
    const std::string& cachePath() const;

    /**
     * @brief Sets the asset path, which is the root directory from where
     * the asset:// scheme gets resolved in a style.
     *
     * @param path Asset path.
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withAssetRoot(std::string path);

    /**
     * @brief Gets the previously set (or default) asset path.
     *
     * @return asset path
     */
    const std::string& assetRoot() const;

    /**
     * @brief Sets the maximum cache size.
     *
     * @param size Cache maximum size in bytes.
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withMaximumCacheSize(uint64_t size);

    /**
     * @brief Gets the previously set (or default) maximum allowed cache size.
     *
     * @return maximum allowed cache database size in bytes.
     */
    uint64_t maximumCacheSize() const;

    /**
     * @brief Specify whether to enable cross-source symbol collision detection
     * or not. By default, it is set to true.
     *
     * @param enableCollisions true to enable, false to disable
     * @return reference to MapOptions for chaining options together.
     */
    MapOptions& withCrossSourceCollisions(bool enableCollisions);

    /**
     * @brief Gets the previously set (or default) crossSourceCollisions value.
     *
     * @return true if ecross-source symbol collision detection enabled,
     * false otherwise.
     */
    bool crossSourceCollisions() const;

private:
    class Impl;
    std::shared_ptr<Impl> impl_;
};

}  // namespace mbgl