Support horizontally stacked curves (#8553)

* #8548 Horizontal track : Improve stacked curves
* Add horizontal track bar
* Show relevant scroll bar for horizontal and vertical plots
* Show max property value at top for horizontal plots
This commit is contained in:
Magne Sjaastad
2022-02-21 07:15:56 +01:00
committed by GitHub
parent 5c72d31cc9
commit 4ed5250d3b
5 changed files with 115 additions and 35 deletions

View File

@@ -182,6 +182,12 @@ void RimWellLogCurve::updateCurveAppearance()
{
RimPlotCurve::updateCurveAppearance();
RimDepthTrackPlot::DepthOrientation orientation = RimDepthTrackPlot::DepthOrientation::VERTICAL;
RimDepthTrackPlot* wellLogPlot = nullptr;
firstAncestorOrThisOfType( wellLogPlot );
if ( wellLogPlot ) orientation = wellLogPlot->depthOrientation();
if ( m_plotCurve )
{
m_plotCurve->setXAxis( RiuPlotAxis::defaultTop() );
@@ -193,9 +199,16 @@ void RimWellLogCurve::updateCurveAppearance()
RiuQwtPlotCurve* qwtPlotCurve = dynamic_cast<RiuQwtPlotCurve*>( m_plotCurve );
if ( qwtPlotCurve )
{
qwtPlotCurve->setOrientation( Qt::Horizontal );
qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
qwtPlotCurve->setCurveAttribute( QwtPlotCurve::Inverted, true );
if ( orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL )
{
qwtPlotCurve->setOrientation( Qt::Horizontal );
qwtPlotCurve->setBaseline( -std::numeric_limits<double>::infinity() );
}
else
{
qwtPlotCurve->setOrientation( Qt::Vertical );
qwtPlotCurve->setBaseline( 0.0 );
}
}
}
}
@@ -221,13 +234,21 @@ QString RimWellLogCurve::wellLogCurveIconName()
//--------------------------------------------------------------------------------------------------
void RimWellLogCurve::setOverrideCurveData( const std::vector<double>& propertyValues,
const std::vector<double>& depthValues,
const RiaCurveDataTools::CurveIntervals& curveIntervals )
const RiaCurveDataTools::CurveIntervals& curveIntervals,
bool isVerticalPlot )
{
auto minmax_it = std::minmax_element( propertyValues.begin(), propertyValues.end() );
this->setOverrideCurveDataPropertyValueRange( *( minmax_it.first ), *( minmax_it.second ) );
if ( m_plotCurve )
{
m_plotCurve->setSamplesValues( propertyValues, depthValues );
if ( isVerticalPlot )
{
m_plotCurve->setSamplesValues( propertyValues, depthValues );
}
else
{
m_plotCurve->setSamplesValues( depthValues, propertyValues );
}
m_plotCurve->setLineSegmentStartStopIndices( curveIntervals );
}
}