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

Commit

Permalink
added introspection.browserOptions support for geodata
Browse files Browse the repository at this point in the history
  • Loading branch information
vaclavblazek committed Aug 10, 2017
1 parent 58a9627 commit 6110a40
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 2 deletions.
6 changes: 6 additions & 0 deletions mapproxy/src/mapproxy/generator/geodata-vector-tiled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 6 additions & 0 deletions mapproxy/src/mapproxy/generator/geodata-vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
24 changes: 23 additions & 1 deletion mapproxy/src/mapproxy/generator/geodatavectorbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

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

Expand Down Expand Up @@ -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)
Expand All @@ -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<const Json::Value&>(browserOptions)
!= boost::any_cast<const Json::Value&>(other.browserOptions)))
{
return true;
}

return false;
}

Expand Down
1 change: 1 addition & 0 deletions mapproxy/src/mapproxy/generator/geodatavectorbase.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class GeodataVectorBase : public Generator {

struct Introspection {
boost::optional<Resource::Id> surface;
boost::any browserOptions;

bool empty() const;
bool operator!=(const Introspection &other) const;
Expand Down
3 changes: 2 additions & 1 deletion mapproxy/src/mapproxy/generator/surface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6110a40

Please sign in to comment.