diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index ddf5ca51c1..04fafbad14 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -217,7 +217,6 @@ void RimWellLogExtractionCurve::updatePlotData() } } - updatePlotTitle(); m_plot->replot(); } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp index 23049387a8..89cf521f93 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurve.cpp @@ -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 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"; } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp index aca8538d4a..2f83445eea 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.cpp @@ -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); +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h index 3f4c6208c4..7c8082fee5 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotCurve.h @@ -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;