Commit d6dd1575 authored by Alexander Bock's avatar Alexander Bock
Browse files

Adapt the ImGui GIBS panel to the new tileprovider format (closes #2108)

parent 6189985e
Showing with 29 additions and 8 deletions
+29 -8
......@@ -24,7 +24,7 @@
namespace {
//Adds a new dashboard item to an existing SceenSpaceDashboard.
// Adds a new dashboard item to an existing SceenSpaceDashboard.
[[codegen::luawrap]] void addDashboardItemToScreenSpace(std::string identifier,
ghoul::Dictionary dashboard)
{
......
......@@ -104,6 +104,7 @@ void GuiGIBSComponent::render() {
ImGui::InputText("Image Format", ImageFormatBuffer.data(), ImageFormatBuffer.size());
if (ImGui::Button("Add Layer")) {
// Extract values from the ImGui fields
std::string layer = std::string(LayerBuffer.data());
std::string startDate = std::string(StartDateBuffer.data());
std::string endDate = std::string(EndDateBuffer.data());
......@@ -112,17 +113,37 @@ void GuiGIBSComponent::render() {
std::string imageRes = std::string(ImageResolutionBuffer.data());
std::string imageFormat = std::string(ImageFormatBuffer.data());
// Construct the components of the Lua function
std::string xmlFunc = fmt::format(
"openspace.globebrowsing.createTemporalGibsGdalXml("
"'{}', '{}', '{}', '{}', '{}', '{}', '{}')",
layer, startDate, endDate, temporalRes, imageRes, imageFormat, temporalFormat
"openspace.globebrowsing.createTemporalGibsGdalXml('{}', '{}', '{}')",
layer, imageRes, imageFormat
);
if (startDate == "Present") {
startDate.clear();
}
std::string layerScript = fmt::format(
"{{"
" Identifier = '{}',"
" Type = 'TemporalTileLayer',"
" Enabled = true,"
" Mode = 'Prototyped',"
" Prototyped = {{"
" Time = {{"
" Start = '{}',"
" End = '{}'"
" }},"
" TemporalResolution = '{}',"
" TimeFormat = '{}',"
" Prototype = {}"
" }}"
"}}",
layer, startDate, endDate, temporalRes, temporalFormat, xmlFunc
);
std::string script = fmt::format(
"openspace.globebrowsing.addLayer('Earth', 'ColorLayers', {{ "
"Identifier = '{}', Enabled = true, Type = 'TemporalTileLayer', "
"FilePath = {} }})",
layer, xmlFunc
"openspace.globebrowsing.addLayer('Earth', 'ColorLayers', {})",
layerScript
);
global::scriptEngine->queueScript(
script,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment