summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources/image_source_impl.cpp
blob: 6b16f96d5580d54530ab021d485d540a881e4bf4 (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
#include <mbgl/style/sources/image_source_impl.hpp>
#include <mbgl/util/geo.hpp>

namespace mbgl {
namespace style {

ImageSource::Impl::Impl(std::string id_, std::array<LatLng, 4> coords_)
    : Source::Impl(std::move(id_)), coords(coords_) {}

ImageSource::Impl::Impl(const Impl& other, std::array<LatLng, 4> coords_)
    : Source::Impl(other), coords(coords_), image(other.image) {}

ImageSource::Impl::Impl(const Impl& rhs, PremultipliedImage&& image_)
    : Source::Impl(rhs), coords(rhs.coords), image(std::make_shared<PremultipliedImage>(std::move(image_))) {}
ImageSource::Impl::~Impl() = default;

std::shared_ptr<PremultipliedImage> ImageSource::Impl::getImage() const {
    return image;
}

std::array<LatLng, 4> ImageSource::Impl::getCoordinates() const {
    return coords;
}

optional<std::string> ImageSource::Impl::getAttribution() const {
    return {};
}

const SourceTypeInfo* ImageSource::Impl::staticTypeInfo() noexcept {
    const static SourceTypeInfo typeInfo{
        "image", SourceTypeInfo::TilePrefetch::No, SourceTypeInfo::TileSet::No, nullopt};
    return &typeInfo;
}

} // namespace style
} // namespace mbgl