#1469 Add checkbox for legend visibility

This commit is contained in:
Magne Sjaastad
2017-05-11 21:44:44 +02:00
parent 764a68c032
commit 4204d49f30
4 changed files with 27 additions and 7 deletions

View File

@@ -26,6 +26,8 @@
#include "RiuFlowCharacteristicsPlot.h"
#include "cafPdmUiCheckBoxEditor.h"
#include <cmath> // Needed for HUGE_VAL on Linux
@@ -57,6 +59,8 @@ RimFlowCharacteristicsPlot::RimFlowCharacteristicsPlot()
CAF_PDM_InitFieldNoDefault(&m_timeStepSelectionType, "TimeSelectionType", "Time Steps", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "SelectedTimeSteps", "", "", "", "");
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Legend", "", "", "");
this->m_showWindow = false;
setAsPlotMdiWindow();
}
@@ -191,6 +195,8 @@ void RimFlowCharacteristicsPlot::defineUiOrdering(QString uiConfigName, caf::Pdm
if (m_timeStepSelectionType == SELECT_AVAILABLE) uiOrdering.add(&m_selectedTimeSteps);
uiOrdering.add(&m_showLegend);
uiOrdering.skipRemainingFields();
}
@@ -210,7 +216,6 @@ void RimFlowCharacteristicsPlot::zoomAll()
if (m_flowCharPlotWidget) m_flowCharPlotWidget->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -229,7 +234,6 @@ void RimFlowCharacteristicsPlot::fieldChangedByUi(const caf::PdmFieldHandle* cha
this->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -246,8 +250,6 @@ QImage RimFlowCharacteristicsPlot::snapshotWindowContent()
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -299,6 +301,7 @@ void RimFlowCharacteristicsPlot::loadDataAndUpdate()
flowCharResults.m_sweepEfficiencyCurve.second);
}
m_flowCharPlotWidget->showLegend(m_showLegend());
}
}

View File

@@ -86,6 +86,7 @@ private:
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<caf::AppEnum<TimeSelectionType> > m_timeStepSelectionType;
caf::PdmField<std::vector<int> > m_selectedTimeSteps;
caf::PdmField<bool> m_showLegend;
std::vector<int> m_currentlyPlottedTimeSteps;