This patch also bumps geojson-vt-cpp version to 6.6.0, which enables the `lineMetrics` option.
56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <mbgl/style/source.hpp>
|
|
#include <mbgl/util/geojson.hpp>
|
|
#include <mbgl/util/optional.hpp>
|
|
#include <mbgl/util/constants.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
class AsyncRequest;
|
|
|
|
namespace style {
|
|
|
|
struct GeoJSONOptions {
|
|
// GeoJSON-VT options
|
|
uint8_t minzoom = 0;
|
|
uint8_t maxzoom = 18;
|
|
uint16_t tileSize = util::tileSize;
|
|
uint16_t buffer = 128;
|
|
double tolerance = 0.375;
|
|
bool lineMetrics = false;
|
|
|
|
// Supercluster options
|
|
bool cluster = false;
|
|
uint16_t clusterRadius = 50;
|
|
uint8_t clusterMaxZoom = 17;
|
|
};
|
|
|
|
class GeoJSONSource : public Source {
|
|
public:
|
|
GeoJSONSource(const std::string& id, const GeoJSONOptions& = {});
|
|
~GeoJSONSource() final;
|
|
|
|
void setURL(const std::string& url);
|
|
void setGeoJSON(const GeoJSON&);
|
|
|
|
optional<std::string> getURL() const;
|
|
|
|
class Impl;
|
|
const Impl& impl() const;
|
|
|
|
void loadDescription(FileSource&) final;
|
|
|
|
private:
|
|
optional<std::string> url;
|
|
std::unique_ptr<AsyncRequest> req;
|
|
};
|
|
|
|
template <>
|
|
inline bool Source::is<GeoJSONSource>() const {
|
|
return getType() == SourceType::GeoJSON;
|
|
}
|
|
|
|
} // namespace style
|
|
} // namespace mbgl
|