Rename to plotAxis()

This commit is contained in:
Magne Sjaastad
2023-09-17 15:00:34 +02:00
parent 7d7442c3f8
commit e8aada80c5
13 changed files with 57 additions and 57 deletions

View File

@@ -49,7 +49,7 @@ void RicNewPlotAxisPropertiesFeature::onActionTriggered( bool isChecked )
if ( !summaryPlot ) return;
RimPlotAxisProperties* newPlotAxisProperties = summaryPlot->addNewAxisProperties( RiaDefines::PlotAxis::PLOT_AXIS_LEFT, "New Axis" );
summaryPlot->plotWidget()->ensureAxisIsCreated( newPlotAxisProperties->plotAxisType() );
summaryPlot->plotWidget()->ensureAxisIsCreated( newPlotAxisProperties->plotAxis() );
newPlotAxisProperties->setNameForUnusedAxis();
summaryPlot->updateConnectedEditors();

View File

@@ -641,8 +641,8 @@ void RimGridCrossPlot::swapAxes()
QString tmpName = xAxisProperties->objectName();
QString tmpTitle = xAxisProperties->axisTitleText();
RiuPlotAxis tmpAxis = xAxisProperties->plotAxisType();
xAxisProperties->setNameAndAxis( yAxisProperties->objectName(), yAxisProperties->axisTitleText(), yAxisProperties->plotAxisType().axis() );
RiuPlotAxis tmpAxis = xAxisProperties->plotAxis();
xAxisProperties->setNameAndAxis( yAxisProperties->objectName(), yAxisProperties->axisTitleText(), yAxisProperties->plotAxis().axis() );
yAxisProperties->setNameAndAxis( tmpName, tmpTitle, tmpAxis.axis() );
m_xAxisProperties.removeChild( xAxisProperties );
@@ -855,7 +855,7 @@ void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
axisParameterString = yAxisParameterString();
}
RiuPlotAxis axis = axisProperties->plotAxisType();
RiuPlotAxis axis = axisProperties->plotAxis();
if ( axisProperties->isActive() )
{
m_plotWidget->enableAxis( axis, true );

View File

@@ -327,7 +327,7 @@ const QString RimPlotAxisProperties::axisTitleText() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimPlotAxisProperties::plotAxisType() const
RiuPlotAxis RimPlotAxisProperties::plotAxis() const
{
return RiuPlotAxis( m_plotAxis.value(), m_plotAxisIndex );
}
@@ -712,7 +712,7 @@ void RimPlotAxisProperties::fieldChangedByUi( const caf::PdmFieldHandle* changed
else if ( changedField == &m_plotAxis )
{
RiuPlotAxis oldPlotAxis = RiuPlotAxis( (RiaDefines::PlotAxis)oldValue.toInt(), m_plotAxisIndex );
axisPositionChanged.send( this, oldPlotAxis, plotAxisType() );
axisPositionChanged.send( this, oldPlotAxis, plotAxis() );
}
else
{

View File

@@ -73,7 +73,7 @@ public:
const QString objectName() const override;
const QString axisTitleText() const override;
RiuPlotAxis plotAxisType() const override;
RiuPlotAxis plotAxis() const override;
bool useAutoTitle() const;
void setShowDescription( bool enable );

View File

@@ -56,7 +56,7 @@ public:
virtual std::vector<RimPlotAxisAnnotation*> annotations() const = 0;
virtual void appendAnnotation( RimPlotAxisAnnotation* annotation ) = 0;
virtual void removeAllAnnotations() = 0;
virtual RiuPlotAxis plotAxisType() const = 0;
virtual RiuPlotAxis plotAxis() const = 0;
virtual double visibleRangeMin() const = 0;
virtual double visibleRangeMax() const = 0;

View File

@@ -2211,7 +2211,7 @@ int statisticsCurveSymbolSize( RiuPlotCurveSymbol::PointSymbolEnum symbol )
RiuPlotAxis RimEnsembleCurveSet::axisY() const
{
if ( m_plotAxisProperties )
return m_plotAxisProperties->plotAxisType();
return m_plotAxisProperties->plotAxis();
else
return RiuPlotAxis::defaultLeft();
}

View File

@@ -441,7 +441,7 @@ void RimSummaryCurve::setLeftOrRightAxisY( RiuPlotAxis plotAxis )
RiuPlotAxis RimSummaryCurve::axisY() const
{
if ( m_plotAxisProperties )
return m_plotAxisProperties->plotAxisType();
return m_plotAxisProperties->plotAxis();
else
return RiuPlotAxis::defaultLeft();
}

View File

@@ -1084,7 +1084,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
{
for ( auto curve : plot->summaryCurves() )
{
if ( curve->axisY() == axis->plotAxisType() )
if ( curve->axisY() == axis->plotAxis() )
{
std::vector<RimSummaryCase*> summaryCases = summaryCasesForCurve( curve, m_axisRangeAggregation() );
std::vector<RifEclipseSummaryAddress> addresses = addressesForCurve( curve, m_axisRangeAggregation() );
@@ -1093,14 +1093,14 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
auto [minimum, maximum] = findMinMaxForAddressesInSummaryCases( addresses, summaryCases, onlyPositiveValues );
if ( axisRanges.count( axis->plotAxisType() ) == 0 )
if ( axisRanges.count( axis->plotAxis() ) == 0 )
{
axisRanges[axis->plotAxisType()] = std::make_pair( minimum, maximum );
axisRanges[axis->plotAxis()] = std::make_pair( minimum, maximum );
}
else
{
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
axisRanges[axis->plotAxisType()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
auto& [currentMin, currentMax] = axisRanges[axis->plotAxis()];
axisRanges[axis->plotAxis()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
}
}
}
@@ -1109,7 +1109,7 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
{
if ( !curveSet->summaryCaseCollection() ) continue;
if ( curveSet->axisY() == axis->plotAxisType() )
if ( curveSet->axisY() == axis->plotAxis() )
{
double minimum( std::numeric_limits<double>::infinity() );
double maximum( -std::numeric_limits<double>::infinity() );
@@ -1132,14 +1132,14 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
}
}
if ( axisRanges.count( axis->plotAxisType() ) == 0 )
if ( axisRanges.count( axis->plotAxis() ) == 0 )
{
axisRanges[axis->plotAxisType()] = std::make_pair( minimum, maximum );
axisRanges[axis->plotAxis()] = std::make_pair( minimum, maximum );
}
else
{
auto& [currentMin, currentMax] = axisRanges[axis->plotAxisType()];
axisRanges[axis->plotAxisType()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
auto& [currentMin, currentMax] = axisRanges[axis->plotAxis()];
axisRanges[axis->plotAxis()] = std::make_pair( std::min( currentMin, minimum ), std::max( currentMax, maximum ) );
}
}
}
@@ -1148,8 +1148,8 @@ void RimSummaryMultiPlot::computeAggregatedAxisRange()
// set all plots to use the global min/max values for each category
for ( auto axis : plot->plotYAxes() )
{
auto [minVal, maxVal] = axisRanges[axis->plotAxisType()];
if ( RiaDefines::isVertical( axis->plotAxisType().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) )
auto [minVal, maxVal] = axisRanges[axis->plotAxis()];
if ( RiaDefines::isVertical( axis->plotAxis().axis() ) && !std::isinf( minVal ) && !std::isinf( maxVal ) )
{
axis->setAutoZoom( false );

View File

@@ -643,7 +643,7 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( const RimSummaryPlot& sourceSu
{
QString data = ap->writeObjectToXmlString();
auto axisProperty = axisPropertiesForPlotAxis( ap->plotAxisType() );
auto axisProperty = axisPropertiesForPlotAxis( ap->plotAxis() );
if ( axisProperty )
{
axisProperty->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
@@ -658,11 +658,11 @@ void RimSummaryPlot::copyAxisPropertiesFromOther( RiaDefines::PlotAxis plotAxisT
{
for ( auto ap : sourceSummaryPlot.plotAxes() )
{
if ( ap->plotAxisType().axis() != plotAxisType ) continue;
if ( ap->plotAxis().axis() != plotAxisType ) continue;
QString data = ap->writeObjectToXmlString();
axisPropertiesForPlotAxis( ap->plotAxisType() )->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
axisPropertiesForPlotAxis( ap->plotAxis() )->readObjectFromXmlString( data, caf::PdmDefaultObjectFactory::instance() );
}
}
@@ -908,7 +908,7 @@ void RimSummaryPlot::updateNumericalAxis( RiaDefines::PlotAxis plotAxis )
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisPropertiesArray )
{
RiuPlotAxis riuPlotAxis = axisProperties->plotAxisType();
RiuPlotAxis riuPlotAxis = axisProperties->plotAxis();
if ( riuPlotAxis.axis() == plotAxis )
{
auto* axisProps = dynamic_cast<RimPlotAxisProperties*>( axisProperties );
@@ -1054,7 +1054,7 @@ void RimSummaryPlot::updateZoomForNumericalAxis( RimPlotAxisProperties* axisProp
{
if ( !axisProperties ) return;
const auto plotAxis = axisProperties->plotAxisType();
const auto plotAxis = axisProperties->plotAxis();
if ( axisProperties->isAutoZoom() )
{
if ( axisProperties->isLogarithmicScaleEnabled() )
@@ -1086,16 +1086,16 @@ void RimSummaryPlot::updateZoomForNumericalAxis( RimPlotAxisProperties* axisProp
std::swap( min, max );
}
plotWidget()->setAxisScale( axisProperties->plotAxisType(), min, max );
plotWidget()->setAxisScale( axisProperties->plotAxis(), min, max );
}
else if ( ( plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT || plotAxis.axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT ) &&
isOnlyWaterCutCurvesVisible( plotAxis ) )
{
plotWidget()->setAxisScale( axisProperties->plotAxisType(), 0.0, 1.0 );
plotWidget()->setAxisScale( axisProperties->plotAxis(), 0.0, 1.0 );
}
else
{
plotWidget()->setAxisAutoScale( axisProperties->plotAxisType(), true );
plotWidget()->setAxisAutoScale( axisProperties->plotAxis(), true );
}
}
else
@@ -1103,10 +1103,10 @@ void RimSummaryPlot::updateZoomForNumericalAxis( RimPlotAxisProperties* axisProp
double min = axisProperties->visibleRangeMin();
double max = axisProperties->visibleRangeMax();
if ( axisProperties->isAxisInverted() ) std::swap( min, max );
plotWidget()->setAxisScale( axisProperties->plotAxisType(), min, max );
plotWidget()->setAxisScale( axisProperties->plotAxis(), min, max );
}
plotWidget()->setAxisInverted( axisProperties->plotAxisType(), axisProperties->isAxisInverted() );
plotWidget()->setAxisInverted( axisProperties->plotAxis(), axisProperties->isAxisInverted() );
}
//--------------------------------------------------------------------------------------------------
@@ -1118,13 +1118,13 @@ void RimSummaryPlot::updateZoomForTimeAxis( RimSummaryTimeAxisProperties* timeAx
if ( timeAxisProperties->isAutoZoom() )
{
plotWidget()->setAxisAutoScale( timeAxisProperties->plotAxisType(), true );
plotWidget()->setAxisAutoScale( timeAxisProperties->plotAxis(), true );
}
else
{
double min = timeAxisProperties->visibleRangeMin();
double max = timeAxisProperties->visibleRangeMax();
plotWidget()->setAxisScale( timeAxisProperties->plotAxisType(), min, max );
plotWidget()->setAxisScale( timeAxisProperties->plotAxis(), min, max );
}
}
@@ -1284,7 +1284,7 @@ RimPlotAxisPropertiesInterface* RimSummaryPlot::axisPropertiesForPlotAxis( RiuPl
{
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisPropertiesArray )
{
if ( axisProperties->plotAxisType() == plotAxis ) return axisProperties;
if ( axisProperties->plotAxis() == plotAxis ) return axisProperties;
}
return nullptr;
@@ -1708,10 +1708,10 @@ bool RimSummaryPlot::updateStackedCurveDataForRelevantAxes()
bool anyStackedCurvesPresent = false;
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisPropertiesArray )
{
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
if ( axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
{
anyStackedCurvesPresent |= updateStackedCurveDataForAxis( axisProperties->plotAxisType() );
anyStackedCurvesPresent |= updateStackedCurveDataForAxis( axisProperties->plotAxis() );
}
}
@@ -1913,7 +1913,7 @@ void RimSummaryPlot::updateZoomFromParentPlot()
{
if ( !axisProperties ) continue;
auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxisType() );
auto [axisMin, axisMax] = plotWidget()->axisRange( axisProperties->plotAxis() );
if ( axisProperties->isAxisInverted() ) std::swap( axisMin, axisMax );
if ( auto propertyAxis = dynamic_cast<RimPlotAxisProperties*>( axisProperties ) )
@@ -2672,7 +2672,7 @@ RiuPlotWidget* RimSummaryPlot::doCreatePlotViewWidget( QWidget* mainWindowParent
for ( const auto& axisProperties : m_axisPropertiesArray )
{
plotWidget()->ensureAxisIsCreated( axisProperties->plotAxisType() );
plotWidget()->ensureAxisIsCreated( axisProperties->plotAxis() );
}
for ( RimGridTimeHistoryCurve* curve : m_gridTimeHistoryCurves )
@@ -2980,8 +2980,8 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
{
for ( const auto& ap : m_axisPropertiesArray )
{
if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP ||
ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_TOP ||
ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
ap->setAutoZoom( enabled );
}
@@ -2995,8 +2995,8 @@ void RimSummaryPlot::setAutoScaleYEnabled( bool enabled )
{
for ( const auto& ap : m_axisPropertiesArray )
{
if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
{
ap->setAutoZoom( enabled );
}
@@ -3115,8 +3115,8 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
{
for ( RimPlotAxisPropertiesInterface* axisProperties : m_axisPropertiesArray )
{
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
if ( axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT ||
axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
{
destinationCurve->setLeftOrRightAxisY( c->axisY() );
@@ -3149,9 +3149,9 @@ void RimSummaryPlot::assignPlotAxis( RimSummaryCurve* destinationCurve )
size_t axisCountRight = 0;
for ( const auto& ap : m_axisPropertiesArray )
{
if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_LEFT )
axisCountLeft++;
else if ( ap->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
else if ( ap->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_RIGHT )
axisCountRight++;
}
@@ -3206,7 +3206,7 @@ void RimSummaryPlot::onChildDeleted( caf::PdmChildArrayFieldHandle* childArray,
std::set<RiuPlotAxis> usedPlotAxis;
for ( const auto& axisProperties : m_axisPropertiesArray )
{
usedPlotAxis.insert( axisProperties->plotAxisType() );
usedPlotAxis.insert( axisProperties->plotAxis() );
}
plotWidget()->pruneAxes( usedPlotAxis );

View File

@@ -119,7 +119,7 @@ void RimSummaryPlotAxisFormatter::applyAxisPropertiesToPlot( RiuPlotWidget* plot
{
if ( !plotWidget ) return;
RiuPlotAxis axis = m_axisProperties->plotAxisType();
RiuPlotAxis axis = m_axisProperties->plotAxis();
{
QString axisTitle = m_axisProperties->customTitle();
if ( m_axisProperties->useAutoTitle() ) axisTitle = autoAxisTitle();
@@ -254,12 +254,12 @@ QString RimSummaryPlotAxisFormatter::autoAxisTitle() const
RifEclipseSummaryAddress sumAddress;
std::string unitText;
if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
if ( m_axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
sumAddress = rimCurve->summaryAddressX();
unitText = rimCurve->unitNameX();
}
else if ( rimCurve->axisY() == m_axisProperties->plotAxisType() )
else if ( rimCurve->axisY() == m_axisProperties->plotAxis() )
{
sumAddress = rimCurve->summaryAddressY();
unitText = rimCurve->unitNameY();
@@ -370,11 +370,11 @@ QString RimSummaryPlotAxisFormatter::createAxisObjectName() const
{
RifEclipseSummaryAddress sumAddress;
if ( m_axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
if ( m_axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
sumAddress = rimCurve->summaryAddressX();
}
else if ( rimCurve->axisY() == m_axisProperties->plotAxisType() )
else if ( rimCurve->axisY() == m_axisProperties->plotAxis() )
{
sumAddress = rimCurve->summaryAddressY();
}

View File

@@ -164,7 +164,7 @@ RimPlotAxisPropertiesInterface::AxisTitlePositionType RimSummaryTimeAxisProperti
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuPlotAxis RimSummaryTimeAxisProperties::plotAxisType() const
RiuPlotAxis RimSummaryTimeAxisProperties::plotAxis() const
{
return RiuPlotAxis::defaultBottom();
}

View File

@@ -85,7 +85,7 @@ public:
caf::PdmField<QString> title;
caf::PdmField<bool> showTitle;
RiuPlotAxis plotAxisType() const override;
RiuPlotAxis plotAxis() const override;
AxisTitlePositionType titlePosition() const override;
int titleFontSize() const override;
int valuesFontSize() const override;

View File

@@ -143,7 +143,7 @@ void RiuSummaryQwtPlot::useTimeBasedTimeAxis()
void RiuSummaryQwtPlot::updateAnnotationObjects( RimPlotAxisPropertiesInterface* axisProperties )
{
RiaDefines::Orientation orientation = RiaDefines::Orientation::HORIZONTAL;
if ( axisProperties->plotAxisType().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
if ( axisProperties->plotAxis().axis() == RiaDefines::PlotAxis::PLOT_AXIS_BOTTOM )
{
orientation = RiaDefines::Orientation::VERTICAL;
}