summaryrefslogtreecommitdiff
path: root/include/mbgl/style/conversion/position.hpp
blob: 7036b03822c4acb30f5aecf7d448cbfc604322ef (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
#pragma once

#include <mbgl/style/conversion.hpp>
#include <mbgl/style/position.hpp>
#include <mbgl/util/optional.hpp>

#include <array>

namespace mbgl {
namespace style {
namespace conversion {

template <>
struct Converter<Position> {
    template <class V>
    optional<Position> operator()(const V& value, Error& error) const {
        optional<std::array<float, 3>> spherical = convert<std::array<float, 3>>(value, error);

        if (!spherical) {
            return {};
        }

        return Position(*spherical);
    }
};

} // namespace conversion
} // namespace style
} // namespace mbgl