blob: a0b990b44b529ce79d54623be18daab968d6ef9c (
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
#pragma once
#include <mbgl/style/source.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/util/geojson.hpp>
#include <mbgl/util/range.hpp>
#include <mbgl/util/constants.hpp>
namespace mbgl {
class OverscaledTileID;
class CanonicalTileID;
template <class T>
class Actor;
namespace style {
using TileFunction = std::function<void(const CanonicalTileID&)>;
class CustomTileLoader;
class CustomGeometrySource : public Source {
public:
struct TileOptions {
double tolerance = 0.375;
uint16_t tileSize = util::tileSize;
uint16_t buffer = 128;
};
struct Options {
TileFunction fetchTileFunction;
TileFunction cancelTileFunction;
Range<uint8_t> zoomRange = { 0, 18};
TileOptions tileOptions;
};
public:
CustomGeometrySource(std::string id, CustomGeometrySource::Options options);
~CustomGeometrySource() final;
void loadDescription(FileSource&) final;
void setTileData(const CanonicalTileID&, const GeoJSON&);
void invalidateTile(const CanonicalTileID&);
void invalidateRegion(const LatLngBounds&);
// Private implementation
class Impl;
const Impl& impl() const;
private:
std::unique_ptr<Actor<CustomTileLoader>> loader;
};
template <>
inline bool Source::is<CustomGeometrySource>() const {
return getType() == SourceType::CustomVector;
}
} // namespace style
} // namespace mbgl
|