diff options
author | Dane Springmeyer <dane@mapbox.com> | 2017-10-17 18:32:11 -0700 |
---|---|---|
committer | Dane Springmeyer <dane@mapbox.com> | 2017-10-17 18:32:11 -0700 |
commit | 2c01c867e64304164ed12e0159d86e22fc103d76 (patch) | |
tree | a4c445d9c8882df06e5e4a01121c826a63fd1c3b | |
parent | 10f7af19ce1ec61f37459f9cd75e2a0c89a0c790 (diff) | |
download | qtlocation-mapboxgl-upstream/mapbox-feature.tar.gz |
adapt to decoupled mapbox::featureupstream/mapbox-feature
-rw-r--r-- | include/mbgl/util/feature.hpp | 13 | ||||
-rw-r--r-- | include/mbgl/util/geojson.hpp | 2 | ||||
-rw-r--r-- | src/mbgl/annotation/shape_annotation_impl.cpp | 3 | ||||
-rw-r--r-- | src/mbgl/style/sources/geojson_source.cpp | 2 | ||||
-rw-r--r-- | src/mbgl/style/sources/geojson_source_impl.cpp | 12 | ||||
-rw-r--r-- | src/mbgl/style/sources/geojson_source_impl.hpp | 3 | ||||
-rw-r--r-- | src/mbgl/tile/geojson_tile.cpp | 4 | ||||
-rw-r--r-- | src/mbgl/tile/geojson_tile.hpp | 4 | ||||
-rw-r--r-- | src/mbgl/tile/geojson_tile_data.hpp | 16 | ||||
-rw-r--r-- | test/style/filter.test.cpp | 3 | ||||
-rw-r--r-- | test/tile/geojson_tile.test.cpp | 8 |
11 files changed, 37 insertions, 33 deletions
diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp index 4eeceda944..bdcc02913a 100644 --- a/include/mbgl/util/feature.hpp +++ b/include/mbgl/util/feature.hpp @@ -2,15 +2,16 @@ #include <mbgl/util/optional.hpp> -#include <mapbox/geometry/feature.hpp> +#include <mapbox/feature.hpp> namespace mbgl { -using Value = mapbox::geometry::value; -using NullValue = mapbox::geometry::null_value_t; -using PropertyMap = mapbox::geometry::property_map; -using FeatureIdentifier = mapbox::geometry::identifier; -using Feature = mapbox::geometry::feature<double>; +using Value = mapbox::feature::value; +using NullValue = mapbox::feature::null_value_t; +using PropertyMap = mapbox::feature::property_map; +using FeatureIdentifier = mapbox::feature::identifier; +using Feature = mapbox::feature::feature<double>; +using FeatureCollection = mapbox::feature::feature_collection<double>; template <class T> optional<T> numericValue(const Value& value) { diff --git a/include/mbgl/util/geojson.hpp b/include/mbgl/util/geojson.hpp index b4e789a3ac..e9964abe26 100644 --- a/include/mbgl/util/geojson.hpp +++ b/include/mbgl/util/geojson.hpp @@ -5,6 +5,6 @@ namespace mbgl { using GeoJSON = mapbox::geojson::geojson; -using FeatureCollection = mapbox::geojson::feature_collection; +using GeoJSONFeatureCollection = mapbox::geojson::feature_collection; } // namespace mbgl diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp index 0c1a631ad8..b70e75cca1 100644 --- a/src/mbgl/annotation/shape_annotation_impl.cpp +++ b/src/mbgl/annotation/shape_annotation_impl.cpp @@ -6,6 +6,7 @@ #include <mbgl/util/string.hpp> #include <mbgl/util/constants.hpp> #include <mbgl/util/geometry.hpp> +#include <mbgl/util/feature.hpp> namespace mbgl { @@ -22,7 +23,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati static const double baseTolerance = 4; if (!shapeTiler) { - mapbox::geometry::feature_collection<double> features; + mbgl::FeatureCollection features; features.emplace_back(ShapeAnnotationGeometry::visit(geometry(), [] (auto&& geom) { return Feature { std::move(geom) }; })); diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp index 4e3478322d..0cd5c2bbff 100644 --- a/src/mbgl/style/sources/geojson_source.cpp +++ b/src/mbgl/style/sources/geojson_source.cpp @@ -67,7 +67,7 @@ void GeoJSONSource::loadDescription(FileSource& fileSource) { error.message.c_str()); // Create an empty GeoJSON VT object to make sure we're not infinitely waiting for // tiles to load. - baseImpl = makeMutable<Impl>(impl(), GeoJSON{ FeatureCollection{} }); + baseImpl = makeMutable<Impl>(impl(), GeoJSON{ GeoJSONFeatureCollection{} }); } else { baseImpl = makeMutable<Impl>(impl(), *geoJSON); } diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp index fd6d7d3013..e652826e41 100644 --- a/src/mbgl/style/sources/geojson_source_impl.cpp +++ b/src/mbgl/style/sources/geojson_source_impl.cpp @@ -17,7 +17,7 @@ public: const mapbox::geojsonvt::Options& options) : impl(geoJSON, options) {} - mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final { + mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final { return impl.getTile(tileID.z, tileID.x, tileID.y).features; } @@ -27,11 +27,11 @@ private: class SuperclusterData : public GeoJSONData { public: - SuperclusterData(const mapbox::geometry::feature_collection<double>& features, + SuperclusterData(const mapbox::feature::feature_collection<double>& features, const mapbox::supercluster::Options& options) : impl(features, options) {} - mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final { + mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final { return impl.getTile(tileID.z, tileID.x, tileID.y); } @@ -50,14 +50,14 @@ GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON) double scale = util::EXTENT / util::tileSize; if (options.cluster - && geoJSON.is<mapbox::geometry::feature_collection<double>>() - && !geoJSON.get<mapbox::geometry::feature_collection<double>>().empty()) { + && geoJSON.is<mapbox::feature::feature_collection<double>>() + && !geoJSON.get<mapbox::feature::feature_collection<double>>().empty()) { mapbox::supercluster::Options clusterOptions; clusterOptions.maxZoom = options.clusterMaxZoom; clusterOptions.extent = util::EXTENT; clusterOptions.radius = ::round(scale * options.clusterRadius); data = std::make_unique<SuperclusterData>( - geoJSON.get<mapbox::geometry::feature_collection<double>>(), clusterOptions); + geoJSON.get<mapbox::feature::feature_collection<double>>(), clusterOptions); } else { mapbox::geojsonvt::Options vtOptions; vtOptions.maxZoom = options.maxzoom; diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp index a524bab9f2..8922c074b0 100644 --- a/src/mbgl/style/sources/geojson_source_impl.hpp +++ b/src/mbgl/style/sources/geojson_source_impl.hpp @@ -3,6 +3,7 @@ #include <mbgl/style/source_impl.hpp> #include <mbgl/style/sources/geojson_source.hpp> #include <mbgl/util/range.hpp> +#include <mapbox/feature.hpp> namespace mbgl { @@ -14,7 +15,7 @@ namespace style { class GeoJSONData { public: virtual ~GeoJSONData() = default; - virtual mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID&) = 0; + virtual mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID&) = 0; }; class GeoJSONSource::Impl : public Source::Impl { diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp index d648d2e5ff..356fe678e0 100644 --- a/src/mbgl/tile/geojson_tile.cpp +++ b/src/mbgl/tile/geojson_tile.cpp @@ -9,12 +9,12 @@ namespace mbgl { GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID, std::string sourceID_, const TileParameters& parameters, - mapbox::geometry::feature_collection<int16_t> features) + mapbox::feature::feature_collection<int16_t> features) : GeometryTile(overscaledTileID, sourceID_, parameters) { updateData(std::move(features)); } -void GeoJSONTile::updateData(mapbox::geometry::feature_collection<int16_t> features) { +void GeoJSONTile::updateData(mapbox::feature::feature_collection<int16_t> features) { setData(std::make_unique<GeoJSONTileData>(std::move(features))); } diff --git a/src/mbgl/tile/geojson_tile.hpp b/src/mbgl/tile/geojson_tile.hpp index 270406267c..2fa1ac47f4 100644 --- a/src/mbgl/tile/geojson_tile.hpp +++ b/src/mbgl/tile/geojson_tile.hpp @@ -12,9 +12,9 @@ public: GeoJSONTile(const OverscaledTileID&, std::string sourceID, const TileParameters&, - mapbox::geometry::feature_collection<int16_t>); + mapbox::feature::feature_collection<int16_t>); - void updateData(mapbox::geometry::feature_collection<int16_t>); + void updateData(mapbox::feature::feature_collection<int16_t>); void querySourceFeatures( std::vector<Feature>& result, diff --git a/src/mbgl/tile/geojson_tile_data.hpp b/src/mbgl/tile/geojson_tile_data.hpp index 3402c2a009..6bd76eb70d 100644 --- a/src/mbgl/tile/geojson_tile_data.hpp +++ b/src/mbgl/tile/geojson_tile_data.hpp @@ -7,9 +7,9 @@ namespace mbgl { class GeoJSONTileFeature : public GeometryTileFeature { public: - const mapbox::geometry::feature<int16_t>& feature; + const mapbox::feature::feature<int16_t>& feature; - GeoJSONTileFeature(const mapbox::geometry::feature<int16_t>& feature_) + GeoJSONTileFeature(const mapbox::feature::feature<int16_t>& feature_) : feature(feature_) { } @@ -47,7 +47,7 @@ public: class GeoJSONTileLayer : public GeometryTileLayer { public: - GeoJSONTileLayer(std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features_) + GeoJSONTileLayer(std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features_) : features(std::move(features_)) { } @@ -64,17 +64,17 @@ public: } private: - std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features; + std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features; }; class GeoJSONTileData : public GeometryTileData { public: - GeoJSONTileData(mapbox::geometry::feature_collection<int16_t> features_) - : features(std::make_shared<mapbox::geometry::feature_collection<int16_t>>( + GeoJSONTileData(mapbox::feature::feature_collection<int16_t> features_) + : features(std::make_shared<mapbox::feature::feature_collection<int16_t>>( std::move(features_))) { } - GeoJSONTileData(std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features_) + GeoJSONTileData(std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features_) : features(std::move(features_)) { } @@ -88,7 +88,7 @@ public: private: - std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features; + std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features; }; } // namespace mbgl diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp index 73f8e7626d..cfbec7bd2d 100644 --- a/test/style/filter.test.cpp +++ b/test/style/filter.test.cpp @@ -1,6 +1,7 @@ #include <mbgl/test/util.hpp> #include <mbgl/util/feature.hpp> #include <mbgl/util/geometry.hpp> +#include <mbgl/util/feature.hpp> #include <mbgl/style/filter.hpp> #include <mbgl/style/filter_evaluator.hpp> @@ -40,7 +41,7 @@ TEST(Filter, EqualsNumber) { ASSERT_FALSE(f(feature({{ "foo", std::string("0") }}))); ASSERT_FALSE(f(feature({{ "foo", false }}))); ASSERT_FALSE(f(feature({{ "foo", true }}))); - ASSERT_FALSE(f(feature({{ "foo", mapbox::geometry::null_value }}))); + ASSERT_FALSE(f(feature({{ "foo", mapbox::feature::null_value }}))); ASSERT_FALSE(f(feature({{}}))); } diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp index 953c3b8a5f..cd07ed3c13 100644 --- a/test/tile/geojson_tile.test.cpp +++ b/test/tile/geojson_tile.test.cpp @@ -50,8 +50,8 @@ TEST(GeoJSONTile, Issue7648) { CircleLayer layer("circle", "source"); - mapbox::geometry::feature_collection<int16_t> features; - features.push_back(mapbox::geometry::feature<int16_t> { + mapbox::feature::feature_collection<int16_t> features; + features.push_back(mapbox::feature::feature<int16_t> { mapbox::geometry::point<int16_t>(0, 0) }); @@ -85,8 +85,8 @@ TEST(GeoJSONTile, Issue9927) { CircleLayer layer("circle", "source"); - mapbox::geometry::feature_collection<int16_t> features; - features.push_back(mapbox::geometry::feature<int16_t> { + mapbox::feature::feature_collection<int16_t> features; + features.push_back(mapbox::feature::feature<int16_t> { mapbox::geometry::point<int16_t>(0, 0) }); |