summaryrefslogtreecommitdiff
path: root/src/mbgl/style/sources
diff options
context:
space:
mode:
Diffstat (limited to 'src/mbgl/style/sources')
-rw-r--r--src/mbgl/style/sources/custom_geometry_source.cpp18
-rw-r--r--src/mbgl/style/sources/geojson_source.cpp15
-rw-r--r--src/mbgl/style/sources/image_source.cpp9
-rw-r--r--src/mbgl/style/sources/raster_dem_source.cpp11
-rw-r--r--src/mbgl/style/sources/raster_source.cpp15
-rw-r--r--src/mbgl/style/sources/vector_source.cpp17
6 files changed, 61 insertions, 24 deletions
diff --git a/src/mbgl/style/sources/custom_geometry_source.cpp b/src/mbgl/style/sources/custom_geometry_source.cpp
index 73675c056f..5576277de8 100644
--- a/src/mbgl/style/sources/custom_geometry_source.cpp
+++ b/src/mbgl/style/sources/custom_geometry_source.cpp
@@ -1,12 +1,14 @@
-#include <mbgl/style/sources/custom_geometry_source.hpp>
-#include <mbgl/style/custom_tile_loader.hpp>
-#include <mbgl/style/sources/custom_geometry_source_impl.hpp>
-#include <mbgl/style/source_observer.hpp>
+#include <cstring>
+#include <map>
#include <mbgl/actor/actor.hpp>
#include <mbgl/actor/scheduler.hpp>
+#include <mbgl/style/custom_tile_loader.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/style/sources/custom_geometry_source.hpp>
+#include <mbgl/style/sources/custom_geometry_source_impl.hpp>
#include <mbgl/tile/tile_id.hpp>
#include <tuple>
-#include <map>
namespace mbgl {
namespace style {
@@ -29,6 +31,12 @@ void CustomGeometrySource::loadDescription(FileSource&) {
observer->onSourceLoaded(*this);
}
+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");
+}
+
void CustomGeometrySource::setTileData(const CanonicalTileID& tileID,
const GeoJSON& data) {
loader->self().invoke(&CustomTileLoader::setTileData, tileID, data);
diff --git a/src/mbgl/style/sources/geojson_source.cpp b/src/mbgl/style/sources/geojson_source.cpp
index 72a51e212f..b1a5dd981a 100644
--- a/src/mbgl/style/sources/geojson_source.cpp
+++ b/src/mbgl/style/sources/geojson_source.cpp
@@ -1,9 +1,10 @@
+#include <mbgl/storage/file_source.hpp>
+#include <mbgl/style/conversion/geojson.hpp>
+#include <mbgl/style/conversion/json.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
#include <mbgl/style/sources/geojson_source.hpp>
#include <mbgl/style/sources/geojson_source_impl.hpp>
-#include <mbgl/style/source_observer.hpp>
-#include <mbgl/style/conversion/json.hpp>
-#include <mbgl/style/conversion/geojson.hpp>
-#include <mbgl/storage/file_source.hpp>
#include <mbgl/util/logging.hpp>
namespace mbgl {
@@ -78,5 +79,11 @@ 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");
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/sources/image_source.cpp b/src/mbgl/style/sources/image_source.cpp
index fa268da0ef..abd01af701 100644
--- a/src/mbgl/style/sources/image_source.cpp
+++ b/src/mbgl/style/sources/image_source.cpp
@@ -1,9 +1,10 @@
+#include <mbgl/storage/file_source.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
#include <mbgl/style/sources/image_source.hpp>
#include <mbgl/style/sources/image_source_impl.hpp>
#include <mbgl/util/geo.hpp>
-#include <mbgl/style/source_observer.hpp>
#include <mbgl/util/premultiply.hpp>
-#include <mbgl/storage/file_source.hpp>
namespace mbgl {
namespace style {
@@ -80,5 +81,9 @@ void ImageSource::loadDescription(FileSource& fileSource) {
});
}
+bool ImageSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const {
+ return !std::strcmp(info->type, "raster");
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/sources/raster_dem_source.cpp b/src/mbgl/style/sources/raster_dem_source.cpp
index bb745561b1..724a322917 100644
--- a/src/mbgl/style/sources/raster_dem_source.cpp
+++ b/src/mbgl/style/sources/raster_dem_source.cpp
@@ -1,8 +1,9 @@
-#include <mbgl/style/sources/raster_dem_source.hpp>
-#include <mbgl/style/sources/raster_source_impl.hpp>
-#include <mbgl/style/source_observer.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/tileset.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/style/sources/raster_dem_source.hpp>
+#include <mbgl/style/sources/raster_source_impl.hpp>
#include <mbgl/util/mapbox.hpp>
namespace mbgl {
@@ -12,5 +13,9 @@ RasterDEMSource::RasterDEMSource(std::string id, variant<std::string, Tileset> u
: RasterSource(std::move(id), urlOrTileset_, tileSize, SourceType::RasterDEM){
}
+bool RasterDEMSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const {
+ return !std::strcmp(info->type, "hillshade");
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/sources/raster_source.cpp b/src/mbgl/style/sources/raster_source.cpp
index 115887d004..c758a7bc8b 100644
--- a/src/mbgl/style/sources/raster_source.cpp
+++ b/src/mbgl/style/sources/raster_source.cpp
@@ -1,11 +1,12 @@
-#include <mbgl/style/sources/raster_source.hpp>
-#include <mbgl/style/sources/raster_source_impl.hpp>
-#include <mbgl/style/source_observer.hpp>
+#include <mbgl/storage/file_source.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/tileset.hpp>
-#include <mbgl/storage/file_source.hpp>
-#include <mbgl/util/mapbox.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/style/sources/raster_source.hpp>
+#include <mbgl/style/sources/raster_source_impl.hpp>
#include <mbgl/util/exception.hpp>
+#include <mbgl/util/mapbox.hpp>
namespace mbgl {
namespace style {
@@ -80,5 +81,9 @@ void RasterSource::loadDescription(FileSource& fileSource) {
});
}
+bool RasterSource::supportsLayerType(const mbgl::style::LayerTypeInfo* info) const {
+ return !std::strcmp(info->type, "raster");
+}
+
} // namespace style
} // namespace mbgl
diff --git a/src/mbgl/style/sources/vector_source.cpp b/src/mbgl/style/sources/vector_source.cpp
index a69ff632d8..7cb89a9474 100644
--- a/src/mbgl/style/sources/vector_source.cpp
+++ b/src/mbgl/style/sources/vector_source.cpp
@@ -1,12 +1,13 @@
-#include <mbgl/style/sources/vector_source.hpp>
-#include <mbgl/style/sources/vector_source_impl.hpp>
-#include <mbgl/style/source_observer.hpp>
+#include <mbgl/storage/file_source.hpp>
#include <mbgl/style/conversion/json.hpp>
#include <mbgl/style/conversion/tileset.hpp>
-#include <mbgl/storage/file_source.hpp>
-#include <mbgl/util/mapbox.hpp>
+#include <mbgl/style/layer.hpp>
+#include <mbgl/style/source_observer.hpp>
+#include <mbgl/style/sources/vector_source.hpp>
+#include <mbgl/style/sources/vector_source_impl.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/exception.hpp>
+#include <mbgl/util/mapbox.hpp>
namespace mbgl {
namespace style {
@@ -84,5 +85,11 @@ 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");
+}
+
} // namespace style
} // namespace mbgl