diff --git a/mapproxy/src/mapproxy/generator/geodata-vector-tiled.cpp b/mapproxy/src/mapproxy/generator/geodata-vector-tiled.cpp index 8011958..ffae357 100644 --- a/mapproxy/src/mapproxy/generator/geodata-vector-tiled.cpp +++ b/mapproxy/src/mapproxy/generator/geodata-vector-tiled.cpp @@ -256,6 +256,12 @@ vts::MapConfig GeodataVectorTiled::mapConfig_impl(ResourceRoot root) } } + // browser options (must be Json::Value!); overrides browser options from + // surface's introspection + if (!definition_.introspection.browserOptions.empty()) { + mapConfig.browserOptions = definition_.introspection.browserOptions; + } + // done return mapConfig; } diff --git a/mapproxy/src/mapproxy/generator/geodata-vector.cpp b/mapproxy/src/mapproxy/generator/geodata-vector.cpp index 89eb9d8..4f4aa34 100644 --- a/mapproxy/src/mapproxy/generator/geodata-vector.cpp +++ b/mapproxy/src/mapproxy/generator/geodata-vector.cpp @@ -181,6 +181,12 @@ vts::MapConfig GeodataVector::mapConfig_impl(ResourceRoot root) } } + // browser options (must be Json::Value!); overrides browser options from + // surface's introspection + if (!definition_.introspection.browserOptions.empty()) { + mapConfig.browserOptions = definition_.introspection.browserOptions; + } + // done return mapConfig; } diff --git a/mapproxy/src/mapproxy/generator/geodatavectorbase.cpp b/mapproxy/src/mapproxy/generator/geodatavectorbase.cpp index 5d8c4c8..3df1c08 100644 --- a/mapproxy/src/mapproxy/generator/geodatavectorbase.cpp +++ b/mapproxy/src/mapproxy/generator/geodatavectorbase.cpp @@ -100,6 +100,12 @@ void parseDefinition(GeodataVectorBase::Definition &def def.introspection.surface = introspectionIdFrom(jintrospection, "surface"); + + if (jintrospection.isMember("browserOptions")) { + def.introspection.browserOptions + = Json::check(jintrospection["browserOptions"] + , Json::objectValue); + } } } @@ -129,6 +135,12 @@ void buildDefinition(Json::Value &value auto &jintrospection(value["introspection"] = Json::objectValue); introspectionIdTo(jintrospection, "surface" , def.introspection.surface); + + if (!def.introspection.browserOptions.empty()) { + jintrospection["browserOptions"] + = boost::any_cast + (def.introspection.browserOptions); + } } } @@ -189,7 +201,7 @@ void parseDefinition(GeodataVectorBase::Definition &def bool GeodataVectorBase::Introspection::empty() const { - return (!surface); + return (!surface && browserOptions.empty()); } bool GeodataVectorBase::Introspection::operator!=(const Introspection &other) @@ -198,6 +210,16 @@ bool GeodataVectorBase::Introspection::operator!=(const Introspection &other) // introspection can safely change if (surface != other.surface) { return true; } + if (browserOptions.empty() != other.browserOptions.empty()) { + return true; + } + if (!browserOptions.empty() + && (boost::any_cast(browserOptions) + != boost::any_cast(other.browserOptions))) + { + return true; + } + return false; } diff --git a/mapproxy/src/mapproxy/generator/geodatavectorbase.hpp b/mapproxy/src/mapproxy/generator/geodatavectorbase.hpp index f72762d..cb19f76 100644 --- a/mapproxy/src/mapproxy/generator/geodatavectorbase.hpp +++ b/mapproxy/src/mapproxy/generator/geodatavectorbase.hpp @@ -41,6 +41,7 @@ class GeodataVectorBase : public Generator { struct Introspection { boost::optional surface; + boost::any browserOptions; bool empty() const; bool operator!=(const Introspection &other) const; diff --git a/mapproxy/src/mapproxy/generator/surface.cpp b/mapproxy/src/mapproxy/generator/surface.cpp index 5aa0ff1..4ee0d2f 100644 --- a/mapproxy/src/mapproxy/generator/surface.cpp +++ b/mapproxy/src/mapproxy/generator/surface.cpp @@ -78,7 +78,8 @@ namespace generator { bool SurfaceBase::Introspection::empty() const { - return (tms.empty() && geodata.empty() && !position); + return (tms.empty() && geodata.empty() + && !position && browserOptions.empty()); } bool SurfaceBase::Introspection::operator!=(const Introspection &other) const