diff options
author | danswick <dan.swick@gmail.com> | 2019-09-18 11:39:43 -0700 |
---|---|---|
committer | danswick <dan.swick@gmail.com> | 2019-09-18 11:39:43 -0700 |
commit | 46914ecff8b3f2a1945b33358a879c2aac074f17 (patch) | |
tree | 697cf276a43ae4c18c0ad7029c00e7d771448822 /src/mbgl/style/style_impl.cpp | |
parent | 47ea84ad1a5fed3431d026c5765c17c507d4623e (diff) | |
parent | 8805defe57aa0d8886c7828d39b1b9b1f17f21b8 (diff) | |
download | qtlocation-mapboxgl-upstream/android-docs-automation.tar.gz |
Merge branch 'master' into android-docs-automationupstream/android-docs-automation
Diffstat (limited to 'src/mbgl/style/style_impl.cpp')
-rw-r--r-- | src/mbgl/style/style_impl.cpp | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/src/mbgl/style/style_impl.cpp b/src/mbgl/style/style_impl.cpp index d3298c5cac..95a39819fc 100644 --- a/src/mbgl/style/style_impl.cpp +++ b/src/mbgl/style/style_impl.cpp @@ -1,26 +1,27 @@ -#include <mbgl/style/style_impl.hpp> -#include <mbgl/style/observer.hpp> -#include <mbgl/style/source_impl.hpp> -#include <mbgl/style/layers/symbol_layer.hpp> -#include <mbgl/style/layers/custom_layer.hpp> +#include <mbgl/sprite/sprite_loader.hpp> +#include <mbgl/storage/file_source.hpp> +#include <mbgl/storage/resource.hpp> +#include <mbgl/storage/response.hpp> +#include <mbgl/style/layer_impl.hpp> #include <mbgl/style/layers/background_layer.hpp> -#include <mbgl/style/layers/fill_layer.hpp> +#include <mbgl/style/layers/circle_layer.hpp> +#include <mbgl/style/layers/custom_layer.hpp> #include <mbgl/style/layers/fill_extrusion_layer.hpp> +#include <mbgl/style/layers/fill_layer.hpp> #include <mbgl/style/layers/heatmap_layer.hpp> +#include <mbgl/style/layers/hillshade_layer.hpp> #include <mbgl/style/layers/line_layer.hpp> -#include <mbgl/style/layers/circle_layer.hpp> #include <mbgl/style/layers/raster_layer.hpp> -#include <mbgl/style/layers/hillshade_layer.hpp> -#include <mbgl/style/layer_impl.hpp> +#include <mbgl/style/layers/symbol_layer.hpp> +#include <mbgl/style/observer.hpp> #include <mbgl/style/parser.hpp> +#include <mbgl/style/source_impl.hpp> +#include <mbgl/style/style_impl.hpp> #include <mbgl/style/transition_options.hpp> -#include <mbgl/sprite/sprite_loader.hpp> #include <mbgl/util/exception.hpp> -#include <mbgl/util/string.hpp> #include <mbgl/util/logging.hpp> -#include <mbgl/storage/file_source.hpp> -#include <mbgl/storage/resource.hpp> -#include <mbgl/storage/response.hpp> +#include <mbgl/util/string.hpp> +#include <sstream> namespace mbgl { namespace style { @@ -177,6 +178,15 @@ Layer* Style::Impl::getLayer(const std::string& id) const { Layer* Style::Impl::addLayer(std::unique_ptr<Layer> layer, optional<std::string> before) { // TODO: verify source + if (Source* source = sources.get(layer->getSourceID())) { + if (!source->supportsLayerType(layer->baseImpl->getTypeInfo())) { + std::ostringstream message; + message << "Layer '" << layer->getID() << "' is not compatible with source '" << layer->getSourceID() + << "'"; + + throw std::runtime_error(message.str()); + } + } if (layers.get(layer->getID())) { throw std::runtime_error(std::string{"Layer "} + layer->getID() + " already exists"); |