summaryrefslogtreecommitdiff
path: root/include/mbgl/map/bound_options.hpp
blob: 69d353a30197f8c2dbb12af7aaaf78d3b974b177 (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
#pragma once

#include <mbgl/util/geo.hpp>
#include <mbgl/util/optional.hpp>

namespace mbgl {

/**
 * @brief Holds options to limit what parts of a map are visible. All fields are
 * optional.
 */
struct BoundOptions {
    /// Sets the latitude and longitude bounds to which the camera center are constrained
    BoundOptions& withLatLngBounds(LatLngBounds b) { bounds = b; return *this; }
    /// Sets the minimum zoom level
    BoundOptions& withMinZoom(double z) { minZoom = z; return *this; }
    /// Sets the maximum zoom level
    BoundOptions& withMaxZoom(double z) { maxZoom = z; return *this; }

    /// Constrain the center of the camera to be within these bounds.
    optional<LatLngBounds> bounds;

    /// Maximum zoom level allowed.
    optional<double> maxZoom;

    /// Minimum zoom level allowed.
    optional<double> minZoom;
};

}  // namespace mbgl