Feature/gb gui (#390)

Implemented new GUI component to handle WMS servers
* Add Lua scripts to support adding GIBS datasets (closes #222)
* Add Lua function to load WMS servers from a predefined file

* Workaround for Visual Studio 15.3 compile fix in Windows headers

* Initial support for parsing GetCapabilities file and automatically add layers

* Add a Trigger property to remove a layer

* Support default servers

* Add default file

* Move WMS server code from GUI component into GlobeBrowsingModule

* Add Lua scripts for loading and removing WMS servers
Automatically load default servers on startup

* Reset tile provider before removing a layer tolimit the crash risk
Add "From focus" button to switch globebrowsing gui to the same node as the focus

* Remove warnings
Remove compile error with nonexisting GDALOpenEx function
This commit is contained in:
Alexander Bock
2017-08-19 20:23:08 -04:00
committed by GitHub
parent 09a94e6bf5
commit 222bbe22ab
17 changed files with 813 additions and 28 deletions
@@ -24,6 +24,7 @@
#include <modules/globebrowsing/rendering/layer/layer.h>
#include <modules/globebrowsing/rendering/layer/layergroup.h>
#include <modules/globebrowsing/rendering/layer/layermanager.h>
#include <modules/globebrowsing/tile/tileprovider/tileprovider.h>
#include <modules/globebrowsing/tile/tiletextureinitdata.h>
@@ -71,6 +72,13 @@ namespace {
"local cache for this layer and will trigger a fresh load of all tiles."
};
static const openspace::properties::Property::PropertyInfo RemoveInfo = {
"Remove",
"Remove",
"If this value is triggered, a script will be executed that will remove this "
"layer before the next frame."
};
static const openspace::properties::Property::PropertyInfo ColorInfo = {
"Color",
"Color",
@@ -79,15 +87,18 @@ namespace {
};
} // namespace
Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict)
Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict,
LayerGroup& parent)
: properties::PropertyOwner({
layerDict.value<std::string>(keyName),
layerDict.hasKey(keyDescription) ? layerDict.value<std::string>(keyDescription) : ""
})
, _parent(parent)
, _typeOption(TypeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _blendModeOption(BlendModeInfo, properties::OptionProperty::DisplayType::Dropdown)
, _enabled(EnabledInfo, false)
, _reset(ResetInfo)
, _remove(RemoveInfo)
, _tileProvider(nullptr)
, _otherTypesProperties({
{ ColorInfo, glm::vec4(1.f), glm::vec4(0.f), glm::vec4(1.f) }
@@ -160,6 +171,14 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict)
}
});
_remove.onChange([&](){
if (_tileProvider) {
_tileProvider->reset();
}
_parent.deleteLayer(name());
});
_typeOption.onChange([&](){
removeVisibleProperties();
_type = static_cast<layergroupid::TypeID>(_typeOption.value());
@@ -190,6 +209,7 @@ Layer::Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict)
addProperty(_blendModeOption);
addProperty(_enabled);
addProperty(_reset);
addProperty(_remove);
_otherTypesProperties.color.setViewOption(properties::Property::ViewOptions::Color);
@@ -39,6 +39,8 @@
namespace openspace::globebrowsing {
struct LayerGroup;
namespace tileprovider { class TileProvider; }
class Layer : public properties::PropertyOwner {
@@ -51,7 +53,7 @@ public:
properties::Vec3Property color;
};
Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict);
Layer(layergroupid::GroupID id, const ghoul::Dictionary& layerDict, LayerGroup& parent);
ChunkTilePile getChunkTilePile(const TileIndex& tileIndex, int pileSize) const;
Tile::Status getTileStatus(const TileIndex& index) const;
@@ -81,11 +83,14 @@ private:
void initializeBasedOnType(layergroupid::TypeID typeId, ghoul::Dictionary initDict);
void addVisibleProperties();
void removeVisibleProperties();
LayerGroup& _parent;
properties::OptionProperty _typeOption;
properties::OptionProperty _blendModeOption;
properties::BoolProperty _enabled;
properties::TriggerProperty _reset;
properties::TriggerProperty _remove;
layergroupid::TypeID _type;
std::shared_ptr<tileprovider::TileProvider> _tileProvider;
@@ -95,7 +95,7 @@ void LayerGroup::addLayer(const ghoul::Dictionary& layerDict) {
LERROR("'Name' must be specified for layer.");
return;
}
auto layer = std::make_shared<Layer>(_groupId, layerDict);
auto layer = std::make_shared<Layer>(_groupId, layerDict, *this);
layer->onChange(_onChangeCallback);
if (hasPropertySubOwner(layer->name())) {
LINFO("Layer with name " + layer->name() + " already exists.");