diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp index 5b580285bc..75c407c121 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.cpp @@ -32,6 +32,7 @@ #include "DockManager.h" #include "DockWidget.h" +#include "cafPdmOptionItemInfo.h" #include "cafPdmUiCheckBoxEditor.h" #include "cafPdmUiTreeOrdering.h" #include "cafSelectionManager.h" @@ -108,6 +109,8 @@ RimRftCorrelationReportPlot::RimRftCorrelationReportPlot() CAF_PDM_InitFieldNoDefault( &m_parameterRftCrossPlot, "ParameterRftCrossPlot", "Cross Plot" ); CAF_PDM_InitFieldNoDefault( &m_tornadoPlot, "TornadoPlot", "Tornado Plot" ); + CAF_PDM_InitField( &m_depthType, "DepthType", caf::AppEnum( RiaDefines::DepthType::TRUE_VERTICAL_DEPTH ), "Depth Unit" ); + CAF_PDM_InitField( &m_showDockTitleBars, "ShowDockTitleBars", false, "Show Title Bars" ); caf::PdmUiNativeCheckBoxEditor::configureFieldForEditor( &m_showDockTitleBars ); @@ -127,6 +130,8 @@ RimRftCorrelationReportPlot::RimRftCorrelationReportPlot() m_tornadoPlot = new RimRftTornadoPlot; m_tornadoPlot->setParameterSelectedCallback( [this]( const QString& paramName ) { onTornadoParameterSelected( paramName ); } ); + + applyDepthTypeToSubPlots(); } //-------------------------------------------------------------------------------------------------- @@ -187,6 +192,8 @@ void RimRftCorrelationReportPlot::initializeFromSourcePlot( RimWellRftPlot* sour { if ( !source ) return; + applyDepthTypeToSubPlots(); + m_wellRftPlot->setSimWellOrWellPathName( source->simWellOrWellPathName() ); // A fresh RimWellRftPlot has no tracks; syncCurvesFromUiSelection exits early without one. @@ -349,6 +356,8 @@ void RimRftCorrelationReportPlot::initAfterRead() m_wellRftPlot->detachFromDockPermanently(); m_wellRftPlot->setShowWindow( true ); } + + applyDepthTypeToSubPlots(); } //-------------------------------------------------------------------------------------------------- @@ -404,6 +413,8 @@ void RimRftCorrelationReportPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimRftCorrelationReportPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { + uiOrdering.add( &m_depthType ); + // Delegate cross-plot settings (ensemble, well, depth range, parameter) to the cross plot m_parameterRftCrossPlot->uiOrdering( uiConfigName, uiOrdering ); @@ -435,6 +446,10 @@ void RimRftCorrelationReportPlot::fieldChangedByUi( const caf::PdmFieldHandle* c updateDockTitleBarsVisibility(); return; } + if ( changedField == &m_depthType ) + { + applyDepthTypeToSubPlots(); + } loadDataAndUpdate(); } @@ -522,6 +537,36 @@ void RimRftCorrelationReportPlot::syncTornadoInputsFromCrossPlot() m_tornadoPlot->setDepthRange( m_parameterRftCrossPlot->depthRangeMin(), m_parameterRftCrossPlot->depthRangeMax() ); } +//-------------------------------------------------------------------------------------------------- +/// Pushes the selected depth unit (MD/TVD) down to the sub plots that present a depth axis. +//-------------------------------------------------------------------------------------------------- +void RimRftCorrelationReportPlot::applyDepthTypeToSubPlots() +{ + if ( !m_wellRftPlot() ) return; + + m_wellRftPlot->setAvailableDepthTypes( { RiaDefines::DepthType::MEASURED_DEPTH, RiaDefines::DepthType::TRUE_VERTICAL_DEPTH } ); + m_wellRftPlot->setDepthType( m_depthType() ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +QList RimRftCorrelationReportPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) +{ + QList options; + + if ( fieldNeedingOptions == &m_depthType ) + { + using DepthAppEnum = caf::AppEnum; + for ( auto depthType : { RiaDefines::DepthType::MEASURED_DEPTH, RiaDefines::DepthType::TRUE_VERTICAL_DEPTH } ) + { + options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( depthType ), depthType ) ); + } + } + + return options; +} + //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.h b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.h index 2f7beb4415..c162a11fb8 100644 --- a/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.h +++ b/ApplicationLibCode/ProjectDataModel/CorrelationPlots/RimRftCorrelationReportPlot.h @@ -17,9 +17,12 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once +#include "RiaDefines.h" + #include "RimPlotWindow.h" #include "RimReportPlotGroup.h" +#include "cafAppEnum.h" #include "cafPdmChildField.h" #include "cafPdmField.h" #include "cafPdmProxyValueField.h" @@ -80,11 +83,13 @@ private: void fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue ) override; void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; void doUpdateLayout() override {} + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions ) override; void updateDockTitleBarsVisibility(); void syncCrossPlotSelectionToRftPlot(); void onTornadoParameterSelected( const QString& paramName ); void syncTornadoInputsFromCrossPlot(); + void applyDepthTypeToSubPlots(); private: caf::PdmProxyValueField m_name; @@ -93,6 +98,8 @@ private: caf::PdmChildField m_parameterRftCrossPlot; caf::PdmChildField m_tornadoPlot; + caf::PdmField> m_depthType; + caf::PdmField m_showDockTitleBars; caf::PdmField m_dockState;