Skip to content
This repository has been archived by the owner on Aug 22, 2023. It is now read-only.

Commit

Permalink
surface: added support for browserOptions in introspection
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavblazek committed Aug 9, 2017
1 parent 9e31478 commit c8ffe95
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
26 changes: 26 additions & 0 deletions mapproxy/src/mapproxy/generator/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<const Json::Value&>(browserOptions)
!= boost::any_cast<const Json::Value&>(other.browserOptions)))
{
return true;
}

return false;
}

Expand Down Expand Up @@ -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);
}
}
}

Expand All @@ -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<const Json::Value&>
(introspection.browserOptions);
}
}
}

Expand Down Expand Up @@ -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;
}

Expand Down
1 change: 1 addition & 0 deletions mapproxy/src/mapproxy/generator/surface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ class SurfaceBase : public Generator {
Resource::Id::list tms;
Resource::Id::list geodata;
boost::optional<vr::Position> position;
boost::any browserOptions;

bool empty() const;
bool operator!=(const Introspection &other) const;
Expand Down

0 comments on commit c8ffe95

Please sign in to comment.