diff --git a/Navigator/src/Navigator/Editor/SpectrumPanel.cpp b/Navigator/src/Navigator/Editor/SpectrumPanel.cpp index 5e6f59a..4adcca3 100644 --- a/Navigator/src/Navigator/Editor/SpectrumPanel.cpp +++ b/Navigator/src/Navigator/Editor/SpectrumPanel.cpp @@ -52,6 +52,11 @@ namespace Navigator { } ImGui::EndPopup(); } + ImGui::SameLine(); + if(ImGui::Button("Clear")) + { + HistogramMap::GetInstance().ClearHistogram(m_zoomedGram.name); + } if (ImPlot::BeginPlot(m_zoomedGram.name.c_str(), ImVec2(-1, -1))) { @@ -129,6 +134,11 @@ namespace Navigator { else { ImGui::SliderInt2("Rows, Columns", m_tableSizes, 1, 3); + ImGui::SameLine(); + if(ImGui::Button("Clear All")) + { + HistogramMap::GetInstance().ClearHistograms(); + } m_totalSlots = m_tableSizes[0] * m_tableSizes[1]; m_selectedGrams.resize(m_totalSlots); if (ImGui::BeginTable("Select Histograms", m_tableSizes[1])) diff --git a/Navigator/src/Navigator/HistogramMap.cpp b/Navigator/src/Navigator/HistogramMap.cpp index 4b19e47..0a775bf 100644 --- a/Navigator/src/Navigator/HistogramMap.cpp +++ b/Navigator/src/Navigator/HistogramMap.cpp @@ -74,6 +74,21 @@ namespace Navigator { pair.second->FillData(); } + void HistogramMap::ClearHistograms() + { + std::lock_guard guard(m_histoMutex); + for(auto& pair : m_map) + pair.second->ClearData(); + } + + void HistogramMap::ClearHistogram(const std::string& name) + { + std::lock_guard guard(m_histoMutex); + auto iter = m_map.find(name); + if(iter != m_map.end()) + iter->second->ClearData(); + } + const HistogramParameters& HistogramMap::GetHistogramParams(const std::string& name) { diff --git a/Navigator/src/Navigator/HistogramMap.h b/Navigator/src/Navigator/HistogramMap.h index d452b58..ad3dffb 100644 --- a/Navigator/src/Navigator/HistogramMap.h +++ b/Navigator/src/Navigator/HistogramMap.h @@ -26,6 +26,8 @@ namespace Navigator { void RemoveCutFromHistograms(const std::string& cutname); void UpdateHistograms(); + void ClearHistograms(); + void ClearHistogram(const std::string& name); void DrawHistograms(); void DrawHistogram(const std::string& name);