mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
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:
@@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,8 @@ public:
|
||||
|
||||
void setOverrideCurveData( const std::vector<double>& propertyValues,
|
||||
const std::vector<double>& depthValues,
|
||||
const RiaCurveDataTools::CurveIntervals& curveIntervals );
|
||||
const RiaCurveDataTools::CurveIntervals& curveIntervals,
|
||||
bool isVerticalPlot );
|
||||
|
||||
virtual RiaDefines::PhaseType resultPhase() const;
|
||||
|
||||
|
||||
@@ -1508,7 +1508,6 @@ RiuPlotWidget* RimWellLogTrack::doCreatePlotViewWidget( QWidget* mainWindowParen
|
||||
if ( m_plotWidget == nullptr )
|
||||
{
|
||||
m_plotWidget = new RiuWellLogTrack( this, mainWindowParent );
|
||||
m_plotWidget->setAxisInverted( getDepthAxis(), true );
|
||||
updateAxisScaleEngine();
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
@@ -1975,6 +1974,20 @@ void RimWellLogTrack::updateAxisScaleEngine()
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
RimDepthTrackPlot* wellLogPlot = nullptr;
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
|
||||
{
|
||||
m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_plotWidget->setAxisInverted( RiuPlotAxis::defaultLeft(), false );
|
||||
}
|
||||
}
|
||||
|
||||
if ( m_isLogarithmicScaleEnabled )
|
||||
{
|
||||
m_plotWidget->qwtPlot()->setAxisScaleEngine( QwtPlot::xTop, new QwtLogScaleEngine );
|
||||
@@ -2488,6 +2501,14 @@ void RimWellLogTrack::updateStackedCurveData()
|
||||
|
||||
if ( allDepthValues.empty() ) continue;
|
||||
|
||||
bool isVerticalTrack = true;
|
||||
RimDepthTrackPlot* wellLogPlot;
|
||||
this->firstAncestorOrThisOfType( wellLogPlot );
|
||||
if ( wellLogPlot )
|
||||
{
|
||||
isVerticalTrack = ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL );
|
||||
}
|
||||
|
||||
size_t stackIndex = 0u;
|
||||
std::vector<double> allStackedValues( allDepthValues.size(), 0.0 );
|
||||
for ( auto curve : stackedCurvesInGroup )
|
||||
@@ -2511,10 +2532,10 @@ void RimWellLogTrack::updateStackedCurveData()
|
||||
false,
|
||||
m_isLogarithmicScaleEnabled );
|
||||
|
||||
auto plotDepthValues = tempCurveData.depthValuesByIntervals( depthType, displayUnit );
|
||||
auto plotDepthValues = tempCurveData.depths( depthType );
|
||||
auto polyLineStartStopIndices = tempCurveData.polylineStartStopIndices();
|
||||
|
||||
curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices );
|
||||
curve->setOverrideCurveData( allStackedValues, plotDepthValues, polyLineStartStopIndices, isVerticalTrack );
|
||||
curve->setZOrder( zPos );
|
||||
|
||||
if ( !dynamic_cast<RimWellFlowRateCurve*>( curve ) )
|
||||
|
||||
Reference in New Issue
Block a user