From e3137d86d2d873bf0894c438a51510575d7ecc7a Mon Sep 17 00:00:00 2001 From: Mikhail Pozdnyakov Date: Wed, 18 Sep 2019 14:56:21 +0300 Subject: [core] Use LayerInfo::tileKind in sources --- src/mbgl/style/sources/custom_geometry_source.cpp | 5 ++--- src/mbgl/style/sources/geojson_source.cpp | 5 ++--- src/mbgl/style/sources/image_source.cpp | 3 ++- src/mbgl/style/sources/raster_dem_source.cpp | 3 ++- src/mbgl/style/sources/raster_source.cpp | 3 ++- src/mbgl/style/sources/vector_source.cpp | 5 ++--- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp index 5576277de8..1076cbf417 100644 --- a/src/mbgl/style/sources/custom_geometry_source.cpp +++ b/src/mbgl/style/sources/custom_geometry_source.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -32,9 +33,7 @@ void CustomGeometrySource::loadDescription(FileSource&) { } bool CustomGeometrySource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "line") || !std::strcmp(info->type, "symbol") || - !std::strcmp(info->type, "circle") || !std::strcmp(info->type, "fill") || - !std::strcmp(info->type, "fill-extrusion") || !std::strcmp(info->type, "heatmap"); + return mbgl::underlying_type(Tile::Kind::Geometry) == mbgl::underlying_type(info->tileKind); } void CustomGeometrySource::setTileData(const CanonicalTileID& tileID, diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp index b1a5dd981a..baf76d8224 100644 --- a/src/mbgl/style/sources/geojson_source.cpp +++ b/src/mbgl/style/sources/geojson_source.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include namespace mbgl { @@ -80,9 +81,7 @@ void GeoJSONSource::loadDescription(FileSource& fileSource) { } bool GeoJSONSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "line") || !std::strcmp(info->type, "symbol") || - !std::strcmp(info->type, "circle") || !std::strcmp(info->type, "fill") || - !std::strcmp(info->type, "fill-extrusion") || !std::strcmp(info->type, "heatmap"); + return mbgl::underlying_type(Tile::Kind::Geometry) == mbgl::underlying_type(info->tileKind); } } // namespace style diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp index abd01af701..baadc86e7c 100644 --- a/src/mbgl/style/sources/image_source.cpp +++ b/src/mbgl/style/sources/image_source.cpp @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -82,7 +83,7 @@ void ImageSource::loadDescription(FileSource& fileSource) { } bool ImageSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "raster"); + return mbgl::underlying_type(Tile::Kind::Raster) == mbgl::underlying_type(info->tileKind); } } // namespace style diff --git a/src/mbgl/style/sources/raster_dem_source.cpp b/src/mbgl/style/sources/raster_dem_source.cpp index 724a322917..dd859cc6d1 100644 --- a/src/mbgl/style/sources/raster_dem_source.cpp +++ b/src/mbgl/style/sources/raster_dem_source.cpp @@ -4,6 +4,7 @@ #include #include #include +#include #include namespace mbgl { @@ -14,7 +15,7 @@ RasterDEMSource::RasterDEMSource(std::string id, variant u } bool RasterDEMSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "hillshade"); + return mbgl::underlying_type(Tile::Kind::RasterDEM) == mbgl::underlying_type(info->tileKind); } } // namespace style diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp index c758a7bc8b..851f32573e 100644 --- a/src/mbgl/style/sources/raster_source.cpp +++ b/src/mbgl/style/sources/raster_source.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -82,7 +83,7 @@ void RasterSource::loadDescription(FileSource& fileSource) { } bool RasterSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "raster"); + return mbgl::underlying_type(Tile::Kind::Raster) == mbgl::underlying_type(info->tileKind); } } // namespace style diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp index 7cb89a9474..dc1a45fdff 100644 --- a/src/mbgl/style/sources/vector_source.cpp +++ b/src/mbgl/style/sources/vector_source.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include #include @@ -86,9 +87,7 @@ void VectorSource::loadDescription(FileSource& fileSource) { } bool VectorSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const { - return !std::strcmp(info->type, "line") || !std::strcmp(info->type, "symbol") || - !std::strcmp(info->type, "circle") || !std::strcmp(info->type, "fill") || - !std::strcmp(info->type, "fill-extrusion") || !std::strcmp(info->type, "heatmap"); + return mbgl::underlying_type(Tile::Kind::Geometry) == mbgl::underlying_type(info->tileKind); } } // namespace style -- cgit v1.2.1