(#455) Improved use of Custom Curve Name

This commit is contained in:
Magne Sjaastad 2015-09-18 13:43:09 +02:00
parent 842363eebd
commit 4ea3387e79
4 changed files with 45 additions and 9 deletions

View File

@ -217,7 +217,6 @@ void RimWellLogExtractionCurve::updatePlotData()
}
}
updatePlotTitle();
m_plot->replot();
}
}

View File

@ -127,7 +127,6 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
if (changedField == &m_wellPath)
{
this->updatePlotTitle();
this->updatePlotData();
if (wellLoglot)
@ -143,7 +142,6 @@ void RimWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
}
else if (changedField == &m_wellLogChannnelName)
{
this->updatePlotTitle();
this->updatePlotData();
if (wellLoglot)
@ -240,6 +238,17 @@ QList<caf::PdmOptionItemInfo> RimWellLogFileCurve::calculateValueOptions(const c
//--------------------------------------------------------------------------------------------------
QString RimWellLogFileCurve::createCurveName()
{
return "The method or operation is not implemented.";
if (m_wellPath())
{
QString txt;
txt += m_wellPath()->name();
txt += " : ";
txt += m_wellLogChannnelName;
return txt;
}
return "Empty curve";
}

View File

@ -38,14 +38,14 @@ RimWellLogPlotCurve::RimWellLogPlotCurve()
CAF_PDM_InitField(&m_showCurve, "Show", true, "Show curve", "", "", "");
m_showCurve.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_customCurveName, "CurveDescription", "Custom Curve Name", "", "", "");
CAF_PDM_InitFieldNoDefault(&m_generatedCurveName, "GeneratedCurveName", "Generated Curve Name", "", "", "");
m_generatedCurveName.uiCapability()->setUiReadOnly(true);
m_generatedCurveName.xmlCapability()->setIOReadable(false);
m_generatedCurveName.xmlCapability()->setIOWritable(false);
CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Custom Curve Name", "", "", "");
CAF_PDM_InitField(&m_useCustomCurveName, "UseCustomCurveName", false, "Show Custom Curve Name", "", "", "");
CAF_PDM_InitField(&m_curveColor, "Color", cvf::Color3f(cvf::Color3::BLACK), "Color", "", "", "");
@ -88,6 +88,7 @@ void RimWellLogPlotCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedFie
if (changedField == &m_useCustomCurveName)
{
updatePlotTitle();
updateOptionSensitivity();
}
m_plot->replot();
@ -122,6 +123,7 @@ void RimWellLogPlotCurve::updateCurveVisibility()
void RimWellLogPlotCurve::updatePlotConfiguration()
{
this->updateCurveVisibility();
this->updatePlotTitle();
m_plotCurve->setPen(QPen(QColor(m_curveColor.value().rByte(), m_curveColor.value().gByte(), m_curveColor.value().bByte())));
// Todo: Rest of the curve setup controlled from this class
@ -223,13 +225,14 @@ QwtPlotCurve* RimWellLogPlotCurve::plotCurve() const
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::updatePlotTitle()
{
m_generatedCurveName = this->createCurveName();
if (m_useCustomCurveName)
{
m_plotCurve->setTitle(m_customCurveName);
}
else
{
m_generatedCurveName = this->createCurveName();
m_plotCurve->setTitle(m_generatedCurveName);
}
}
@ -239,9 +242,9 @@ void RimWellLogPlotCurve::updatePlotTitle()
//--------------------------------------------------------------------------------------------------
void RimWellLogPlotCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering)
{
uiOrdering.add(&m_customCurveName);
uiOrdering.add(&m_generatedCurveName);
uiOrdering.add(&m_useCustomCurveName);
uiOrdering.add(&m_customCurveName);
uiOrdering.add(&m_curveColor);
}
@ -252,3 +255,25 @@ bool RimWellLogPlotCurve::isCurveVisibile()
{
return m_showCurve;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
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);
}

View File

@ -53,6 +53,8 @@ public:
QwtPlotCurve* plotCurve() const;
void updatePlotTitle();
virtual void updatePlotData() = 0;
protected:
@ -60,13 +62,14 @@ protected:
void updatePlotConfiguration();
void updateCurveVisibility();
void updatePlotTitle();
void updateOptionSensitivity();
// Overridden PDM methods
virtual void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue);
virtual caf::PdmFieldHandle* objectToggleField();
virtual caf::PdmFieldHandle* userDescriptionField();
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering);
virtual void initAfterRead();
RiuWellLogTrackPlot* m_plot;