Logarithmic curve support and renaming (#8546)

* Add test for both positive and negative numbers
* Remove redundant sample count from parameter list
* Propagate useLogarithmicScale
* Renaming
This commit is contained in:
Magne Sjaastad
2022-02-14 11:49:37 +01:00
committed by GitHub
parent a8a3d3332b
commit 477ae02382
50 changed files with 597 additions and 481 deletions

View File

@@ -134,13 +134,13 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfType( plot );
bool isLogCurve = plot->isLogarithmicScaleEnabled( this->yAxis() );
bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->yAxis() );
if ( dateTimes.size() > 0 && dateTimes.size() == values.size() )
{
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
{
m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, isLogCurve );
m_plotCurve->setSamplesFromTimeTAndYValues( dateTimes, values, useLogarithmicScale );
}
else
{
@@ -156,12 +156,12 @@ void RimAsciiDataCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
}
m_plotCurve->setSamplesFromXValuesAndYValues( times, values, isLogCurve );
m_plotCurve->setSamplesFromXValuesAndYValues( times, values, useLogarithmicScale );
}
}
else
{
m_plotCurve->setSamplesFromTimeTAndYValues( std::vector<time_t>(), std::vector<double>(), isLogCurve );
m_plotCurve->setSamplesFromTimeTAndYValues( std::vector<time_t>(), std::vector<double>(), useLogarithmicScale );
}
updateZoomInParentPlot();

View File

@@ -601,7 +601,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
RimSummaryPlot* plot = nullptr;
firstAncestorOrThisOfTypeAsserted( plot );
bool isLogCurve = plot->isLogarithmicScaleEnabled( this->axisY() );
bool useLogarithmicScale = plot->isLogarithmicScaleEnabled( this->axisY() );
bool shouldPopulateViewWithEmptyData = false;
@@ -627,7 +627,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
{
this->setSamplesFromXYValues( curveMerger.interpolatedYValuesForAllXValues( 0 ),
curveMerger.interpolatedYValuesForAllXValues( 1 ),
isLogCurve );
useLogarithmicScale );
}
else
{
@@ -655,11 +655,11 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( !errValues.empty() )
{
this->setSamplesFromXYErrorValues( timeSteps, curveValuesY, errValues, isLogCurve );
this->setSamplesFromXYErrorValues( timeSteps, curveValuesY, errValues, useLogarithmicScale );
}
else
{
this->setSamplesFromXYValues( timeSteps, curveValuesY, isLogCurve );
this->setSamplesFromXYValues( timeSteps, curveValuesY, useLogarithmicScale );
}
}
else
@@ -681,12 +681,14 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
resampledTimeSteps.insert( resampledTimeSteps.begin(), curveTimeStepsY.front() );
resampledValues.insert( resampledValues.begin(), resampledValues.front() );
this->setSamplesFromTimeTAndYValues( resampledTimeSteps, resampledValues, isLogCurve );
this->setSamplesFromTimeTAndYValues( resampledTimeSteps,
resampledValues,
useLogarithmicScale );
}
}
else
{
this->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve );
this->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, useLogarithmicScale );
}
}
}
@@ -705,7 +707,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
}
}
this->setSamplesFromXYValues( timeFromSimulationStart, curveValuesY, isLogCurve );
this->setSamplesFromXYValues( timeFromSimulationStart, curveValuesY, useLogarithmicScale );
}
}
else
@@ -716,7 +718,7 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( shouldPopulateViewWithEmptyData )
{
this->setSamplesFromXYValues( std::vector<double>(), std::vector<double>(), isLogCurve );
this->setSamplesFromXYValues( std::vector<double>(), std::vector<double>(), useLogarithmicScale );
}
if ( updateParentPlot && hasParentPlot() )

View File

@@ -1134,8 +1134,8 @@ void RimSummaryPlot::removeAllTimeAnnotations()
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::zoomAll()
{
setAutoScaleXEnabled( true );
setAutoScaleYEnabled( true );
setAutoScalePropertyValuesEnabled( true );
setAutoScaleDepthValuesEnabled( true );
updateZoomInParentPlot();
}
@@ -1828,8 +1828,8 @@ void RimSummaryPlot::handleDroppedObjects( const std::vector<caf::PdmObjectHandl
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::onPlotZoomed()
{
setAutoScaleXEnabled( false );
setAutoScaleYEnabled( false );
setAutoScalePropertyValuesEnabled( false );
setAutoScaleDepthValuesEnabled( false );
updateZoomFromParentPlot();
}
@@ -2243,7 +2243,7 @@ std::vector<caf::PdmFieldHandle*> RimSummaryPlot::fieldsToShowInToolbar()
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
void RimSummaryPlot::setAutoScalePropertyValuesEnabled( bool enabled )
{
for ( auto ap : m_axisProperties )
{
@@ -2258,7 +2258,7 @@ void RimSummaryPlot::setAutoScaleXEnabled( bool enabled )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimSummaryPlot::setAutoScaleYEnabled( bool enabled )
void RimSummaryPlot::setAutoScaleDepthValuesEnabled( bool enabled )
{
for ( auto ap : m_axisProperties )
{

View File

@@ -161,8 +161,8 @@ public:
virtual RimSummaryPlotSourceStepping* sourceSteppingObjectForKeyEventHandling() const;
virtual std::vector<caf::PdmFieldHandle*> fieldsToShowInToolbar();
void setAutoScaleXEnabled( bool enabled ) override;
void setAutoScaleYEnabled( bool enabled ) override;
void setAutoScalePropertyValuesEnabled( bool enabled ) override;
void setAutoScaleDepthValuesEnabled( bool enabled ) override;
RiuPlotWidget* plotWidget() override;
void zoomAll() override;
void updateZoomInParentPlot() override;