1#pragma once
2
3#include <mbgl/style/source.hpp>
4#include <mbgl/util/geo.hpp>
5#include <mbgl/util/geojson.hpp>
6#include <mbgl/util/range.hpp>
7#include <mbgl/util/constants.hpp>
8
9namespace mbgl {
10
11class OverscaledTileID;
12class CanonicalTileID;
13template <class T>
14class Actor;
15
16namespace style {
17
18using TileFunction = std::function<void(const CanonicalTileID&)>;
19
20class CustomTileLoader;
21
22class CustomGeometrySource : public Source {
23public:
24 struct TileOptions {
25 double tolerance = 0.375;
26 uint16_t tileSize = util::tileSize;
27 uint16_t buffer = 128;
28 bool clip = false;
29 bool wrap = false;
30 };
31
32 struct Options {
33 TileFunction fetchTileFunction;
34 TileFunction cancelTileFunction;
35 Range<uint8_t> zoomRange = { 0, 18};
36 TileOptions tileOptions;
37 };
38public:
39 CustomGeometrySource(std::string id, CustomGeometrySource::Options options);
40 ~CustomGeometrySource() final;
41 void loadDescription(FileSource&) final;
42 void setTileData(const CanonicalTileID&, const GeoJSON&);
43 void invalidateTile(const CanonicalTileID&);
44 void invalidateRegion(const LatLngBounds&);
45 // Private implementation
46 class Impl;
47 const Impl& impl() const;
48private:
49 std::unique_ptr<Actor<CustomTileLoader>> loader;
50};
51
52template <>
53inline bool Source::is<CustomGeometrySource>() const {
54 return getType() == SourceType::CustomVector;
55}
56
57} // namespace style
58} // namespace mbgl
59

source code of qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/style/sources/custom_geometry_source.hpp