mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
(#500) Improved curve data property panel
Show curve data group first Hide auto name properties when custom name is defined
This commit is contained in:
@@ -40,20 +40,20 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
|
||||
|
||||
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
|
||||
m_showCurve.uiCapability()->setUiHidden(true);
|
||||
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitFieldNoDefault(&m_generatedCurveName, "GeneratedCurveName", "Autogenerated Name", "", "", "");
|
||||
m_generatedCurveName.uiCapability()->setUiReadOnly(true);
|
||||
m_generatedCurveName.xmlCapability()->setIOReadable(false);
|
||||
m_generatedCurveName.xmlCapability()->setIOWritable(false);
|
||||
|
||||
CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Show Custom Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_curveName, "CurveName", "Curve Name", "", "", "");
|
||||
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Name", "", "", "");
|
||||
m_customCurveName.uiCapability()->setUiHidden(true);
|
||||
|
||||
CAF_PDM_InitField(&m_autoName, "AutoName", true, "Auto Name", "", "", "");
|
||||
|
||||
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
|
||||
|
||||
m_plotCurve = new RiuWellLogPlotCurve;
|
||||
m_plotCurve->setXAxis(QwtPlot::xTop);
|
||||
m_plotCurve->setYAxis(QwtPlot::yLeft);
|
||||
|
||||
m_plot = NULL;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -62,7 +62,7 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
|
||||
RimWellLogPlotCurve::~RimWellLogPlotCurve()
|
||||
{
|
||||
m_plotCurve->detach();
|
||||
m_plot->replot();
|
||||
if (m_plot) m_plot->replot();
|
||||
|
||||
delete m_plotCurve;
|
||||
}
|
||||
@@ -76,24 +76,28 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
|
||||
{
|
||||
this->updateCurveVisibility();
|
||||
}
|
||||
|
||||
if (changedField == &m_customCurveName)
|
||||
else if (changedField == &m_curveName)
|
||||
{
|
||||
m_customCurveName = m_curveName;
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
if (&m_curveColor == changedField)
|
||||
else if (&m_curveColor == changedField)
|
||||
{
|
||||
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
|
||||
}
|
||||
|
||||
if (changedField == &m_useCustomCurveName)
|
||||
else if (changedField == &m_autoName)
|
||||
{
|
||||
updatePlotTitle();
|
||||
if (!m_autoName)
|
||||
{
|
||||
m_customCurveName = createCurveName();
|
||||
}
|
||||
|
||||
updateOptionSensitivity();
|
||||
updateCurveName();
|
||||
updatePlotTitle();
|
||||
}
|
||||
|
||||
m_plot->replot();
|
||||
if (m_plot) m_plot->replot();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -109,7 +113,7 @@ caf::PdmFieldHandle* RimWellLogPlotCurve::objectToggleField()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::updateCurveVisibility()
|
||||
{
|
||||
if (m_showCurve())
|
||||
if (m_showCurve() && m_plot)
|
||||
{
|
||||
m_plotCurve->attach(m_plot);
|
||||
}
|
||||
@@ -125,6 +129,7 @@ void RimWellLogPlotCurve::updateCurveVisibility()
|
||||
void RimWellLogPlotCurve::updatePlotConfiguration()
|
||||
{
|
||||
this->updateCurveVisibility();
|
||||
this->updateCurveName();
|
||||
this->updatePlotTitle();
|
||||
|
||||
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
|
||||
@@ -149,14 +154,7 @@ void RimWellLogPlotCurve::setPlot(RiuWellLogTrackPlot* plot)
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
caf::PdmFieldHandle* RimWellLogPlotCurve::userDescriptionField()
|
||||
{
|
||||
if (m_useCustomCurveName)
|
||||
{
|
||||
return &m_customCurveName;
|
||||
}
|
||||
else
|
||||
{
|
||||
return &m_generatedCurveName;
|
||||
}
|
||||
return &m_curveName;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -197,7 +195,6 @@ bool RimWellLogPlotCurve::valueRange(double* minimumValue, double* maximumValue)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -227,29 +224,7 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::updatePlotTitle()
|
||||
{
|
||||
m_generatedCurveName = this->createCurveName();
|
||||
|
||||
if (m_useCustomCurveName)
|
||||
{
|
||||
m_plotCurve->setTitle(m_customCurveName);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotCurve->setTitle(m_generatedCurveName);
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
|
||||
{
|
||||
caf::PdmUiGroup* group = uiOrdering.addNewGroup("Curve Display Name");
|
||||
group->add(&m_generatedCurveName);
|
||||
group->add(&m_useCustomCurveName);
|
||||
group->add(&m_customCurveName);
|
||||
|
||||
uiOrdering.add(&m_curveColor);
|
||||
m_plotCurve->setTitle(m_curveName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -265,23 +240,9 @@ bool RimWellLogPlotCurve::isCurveVisibile()
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::initAfterRead()
|
||||
{
|
||||
// TODO:
|
||||
// In RimWellLogFileCurve::createCurveName, the object being referenced is not initialized at this point
|
||||
// No name is read from file
|
||||
// How to fix?
|
||||
m_generatedCurveName = this->createCurveName();
|
||||
|
||||
updateOptionSensitivity();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::updateOptionSensitivity()
|
||||
{
|
||||
m_customCurveName.uiCapability()->setUiReadOnly(!m_useCustomCurveName);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -307,3 +268,26 @@ void RimWellLogPlotCurve::updateTrackAndPlotFromCurveData()
|
||||
plotTrack->updateAxisRangesAndReplot();
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::updateCurveName()
|
||||
{
|
||||
if (m_autoName)
|
||||
{
|
||||
m_curveName = this->createCurveName();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_curveName = m_customCurveName;
|
||||
}
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogPlotCurve::updateOptionSensitivity()
|
||||
{
|
||||
m_curveName.uiCapability()->setUiReadOnly(m_autoName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user