From c8ffe9520fa6b21683209e1de2f32e1d1e3a205c Mon Sep 17 00:00:00 2001 From: Vaclav Blazek Date: Wed, 9 Aug 2017 10:50:48 +0200 Subject: [PATCH] surface: added support for browserOptions in introspection --- mapproxy/src/mapproxy/generator/surface.cpp | 26 +++++++++++++++++++++ mapproxy/src/mapproxy/generator/surface.hpp | 1 + 2 files changed, 27 insertions(+) diff --git a/mapproxy/src/mapproxy/generator/surface.cpp b/mapproxy/src/mapproxy/generator/surface.cpp index ea72830..5aa0ff1 100644 --- a/mapproxy/src/mapproxy/generator/surface.cpp +++ b/mapproxy/src/mapproxy/generator/surface.cpp @@ -88,6 +88,16 @@ bool SurfaceBase::Introspection::operator!=(const Introspection &other) const if (geodata != other.geodata) { return true; } if (position != other.position) { 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; } @@ -115,6 +125,12 @@ void SurfaceBase::SurfaceDefinition::parse(const Json::Value &value) introspection.position = vr::positionFromJson(jintrospection["position"]); } + + if (jintrospection.isMember("browserOptions")) { + introspection.browserOptions + = Json::check(jintrospection["browserOptions"] + , Json::objectValue); + } } } @@ -135,6 +151,12 @@ void SurfaceBase::SurfaceDefinition::build(Json::Value &value) const if (introspection.position) { jintrospection["position"] = vr::asJson(*introspection.position); } + + if (!introspection.browserOptions.empty()) { + jintrospection["browserOptions"] + = boost::any_cast + (introspection.browserOptions); + } } } @@ -596,6 +618,10 @@ SurfaceBase::extraProperties(const SurfaceDefinition &def) const extra.position = *def.introspection.position; } + // browser options (must be Json::Value!) + extra.browserOptions = def.introspection.browserOptions; + + return extra; } diff --git a/mapproxy/src/mapproxy/generator/surface.hpp b/mapproxy/src/mapproxy/generator/surface.hpp index cc098de..028c284 100644 --- a/mapproxy/src/mapproxy/generator/surface.hpp +++ b/mapproxy/src/mapproxy/generator/surface.hpp @@ -50,6 +50,7 @@ class SurfaceBase : public Generator { Resource::Id::list tms; Resource::Id::list geodata; boost::optional position; + boost::any browserOptions; bool empty() const; bool operator!=(const Introspection &other) const;