2022-04-16 08:10:25 +02:00
|
|
|
#include "radiation_handler.h"
|
|
|
|
|
|
|
|
|
|
#include "core/config.h"
|
|
|
|
|
|
|
|
|
|
#include "resources.h"
|
|
|
|
|
|
|
|
|
|
namespace satdump
|
|
|
|
|
{
|
|
|
|
|
void RadiationViewerHandler::init()
|
|
|
|
|
{
|
|
|
|
|
products = (RadiationProducts *)ViewerHandler::products;
|
|
|
|
|
|
2022-05-12 18:19:01 +02:00
|
|
|
for (int c = 0; c < (int)products->channel_counts.size(); c++)
|
2022-04-16 08:10:25 +02:00
|
|
|
select_channel_image_str += "Channel " + std::to_string(c + 1) + '\0';
|
|
|
|
|
|
|
|
|
|
update();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RadiationViewerHandler::update()
|
|
|
|
|
{
|
|
|
|
|
if (selected_visualization_id == 0)
|
|
|
|
|
{
|
2022-05-21 13:41:21 +02:00
|
|
|
|
|
|
|
|
RadiationMapCfg cfg;
|
|
|
|
|
cfg.channel = select_channel_image_id + 1;
|
|
|
|
|
cfg.radius = 5;
|
|
|
|
|
cfg.min = map_min;
|
|
|
|
|
cfg.max = map_max;
|
|
|
|
|
image::Image<uint16_t> map = make_radiation_map(*products, cfg);
|
2022-04-16 08:10:25 +02:00
|
|
|
image_view.update(map);
|
|
|
|
|
}
|
|
|
|
|
else if (selected_visualization_id == 1)
|
|
|
|
|
{
|
|
|
|
|
graph_values.resize(products->channel_counts.size());
|
2022-05-12 18:19:01 +02:00
|
|
|
for (int c = 0; c < (int)products->channel_counts.size(); c++)
|
2022-04-16 08:10:25 +02:00
|
|
|
{
|
2022-05-12 18:19:01 +02:00
|
|
|
for (int i = 0; i < (int)products->channel_counts[c].size(); i++)
|
2022-04-16 08:10:25 +02:00
|
|
|
graph_values[c].push_back(products->channel_counts[c][i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RadiationViewerHandler::drawMenu()
|
|
|
|
|
{
|
|
|
|
|
if (ImGui::CollapsingHeader("Vizualisation"))
|
|
|
|
|
{
|
|
|
|
|
if (ImGui::RadioButton("Map", &selected_visualization_id, 0))
|
|
|
|
|
update();
|
|
|
|
|
if (ImGui::RadioButton("Graph", &selected_visualization_id, 1))
|
|
|
|
|
update();
|
|
|
|
|
|
|
|
|
|
if (selected_visualization_id == 0)
|
|
|
|
|
{
|
|
|
|
|
if (ImGui::Combo("###mapchannelcomboid", &select_channel_image_id, select_channel_image_str.c_str()))
|
|
|
|
|
update();
|
|
|
|
|
ImGui::InputInt("Min", &map_min);
|
|
|
|
|
ImGui::InputInt("Max", &map_max);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RadiationViewerHandler::drawContents(ImVec2 win_size)
|
|
|
|
|
{
|
|
|
|
|
if (selected_visualization_id == 0)
|
|
|
|
|
{
|
|
|
|
|
image_view.draw(win_size);
|
|
|
|
|
}
|
|
|
|
|
else if (selected_visualization_id == 1)
|
|
|
|
|
{
|
|
|
|
|
ImGui::BeginChild("RadiationPlotChild");
|
2022-05-12 18:19:01 +02:00
|
|
|
for (int i = 0; i < (int)products->channel_counts.size(); i++)
|
2022-04-16 08:10:25 +02:00
|
|
|
ImGui::PlotLines(std::string("Channel " + std::to_string(i + 1)).c_str(), graph_values[i].data(), graph_values[i].size());
|
|
|
|
|
ImGui::EndChild();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
float RadiationViewerHandler::drawTreeMenu()
|
|
|
|
|
{
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
|
|
|
|
}
|