Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
magnesj committed Sep 20, 2023
1 parent 2b28c4b commit 67c5cc2
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 44 deletions.
24 changes: 11 additions & 13 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@
#include "cafPdmUiPushButtonEditor.h"
#include "cafPdmUiTreeOrdering.h"

#pragma optimize( "", off )

CAF_PDM_SOURCE_INIT( RimSummaryCurve, "SummaryCurve" );

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -94,7 +92,7 @@ RimSummaryCurve::RimSummaryCurve()

// X Values

CAF_PDM_InitField( &m_axisType,
CAF_PDM_InitField( &m_xAxisType,
"HorizontalAxisType",
caf::AppEnum<RiaDefines::HorizontalAxisType>( RiaDefines::HorizontalAxisType::TIME ),
"Axis Type" );
Expand Down Expand Up @@ -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() );
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -440,15 +438,15 @@ void RimSummaryCurve::setOverrideCurveDataY( const std::vector<time_t>& dateTime
//--------------------------------------------------------------------------------------------------
void RimSummaryCurve::setAxisTypeX( RiaDefines::HorizontalAxisType axisType )
{
m_axisType = axisType;
m_xAxisType = axisType;
}

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiaDefines::HorizontalAxisType RimSummaryCurve::axisTypeX() const
{
return m_axisType();
return m_xAxisType();
}

//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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 );
Expand All @@ -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 } );
Expand Down Expand Up @@ -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() )
{
Expand Down
14 changes: 6 additions & 8 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryCurve.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,22 +139,20 @@ class RimSummaryCurve : public RimStackablePlotCurve

private:
// Y values
caf::PdmPtrField<RimSummaryCase*> m_yValuesSummaryCase;
caf::PdmChildField<RimSummaryAddress*> m_yValuesSummaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_yValuesSummaryAddressUiField;
caf::PdmField<bool> m_yPushButtonSelectSummaryAddress;

caf::PdmPtrField<RimSummaryCase*> m_yValuesSummaryCase;
caf::PdmChildField<RimSummaryAddress*> m_yValuesSummaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_yValuesSummaryAddressUiField;
caf::PdmField<bool> m_yPushButtonSelectSummaryAddress;
caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_yPlotAxisProperties;
caf::PdmField<RiaDefines::DateTimePeriodEnum> m_yValuesResampling;

// X values
caf::PdmField<caf::AppEnum<RiaDefines::HorizontalAxisType>> m_axisType;
caf::PdmField<caf::AppEnum<RiaDefines::HorizontalAxisType>> m_xAxisType;
caf::PdmPtrField<RimSummaryCase*> m_xValuesSummaryCase;
caf::PdmChildField<RimSummaryAddress*> m_xValuesSummaryAddress;
caf::PdmField<RifEclipseSummaryAddress> m_xValuesSummaryAddressUiField;
caf::PdmField<bool> m_xPushButtonSelectSummaryAddress;

caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_xPlotAxisProperties;
caf::PdmPtrField<RimPlotAxisPropertiesInterface*> m_xPlotAxisProperties;

// Other fields
caf::PdmField<caf::Tristate> m_isEnsembleCurve;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
22 changes: 9 additions & 13 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@
#include <limits>
#include <set>

#pragma optimize( "", off )

CAF_PDM_SOURCE_INIT( RimSummaryPlot, "SummaryPlot" );

struct RimSummaryPlot::CurveInfo
Expand Down Expand Up @@ -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<int>( curves.size() ), .curves = curves, .curveSets = {} };
Expand Down Expand Up @@ -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 )
Expand Down Expand Up @@ -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() )
{
Expand Down Expand Up @@ -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++;
}
}
Expand Down Expand Up @@ -2583,10 +2580,10 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimSummaryCurve* RimSummaryPlot::addNewCurveY( const RifEclipseSummaryAddress& address,
RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& addressX,
RimSummaryCase* summaryCaseX )
RimSummaryCurve* RimSummaryPlot::addNewCurve( const RifEclipseSummaryAddress& address,
RimSummaryCase* summaryCase,
const RifEclipseSummaryAddress& addressX,
RimSummaryCase* summaryCaseX )
{
auto* newCurve = new RimSummaryCurve();
newCurve->setSummaryCaseY( summaryCase );
Expand Down Expand Up @@ -3108,8 +3105,7 @@ std::vector<RimPlotAxisProperties*> RimSummaryPlot::plotYAxes() const
for ( const auto& ap : m_axisPropertiesArray )
{
auto plotAxisProp = dynamic_cast<RimPlotAxisProperties*>( 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 );
}
Expand Down
4 changes: 2 additions & 2 deletions ApplicationLibCode/ProjectDataModel/Summary/RimSummaryPlot.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<RimPlotCurve*> visibleCurvesForLegend() override;
Expand Down Expand Up @@ -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 );
Expand Down
6 changes: 0 additions & 6 deletions ApplicationLibCode/UserInterface/RiuQwtPlotWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@
#include <algorithm>
#include <limits>

#pragma optimize( "", off )

//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 67c5cc2

Please sign in to comment.