diff options
author | Vladimir Agafonkin <agafonkin@gmail.com> | 2016-07-27 20:18:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-27 20:18:41 +0300 |
commit | 9ecc0d95979ca2fa3154f4b47c8f9fa4717fe696 (patch) | |
tree | b5e09683505cec994e3198a92cd8863d54979e3e /include/mbgl/style/sources/geojson_source.hpp | |
parent | 6edaf2dc81ab771d1da27c939b19502753aa895f (diff) | |
download | qtlocation-mapboxgl-9ecc0d95979ca2fa3154f4b47c8f9fa4717fe696.tar.gz |
GeoJSON point clustering (#5724)
* add supercluster dependency
* prepare GeoJSONTile for Supercluster
* prepare GeoJSONSource for accepting options
* try removing mbgl::GeoJSON
* fix setGeoJSON types
* add GeoJSONSource getURL
* add geojson to include path
* add Supercluster index in GeoJSONSource
* fix GeoJSONSource getZoomRange
* bring back mbgl::GeoJSON header
* fix tidy warnings hopefully
* try test-suite with enabled cluster test
* fix formatting in clustering-related files
Diffstat (limited to 'include/mbgl/style/sources/geojson_source.hpp')
-rw-r--r-- | include/mbgl/style/sources/geojson_source.hpp | 35 |
1 files changed, 33 insertions, 2 deletions
diff --git a/include/mbgl/style/sources/geojson_source.hpp b/include/mbgl/style/sources/geojson_source.hpp index 3736dd44bc..37ddce1bcc 100644 --- a/include/mbgl/style/sources/geojson_source.hpp +++ b/include/mbgl/style/sources/geojson_source.hpp @@ -3,15 +3,46 @@ #include <mbgl/style/source.hpp> #include <mbgl/util/geojson.hpp> +#include <mapbox/geojson.hpp> + +namespace mapbox { + +namespace geojsonvt { +class GeoJSONVT; +} // namespace geojsonvt + +namespace supercluster { +class Supercluster; +} // namespace supercluster + +} // namespace mapbox + namespace mbgl { namespace style { +using GeoJSONVTPointer = std::unique_ptr<mapbox::geojsonvt::GeoJSONVT>; +using SuperclusterPointer = std::unique_ptr<mapbox::supercluster::Supercluster>; + +struct GeoJSONOptions { + // GeoJSON-VT options + uint8_t maxzoom = 18; + uint16_t buffer = 128; + double tolerance = 0.375; + + // Supercluster options + bool cluster = false; + uint16_t clusterRadius = 50; + uint8_t clusterMaxZoom = 17; +}; + class GeoJSONSource : public Source { public: - GeoJSONSource(const std::string& id); + GeoJSONSource(const std::string& id, const GeoJSONOptions options_ = GeoJSONOptions()); void setURL(const std::string& url); - void setGeoJSON(GeoJSON&&); + void setGeoJSON(const GeoJSON&); + + std::string getURL(); // Private implementation |