-
-
Notifications
You must be signed in to change notification settings - Fork 561
Expand file tree
/
Copy pathcustom_vector_source.hpp
More file actions
65 lines (49 loc) · 1.64 KB
/
Copy pathcustom_vector_source.hpp
File metadata and controls
65 lines (49 loc) · 1.64 KB
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
#pragma once
#include <mbgl/style/source.hpp>
#include <mbgl/util/range.hpp>
#include <cstdint>
#include <functional>
#include <memory>
#include <string>
namespace mbgl {
class OverscaledTileID;
class CanonicalTileID;
template <class T>
class Actor;
namespace style {
using TileFunction = std::function<void(const CanonicalTileID&)>;
class CustomVectorTileLoader;
enum class TileDataFormat : uint8_t {
MVT = 0,
};
class CustomVectorSource final : public Source {
public:
struct Options {
TileFunction fetchTileFunction;
TileFunction cancelTileFunction;
Range<uint8_t> zoomRange = {0, 18};
};
CustomVectorSource(std::string id, const Options& options);
~CustomVectorSource() final;
void loadDescription(FileSource&) final;
void setTileData(const CanonicalTileID&,
const std::shared_ptr<const std::string>& data,
TileDataFormat format = TileDataFormat::MVT);
void setTileError(const CanonicalTileID&, std::exception_ptr error);
void invalidateTile(const CanonicalTileID&);
class Impl;
const Impl& impl() const;
bool supportsLayerType(const mbgl::style::LayerTypeInfo*) const override;
mapbox::base::WeakPtr<Source> makeWeakPtr() override { return weakFactory.makeWeakPtr(); }
protected:
Mutable<Source::Impl> createMutable() const noexcept final;
private:
std::unique_ptr<Actor<CustomVectorTileLoader>> loader;
mapbox::base::WeakPtrFactory<Source> weakFactory{this};
};
template <>
inline bool Source::is<CustomVectorSource>() const {
return getType() == SourceType::CustomMVTVector;
}
} // namespace style
} // namespace mbgl