From b60059dee3826a171f6677c39cbcd503d58a7bbb Mon Sep 17 00:00:00 2001 From: Pascal Engeler <engelerp@phys.ethz.ch> Date: Tue, 10 Aug 2021 18:22:07 +0200 Subject: [PATCH] Structures set frequency, changed labels --- src/gui_handler.cpp | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/src/gui_handler.cpp b/src/gui_handler.cpp index 10a28e8..c90bf44 100644 --- a/src/gui_handler.cpp +++ b/src/gui_handler.cpp @@ -309,6 +309,7 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_LATTICE }); + tb.source_frequency = 5.f; } ImGui::SameLine(); if (ImGui::ImageButton((void*)(btex_waveguide_off_), ImVec2(140, 140))) { @@ -316,6 +317,7 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_WAVEGUIDE }); + tb.source_frequency = 5.f; } ImGui::Dummy(ImVec2(40, 0)); ImGui::SameLine(); @@ -329,6 +331,7 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_SINGLESLIT }); + tb.source_frequency = 5.f; } ImGui::SameLine(); if (ImGui::ImageButton((void*)(btex_doubleslit_off_), ImVec2(140, 140))) { @@ -336,6 +339,7 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_DOUBLESLIT }); + tb.source_frequency = 5.f; } ImGui::Dummy(ImVec2(40, 0)); ImGui::SameLine(); @@ -349,6 +353,7 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_SSH }); + tb.source_frequency = 1.424f; } ImGui::SameLine(); if (ImGui::ImageButton((void*)(btex_fresnel_off_), ImVec2(140, 140))) { @@ -356,14 +361,15 @@ void GuiHandler::draw_gui_(Toolbox& tb) { tb.mailbox.push_back({ WAVEMESSAGE::RESET_WAVE }); tb.mailbox.push_back({ DRAWERMESSAGE::CLEAR }); tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_FRESNEL }); + tb.source_frequency = 5.f; } - ImGui::Dummy(ImVec2(40, 0)); + ImGui::Dummy(ImVec2(20, 0)); ImGui::SameLine(); - ImGui::Text("SSH"); + ImGui::Text("Metamaterial"); ImGui::SameLine(); - ImGui::Dummy(ImVec2(70, 0)); + ImGui::Dummy(ImVec2(23, 0)); ImGui::SameLine(); - ImGui::Text("Fresnel"); + ImGui::Text("Fresnellinse"); /* if (ImGui::Button("LATTICE", ImVec2(140, 140))) { tb.mailbox.push_back({ BLOCKCHAINMESSAGE::PATTERN_LATTICE }); @@ -413,10 +419,14 @@ void GuiHandler::draw_gui_(Toolbox& tb) { /*Frequency Selection*/ ImGui::Text("1 Hz"); ImGui::SameLine(); - ImGui::Dummy(ImVec2(150, 0)); + ImGui::Dummy(ImVec2(70, 0)); + ImGui::SameLine(); + ImGui::Text("f"); + ImGui::SameLine(); + ImGui::Dummy(ImVec2(70, 0)); ImGui::SameLine(); ImGui::Text("10 Hz"); - ImGui::SliderFloat("f / L", &tb.source_frequency, 1.f, 10.f); + ImGui::SliderFloat("", &tb.source_frequency, 1.424f, 10.f); std::vector<float> wave_1; for (float t = 0; t < 1.f; t += .05f) { wave_1.push_back(std::sin(2.*3.1415*t)); @@ -426,7 +436,11 @@ void GuiHandler::draw_gui_(Toolbox& tb) { ImGui::PushStyleColor(ImGuiCol_PlotLines, { 169./256.,218./256.,224./256.,1. }); ImGui::PlotLines("", wave_1.data(), wave_1.size()); ImGui::SameLine(); - ImGui::Dummy(ImVec2(120, 0)); + ImGui::Dummy(ImVec2(70, 0)); + ImGui::SameLine(); + ImGui::Text("L"); + ImGui::SameLine(); + ImGui::Dummy(ImVec2(70, 0)); ImGui::SameLine(); wave_1.clear(); for (float t = 0; t < 1.f; t += .05f) { -- GitLab