1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-23 02:38:52 -05:00

Fixed serialization such that all existing spectra and cuts are wiped out before loading new file. Removed a few logs that are no longer relevant

This commit is contained in:
Gordon McCann 2022-02-23 20:54:53 -05:00
parent d103d53384
commit d93ba5b97e
3 changed files with 8 additions and 2 deletions

View File

@ -55,7 +55,6 @@ namespace Navigator {
SpectrumManager::GetInstance().DrawHistogram(m_zoomedGram.name); SpectrumManager::GetInstance().DrawHistogram(m_zoomedGram.name);
if (!m_cutModeFlag && ImPlot::IsPlotHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) if (!m_cutModeFlag && ImPlot::IsPlotHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
{ {
NAV_INFO("We lost 'em, de-zoom and enhance!");
m_zoomedFlag = false; m_zoomedFlag = false;
m_zoomedGram = HistogramParameters(); m_zoomedGram = HistogramParameters();
} }
@ -190,7 +189,6 @@ namespace Navigator {
SpectrumManager::GetInstance().DrawHistogram(spec.name); SpectrumManager::GetInstance().DrawHistogram(spec.name);
if (ImPlot::IsPlotHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left)) if (ImPlot::IsPlotHovered() && ImGui::IsMouseDoubleClicked(ImGuiMouseButton_Left))
{ {
NAV_INFO("We got'em boys, they're in plot {0}. Zoom and enhance!", i);
m_zoomedFlag = true; m_zoomedFlag = true;
m_zoomedGram = spec; m_zoomedGram = spec;
} }

View File

@ -19,6 +19,13 @@ namespace Navigator {
inline static SpectrumManager& GetInstance() { return *s_instance; } inline static SpectrumManager& GetInstance() { return *s_instance; }
inline void RemoveAllSpectra()
{
std::lock_guard<std::mutex> guard(m_managerMutex);
m_histoMap.clear();
m_cutMap.clear();
}
void AddHistogram(const HistogramParameters& params); void AddHistogram(const HistogramParameters& params);
void RemoveHistogram(const std::string& name); void RemoveHistogram(const std::string& name);
void AddCutToHistogramDraw(const std::string& cutname, const std::string& histoname); void AddCutToHistogramDraw(const std::string& cutname, const std::string& histoname);

View File

@ -122,6 +122,7 @@ namespace Navigator {
void SpectrumSerializer::DeserializeData() void SpectrumSerializer::DeserializeData()
{ {
SpectrumManager& manager = SpectrumManager::GetInstance(); SpectrumManager& manager = SpectrumManager::GetInstance();
manager.RemoveAllSpectra();
std::ifstream input(m_filename); std::ifstream input(m_filename);
if (!input.is_open()) if (!input.is_open())