From d3909c5d275012262baf671333490d0f7db242fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A5l=20Hagen?= Date: Fri, 11 Sep 2015 10:44:10 +0200 Subject: [PATCH] (#437) Using MD or TVD depth values for well log extraction curves Also renamed some methods for clarity, and fixed a bug in RimWellLogPlot::updateViewerWidget(). Using this method instead of loadDataAndUpdate() when toggling visibility of the plot. --- .../Commands/RicDeleteItemExec.cpp | 2 +- .../RimWellLogExtractionCurve.cpp | 13 ++++---- .../RimWellLogExtractionCurve.h | 1 + .../ProjectDataModel/RimWellLogPlot.cpp | 30 +++++++++++++++---- .../ProjectDataModel/RimWellLogPlot.h | 3 ++ .../ProjectDataModel/RimWellLogPlotTrace.cpp | 12 ++++---- .../ProjectDataModel/RimWellLogPlotTrace.h | 4 +-- .../UserInterface/RiuWellLogPlot.cpp | 2 +- .../UserInterface/RiuWellLogPlot.h | 2 +- 9 files changed, 48 insertions(+), 21 deletions(-) diff --git a/ApplicationCode/Commands/RicDeleteItemExec.cpp b/ApplicationCode/Commands/RicDeleteItemExec.cpp index bcad860806..46ec5a26fc 100644 --- a/ApplicationCode/Commands/RicDeleteItemExec.cpp +++ b/ApplicationCode/Commands/RicDeleteItemExec.cpp @@ -120,7 +120,7 @@ void RicDeleteItemExec::redo() parentObj->firstAnchestorOrThisOfType(wellLogPlotTrace); if (wellLogPlotTrace) { - wellLogPlotTrace->updateAxisRanges(); + wellLogPlotTrace->updateAxisRangesAndReplot(); } RimWellLogPlotCollection* wellLogPlotCollection = NULL; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp index a68e6d1ef2..ac790780f2 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.cpp @@ -32,9 +32,9 @@ #include "RigCaseCellResultsData.h" #include "RigCaseData.h" #include "RimWellLogPlotCurve.h" - #include "RimWellLogPlot.h" #include "RimWellLogPlotTrace.h" + #include "RiuWellLogTracePlot.h" #include "qwt_plot_curve.h" #include "RimWellLogPlotCollection.h" @@ -90,7 +90,7 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan { RimWellLogPlotCurve::fieldChangedByUi(changedField, oldValue, newValue); - if (changedField == &m_case) + if (changedField == &m_case) { this->updatePlotData(); } @@ -104,7 +104,6 @@ void RimWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* chan { this->updatePlotData(); } - } //-------------------------------------------------------------------------------------------------- @@ -136,7 +135,11 @@ void RimWellLogExtractionCurve::updatePlotData() if (eclExtractor.notNull()) { - const std::vector& depthValues = eclExtractor->measuredDepth(); + RimWellLogPlot* wellLogPlot; + firstAnchestorOrThisOfType(wellLogPlot); + CVF_ASSERT(wellLogPlot); + + const std::vector& depthValues = wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH ? eclExtractor->measuredDepth() : eclExtractor->trueVerticalDepth(); RifReaderInterface::PorosityModelResultType porosityModel = RigCaseCellResultsData::convertFromProjectModelPorosityModel(m_eclipseResultDefinition->porosityModel()); m_eclipseResultDefinition->loadResult(); @@ -192,7 +195,7 @@ void RimWellLogExtractionCurve::updatePlotData() } else if (plotTrace->curveCount() == 1) { - plotTrace->updateAxisRanges(); + plotTrace->updateAxisRangesAndReplot(); } } } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h index 9434a79f4a..1d5da873dc 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurve.h @@ -38,6 +38,7 @@ class RimWellLogExtractionCurve : public RimWellLogPlotCurve public: RimWellLogExtractionCurve(); virtual ~RimWellLogExtractionCurve(); + virtual void updatePlotData(); protected: diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 40bc780717..6bfcebd699 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -101,11 +101,11 @@ void RimWellLogPlot::updateViewerWidget() m_viewer = new RiuWellLogPlot(this, RiuMainWindow::instance()); recreateTracePlots(); + + RiuMainWindow::instance()->addViewer(m_viewer, windowGeometry()); + RiuMainWindow::instance()->setActiveViewer(m_viewer); } - RiuMainWindow::instance()->addViewer(m_viewer, windowGeometry()); - RiuMainWindow::instance()->setActiveViewer(m_viewer); - updateAxisRanges(); updateViewerWidgetWindowTitle(); } else @@ -130,7 +130,7 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { if (changedField == &m_showWindow) { - updateViewerWidget(); + loadDataAndUpdate(); } else if (changedField == &m_minimumVisibleDepth || changedField == &m_maximumVisibleDepth) { @@ -140,6 +140,10 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c { updateViewerWidgetWindowTitle(); } + if (changedField == &m_depthType) + { + updateTraces(); + } } //-------------------------------------------------------------------------------------------------- @@ -289,7 +293,14 @@ void RimWellLogPlot::setupBeforeSave() void RimWellLogPlot::loadDataAndUpdate() { updateViewerWidget(); + updateTraces(); +} +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RimWellLogPlot::updateTraces() +{ for (size_t tIdx = 0; tIdx < traces.size(); ++tIdx) { traces[tIdx]->loadDataAndUpdate(); @@ -299,6 +310,7 @@ void RimWellLogPlot::loadDataAndUpdate() updateAxisRanges(); } + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -309,7 +321,7 @@ void RimWellLogPlot::updateAxisRanges() double minDepth = m_minimumVisibleDepth < HUGE_VAL ? m_minimumVisibleDepth : RI_LOGPLOT_MINDEPTH_DEFAULT; double maxDepth = m_maximumVisibleDepth > -HUGE_VAL ? m_maximumVisibleDepth : RI_LOGPLOT_MAXDEPTH_DEFAULT; - m_viewer->setDepthRange(minDepth, maxDepth); + m_viewer->setDepthRangeAndReplot(minDepth, maxDepth); } } @@ -391,3 +403,11 @@ void RimWellLogPlot::handleViewerDeletion() uiCapability()->updateUiIconFromToggleField(); updateConnectedEditors(); } + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const +{ + return m_depthType.value(); +} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index af47a72a41..d19b9739c0 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -56,6 +56,7 @@ public: size_t traceCount() { return traces.size();} void loadDataAndUpdate(); + void updateTraces(); RiuWellLogPlot* viewer(); @@ -71,6 +72,8 @@ public: void updateAxisRanges(); void setVisibleDepthRangeFromContents(); + DepthTypeEnum depthType() const; + virtual caf::PdmFieldHandle* userDescriptionField() { return &m_userName; } protected: diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp index 4d626308b9..d14443fa7d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.cpp @@ -44,8 +44,8 @@ RimWellLogPlotTrace::RimWellLogPlotTrace() { CAF_PDM_InitObject("Trace", "", "", ""); - CAF_PDM_InitField(&show, "Show", true, "Show trace", "", "", ""); - show.uiCapability()->setUiHidden(true); + CAF_PDM_InitField(&m_show, "Show", true, "Show trace", "", "", ""); + m_show.uiCapability()->setUiHidden(true); CAF_PDM_InitFieldNoDefault(&curves, "Curves", "", "", "", ""); curves.uiCapability()->setUiHidden(true); @@ -67,9 +67,9 @@ RimWellLogPlotTrace::~RimWellLogPlotTrace() //-------------------------------------------------------------------------------------------------- void RimWellLogPlotTrace::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) { - if (changedField == &show) + if (changedField == &m_show) { - if (m_viewer) m_viewer->setVisible(show()); + if (m_viewer) m_viewer->setVisible(m_show()); } else if (changedField == &m_minimumValue || changedField == &m_maximumValue) { @@ -83,7 +83,7 @@ void RimWellLogPlotTrace::fieldChangedByUi(const caf::PdmFieldHandle* changedFie //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimWellLogPlotTrace::objectToggleField() { - return &show; + return &m_show; } //-------------------------------------------------------------------------------------------------- @@ -195,7 +195,7 @@ void RimWellLogPlotTrace::detachAllCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotTrace::updateAxisRanges() +void RimWellLogPlotTrace::updateAxisRangesAndReplot() { bool rangesChanged = false; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h index de102e31ac..0c89d14ec3 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotTrace.h @@ -50,7 +50,7 @@ public: void loadDataAndUpdate(); bool availableDepthRange(double* minimumDepth, double* maximumDepth); - void updateAxisRanges(); + void updateAxisRangesAndReplot(); RiuWellLogTracePlot* viewer(); @@ -61,7 +61,7 @@ protected: virtual caf::PdmFieldHandle* objectToggleField(); private: - caf::PdmField show; + caf::PdmField m_show; caf::PdmChildArrayField curves; caf::PdmField m_minimumValue; caf::PdmField m_maximumValue; diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index 1270bd1cc1..4ab03f4d0d 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -76,7 +76,7 @@ void RiuWellLogPlot::insertTracePlot(RiuWellLogTracePlot* tracePlot) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::setDepthRange(double minDepth, double maxDepth) +void RiuWellLogPlot::setDepthRangeAndReplot(double minDepth, double maxDepth) { for (int tpIdx = 0; tpIdx < m_tracePlots.count(); tpIdx++) { diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.h b/ApplicationCode/UserInterface/RiuWellLogPlot.h index 2153da3141..60c9ce0923 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.h @@ -46,7 +46,7 @@ public: void insertTracePlot(RiuWellLogTracePlot* tracePlot); - void setDepthRange(double minDepth, double maxDepth); + void setDepthRangeAndReplot(double minDepth, double maxDepth); private: void updateScrollBar(double minDepth, double maxDepth);