From 67c5cc26b6a07df8b728822e5a5d537ec31f068a Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Wed, 20 Sep 2023 08:56:39 +0200 Subject: [PATCH] Cleanup --- .../Summary/RimSummaryCurve.cpp | 24 +++++++++---------- .../Summary/RimSummaryCurve.h | 14 +++++------ .../Summary/RimSummaryCurveAutoName.h | 3 +-- .../Summary/RimSummaryPlot.cpp | 22 +++++++---------- .../ProjectDataModel/Summary/RimSummaryPlot.h | 4 ++-- .../UserInterface/RiuQwtPlotWidget.cpp | 6 ----- 6 files changed, 29 insertions(+), 44 deletions(-) diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp index a824d9310e..26e506258a 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp @@ -59,8 +59,6 @@ #include "cafPdmUiPushButtonEditor.h" #include "cafPdmUiTreeOrdering.h" -#pragma optimize( "", off ) - CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" ); //-------------------------------------------------------------------------------------------------- @@ -94,7 +92,7 @@ RimSummaryCurve::RimSummaryCurve() // X Values - CAF_PDM_InitField( &m_axisType, + CAF_PDM_InitField( &m_xAxisType, "HorizontalAxisType", caf::AppEnum( RiaDefines::HorizontalAxisType::TIME ), "Axis Type" ); @@ -157,7 +155,7 @@ RimSummaryCurve::~RimSummaryCurve() RiaSummaryCurveDefinition RimSummaryCurve::curveDefinition() const { RiaSummaryCurveDefinition curveDefinition( summaryCaseY(), summaryAddressY(), isEnsembleCurve() ); - if ( m_axisType() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) + if ( m_xAxisType() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) { curveDefinition.setSummaryCaseX( summaryCaseX() ); curveDefinition.setSummaryAddressX( summaryAddressX() ); @@ -205,7 +203,7 @@ RimSummaryCase* RimSummaryCurve::summaryCaseY() const //-------------------------------------------------------------------------------------------------- RifEclipseSummaryAddress RimSummaryCurve::summaryAddressX() const { - if ( m_axisType == RiaDefines::HorizontalAxisType::TIME ) return RifEclipseSummaryAddress::timeAddress(); + if ( m_xAxisType == RiaDefines::HorizontalAxisType::TIME ) return RifEclipseSummaryAddress::timeAddress(); return m_xValuesSummaryAddress->address(); } @@ -440,7 +438,7 @@ void RimSummaryCurve::setOverrideCurveDataY( const std::vector& dateTime //-------------------------------------------------------------------------------------------------- void RimSummaryCurve::setAxisTypeX( RiaDefines::HorizontalAxisType axisType ) { - m_axisType = axisType; + m_xAxisType = axisType; } //-------------------------------------------------------------------------------------------------- @@ -448,7 +446,7 @@ void RimSummaryCurve::setAxisTypeX( RiaDefines::HorizontalAxisType axisType ) //-------------------------------------------------------------------------------------------------- RiaDefines::HorizontalAxisType RimSummaryCurve::axisTypeX() const { - return m_axisType(); + return m_xAxisType(); } //-------------------------------------------------------------------------------------------------- @@ -643,7 +641,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot ) bool shouldPopulateViewWithEmptyData = false; - if ( m_axisType == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) + if ( m_xAxisType == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) { auto curveValuesX = valuesX(); auto curveTimeStepsX = timeStepsX(); @@ -884,7 +882,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering { RimPlotCurve::updateFieldUiState(); - bool isSummaryXHidden = ( m_axisType() != RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ); + bool isSummaryXHidden = ( m_xAxisType() != RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ); m_xValuesSummaryCase.uiCapability()->setUiHidden( isSummaryXHidden ); m_xValuesSummaryAddress.uiCapability()->setUiHidden( isSummaryXHidden ); @@ -905,7 +903,7 @@ void RimSummaryCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering { caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Summary Vector X Axis" ); - curveDataGroup->add( &m_axisType, { true, 3, 1 } ); + curveDataGroup->add( &m_xAxisType, { true, 3, 1 } ); curveDataGroup->add( &m_xValuesSummaryCase, { true, 3, 1 } ); curveDataGroup->add( &m_xValuesSummaryAddressUiField, { true, 2, 1 } ); curveDataGroup->add( &m_xPushButtonSelectSummaryAddress, { false, 1, 0 } ); @@ -1118,13 +1116,13 @@ void RimSummaryCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { loadAndUpdate = true; } - else if ( &m_axisType == changedField ) + else if ( &m_xAxisType == changedField ) { - if ( m_axisType() == RiaDefines::HorizontalAxisType::TIME ) + if ( m_xAxisType() == RiaDefines::HorizontalAxisType::TIME ) { m_xPlotAxisProperties = plot->timeAxisProperties(); } - else if ( m_axisType() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) + else if ( m_xAxisType() == RiaDefines::HorizontalAxisType::SUMMARY_VECTOR ) { if ( !m_xValuesSummaryCase() ) { diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h index 16fee2d275..aaa9ed95b9 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h @@ -139,22 +139,20 @@ class RimSummaryCurve : public RimStackablePlotCurve private: // Y values - caf::PdmPtrField m_yValuesSummaryCase; - caf::PdmChildField m_yValuesSummaryAddress; - caf::PdmField m_yValuesSummaryAddressUiField; - caf::PdmField m_yPushButtonSelectSummaryAddress; - + caf::PdmPtrField m_yValuesSummaryCase; + caf::PdmChildField m_yValuesSummaryAddress; + caf::PdmField m_yValuesSummaryAddressUiField; + caf::PdmField m_yPushButtonSelectSummaryAddress; caf::PdmPtrField m_yPlotAxisProperties; caf::PdmField m_yValuesResampling; // X values - caf::PdmField> m_axisType; + caf::PdmField> m_xAxisType; caf::PdmPtrField m_xValuesSummaryCase; caf::PdmChildField m_xValuesSummaryAddress; caf::PdmField m_xValuesSummaryAddressUiField; caf::PdmField m_xPushButtonSelectSummaryAddress; - - caf::PdmPtrField m_xPlotAxisProperties; + caf::PdmPtrField m_xPlotAxisProperties; // Other fields caf::PdmField m_isEnsembleCurve; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h index ca86409300..65bb77609e 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurveAutoName.h @@ -38,11 +38,10 @@ class RimSummaryCurveAutoName : public caf::PdmObject void applySettings( const RimSummaryCurveAutoName& other ); private: - // friend class RimSummaryCurve; - QString curveNameY( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryNameHelper* currentNameHelper, const RimSummaryNameHelper* plotNameHelper ) const; + QString curveNameX( const RifEclipseSummaryAddress& summaryAddress, const RimSummaryNameHelper* currentNameHelper, const RimSummaryNameHelper* plotNameHelper ) const; diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index b87f0d3b49..2dc12e62aa 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -101,8 +101,6 @@ #include #include -#pragma optimize( "", off ) - CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" ); struct RimSummaryPlot::CurveInfo @@ -2289,7 +2287,7 @@ RimSummaryPlot::CurveInfo RimSummaryPlot::handleSummaryCaseDrop( RimSummaryCase* const auto& [addrY, addrX] = addressPair; - curves.push_back( addNewCurveY( addrY, summaryCase, addrX, summaryCase ) ); + curves.push_back( addNewCurve( addrY, summaryCase, addrX, summaryCase ) ); } return { .curveCount = static_cast( curves.size() ), .curves = curves, .curveSets = {} }; @@ -2344,8 +2342,7 @@ RimSummaryPlot::CurveInfo RimSummaryPlot::handleAddressCollectionDrop( RimSummar { for ( auto& curve : summaryCurves() ) { - RiaSummaryCurveDefinition curveDef = curve->curveDefinition(); - sourceCurveDefs.push_back( curveDef ); + sourceCurveDefs.push_back( curve->curveDefinition() ); } if ( ensembleCase ) @@ -2427,7 +2424,7 @@ RimSummaryPlot::CurveInfo RimSummaryPlot::handleAddressCollectionDrop( RimSummar if ( curveDef.summaryCase()->summaryReader() && curveDef.summaryCase()->summaryReader()->hasAddress( curveDef.summaryAddress() ) ) { auto curve = - addNewCurveY( curveDef.summaryAddress(), curveDef.summaryCase(), curveDef.summaryAddressX(), curveDef.summaryCaseX() ); + addNewCurve( curveDef.summaryAddress(), curveDef.summaryCase(), curveDef.summaryAddressX(), curveDef.summaryCaseX() ); curves.push_back( curve ); if ( curveDef.summaryCaseX() ) { @@ -2520,7 +2517,7 @@ RimSummaryPlot::CurveInfo RimSummaryPlot::handleSummaryAddressDrop( RimSummaryAd if ( !skipAddress ) { - curves.push_back( addNewCurveY( droppedAddress, summaryCase, RifEclipseSummaryAddress::timeAddress(), nullptr ) ); + curves.push_back( addNewCurve( droppedAddress, summaryCase, RifEclipseSummaryAddress::timeAddress(), nullptr ) ); newCurves++; } } @@ -2583,10 +2580,10 @@ void RimSummaryPlot::handleDroppedObjects( const std::vectorsetSummaryCaseY( summaryCase ); @@ -3108,8 +3105,7 @@ std::vector RimSummaryPlot::plotYAxes() const for ( const auto& ap : m_axisPropertiesArray ) { auto plotAxisProp = dynamic_cast( ap.p() ); - if ( plotAxisProp && ( plotAxisProp->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || - plotAxisProp->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) ) + if ( plotAxisProp && plotAxisProp->plotAxis().isVertical() ) { axisProps.push_back( plotAxisProp ); } diff --git a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h index b84ed86f04..5806670fb7 100644 --- a/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h +++ b/ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h @@ -206,7 +206,6 @@ class RimSummaryPlot : public RimPlot, public RimSummaryDataSourceStepping RimPlotAxisPropertiesInterface* axisPropertiesForPlotAxis( RiuPlotAxis plotAxis ) const; RimPlotAxisProperties* addNewAxisProperties( RiaDefines::PlotAxis, const QString& name ); - void ensureRequiredAxisObjectsForCurves(); void findOrAssignPlotAxisX( RimSummaryCurve* curve ); std::vector visibleCurvesForLegend() override; @@ -297,11 +296,12 @@ private slots: void timeAxisSettingsChanged( const caf::SignalEmitter* emitter ); void timeAxisSettingsChangedReloadRequired( const caf::SignalEmitter* emitter ); + void ensureRequiredAxisObjectsForCurves(); void assignPlotAxis( RimSummaryCurve* curve ); void assignYPlotAxis( RimSummaryCurve* curve ); void assignXPlotAxis( RimSummaryCurve* curve ); - RimSummaryCurve* addNewCurveY( const RifEclipseSummaryAddress& address, + RimSummaryCurve* addNewCurve( const RifEclipseSummaryAddress& address, RimSummaryCase* summaryCase, const RifEclipseSummaryAddress& addressX, RimSummaryCase* summaryCaseX ); diff --git a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp index ac760f37d4..d80a1e58f9 100644 --- a/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp @@ -73,8 +73,6 @@ #include #include -#pragma optimize( "", off ) - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -1282,10 +1280,6 @@ void RiuQwtPlotWidget::ensureAxisIsCreated( RiuPlotAxis axis ) //-------------------------------------------------------------------------------------------------- void RiuQwtPlotWidget::enableAxis( RiuPlotAxis axis, bool isEnabled ) { - auto axisLocation = axis.axis(); - - bool isBottom = ( axisLocation == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM ); - ensureAxisIsCreated( axis ); m_plot->setAxisVisible( toQwtPlotAxis( axis ), isEnabled );