Files
MapLibreParticleLab/include/mbgl/style/sources/raster_array_source.hpp
2026-08-31 12:17:06 +08:00

44 lines
1.1 KiB
C++

#pragma once
#include <mbgl/style/source.hpp>
#include <optional>
namespace mbgl {
class AsyncRequest;
namespace style {
class RasterArraySource final : public Source {
public:
RasterArraySource(std::string id, std::string fixtureID, std::string metadataURL, std::string fieldURL);
~RasterArraySource() override;
class Impl;
const Impl& impl() const;
void loadDescription(FileSource&) override;
bool supportsLayerType(const LayerTypeInfo*) const override;
mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); }
protected:
Mutable<Source::Impl> createMutable() const noexcept override;
private:
void tryLoad();
std::unique_ptr<AsyncRequest> metadataRequest;
std::unique_ptr<AsyncRequest> fieldRequest;
std::optional<std::string> metadata;
std::optional<std::vector<char>> fieldBytes;
uint64_t generation = 0;
mapbox::base::WeakPtrFactory<Source> weakFactory{this};
};
template <>
inline bool Source::is<RasterArraySource>() const {
return getType() == SourceType::RasterArray;
}
} // namespace style
} // namespace mbgl