1
0
Fork 0
mirror of https://github.com/gwm17/Specter.git synced 2024-11-22 18:28:52 -05:00

Added Clear and ClearAll Buttons and functionality to histograms.

This commit is contained in:
Gordon McCann 2022-02-05 23:26:33 -05:00
parent e8166cdbcd
commit 1aa7a41596
3 changed files with 27 additions and 0 deletions

View File

@ -52,6 +52,11 @@ namespace Navigator {
} }
ImGui::EndPopup(); 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))) if (ImPlot::BeginPlot(m_zoomedGram.name.c_str(), ImVec2(-1, -1)))
{ {
@ -129,6 +134,11 @@ namespace Navigator {
else else
{ {
ImGui::SliderInt2("Rows, Columns", m_tableSizes, 1, 3); 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_totalSlots = m_tableSizes[0] * m_tableSizes[1];
m_selectedGrams.resize(m_totalSlots); m_selectedGrams.resize(m_totalSlots);
if (ImGui::BeginTable("Select Histograms", m_tableSizes[1])) if (ImGui::BeginTable("Select Histograms", m_tableSizes[1]))

View File

@ -74,6 +74,21 @@ namespace Navigator {
pair.second->FillData(); pair.second->FillData();
} }
void HistogramMap::ClearHistograms()
{
std::lock_guard<std::mutex> guard(m_histoMutex);
for(auto& pair : m_map)
pair.second->ClearData();
}
void HistogramMap::ClearHistogram(const std::string& name)
{
std::lock_guard<std::mutex> 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) const HistogramParameters& HistogramMap::GetHistogramParams(const std::string& name)
{ {

View File

@ -26,6 +26,8 @@ namespace Navigator {
void RemoveCutFromHistograms(const std::string& cutname); void RemoveCutFromHistograms(const std::string& cutname);
void UpdateHistograms(); void UpdateHistograms();
void ClearHistograms();
void ClearHistogram(const std::string& name);
void DrawHistograms(); void DrawHistograms();
void DrawHistogram(const std::string& name); void DrawHistogram(const std::string& name);