#9092 WLP: show only axis for first and last track.

This commit is contained in:
Kristian Bendiksen 2022-08-10 08:39:03 +02:00
parent 80961161d2
commit b4bca2276f
4 changed files with 53 additions and 4 deletions

View File

@ -767,6 +767,39 @@ void RimDepthTrackPlot::onPlotsReordered( const SignalEmitter* emitter )
recreatePlotWidgets();
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimDepthTrackPlot::isFirstVisibleTrack( RimWellLogTrack* track )
{
// Find first visible track
auto findFirstVisibleTrack = [this]() {
auto plots = visiblePlots();
if ( !plots.empty() ) return plots.front();
return static_cast<RimWellLogTrack*>( nullptr );
};
auto firstVisibleTrack = findFirstVisibleTrack();
return firstVisibleTrack && firstVisibleTrack == track;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimDepthTrackPlot::isLastVisibleTrack( RimWellLogTrack* track )
{
// Find last visible track
auto findLastVisibleTrack = [this]() {
auto plots = visiblePlots();
if ( !plots.empty() ) return plots.back();
return static_cast<RimWellLogTrack*>( nullptr );
};
auto lastVisibleTrack = findLastVisibleTrack();
return lastVisibleTrack && lastVisibleTrack == track;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -146,6 +146,9 @@ public:
RiaDefines::DepthUnitType caseDepthUnit() const;
bool isFirstVisibleTrack( RimWellLogTrack* track );
bool isLastVisibleTrack( RimWellLogTrack* track );
protected:
QImage snapshotWindowContent() override;

View File

@ -1290,13 +1290,21 @@ void RimWellLogTrack::onLoadDataAndUpdate()
if ( wellLogPlot->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL )
{
// Show depth axis only for the first track (on the left side)
bool isFirstTrack = wellLogPlot->isFirstVisibleTrack( this );
m_plotWidget->setAxisEnabled( QwtAxis::XTop, true );
m_plotWidget->setAxisEnabled( QwtAxis::XBottom, false );
m_plotWidget->setAxisEnabled( QwtAxis::YLeft, isFirstTrack );
m_plotWidget->setAxisEnabled( QwtAxis::YRight, false );
}
else
{
// Show depth axis only for the last track (on the bottom side)
bool isLastTrack = wellLogPlot->isLastVisibleTrack( this );
m_plotWidget->setAxisEnabled( QwtAxis::XTop, false );
m_plotWidget->setAxisEnabled( QwtAxis::XBottom, true );
m_plotWidget->setAxisEnabled( QwtAxis::XBottom, isLastTrack );
m_plotWidget->setAxisEnabled( QwtAxis::YLeft, true );
m_plotWidget->setAxisEnabled( QwtAxis::YRight, false );
}
}

View File

@ -135,10 +135,14 @@ static WellLogCurveInfoTextProvider wellLogCurveInfoTextProvider;
RiuWellLogTrack::RiuWellLogTrack( RimWellLogTrack* track, QWidget* parent /*= nullptr */ )
: RiuQwtPlotWidget( track, parent )
{
RimWellLogPlot* wlp = nullptr;
track->firstAncestorOfType( wlp );
bool isVertical = ( wlp && wlp->depthOrientation() == RimDepthTrackPlot::DepthOrientation::VERTICAL );
setAxisEnabled( QwtAxis::YLeft, true );
setAxisEnabled( QwtAxis::YRight, false );
setAxisEnabled( QwtAxis::XTop, true );
setAxisEnabled( QwtAxis::XBottom, true );
setAxisEnabled( QwtAxis::XTop, !isVertical );
setAxisEnabled( QwtAxis::XBottom, isVertical );
new RiuWellLogCurvePointTracker( this->qwtPlot(), &wellLogCurveInfoTextProvider, track );
}
@ -166,6 +170,7 @@ void RiuWellLogTrack::setAxisEnabled( QwtAxis::Position axis, bool enabled )
qwtPlot()->axisScaleDraw( axis )->setMinimumExtent( axisExtent( plotAxis ) );
qwtPlot()->axisWidget( axis )->setMargin( 0 );
setAxisTitleEnabled( plotAxis, true );
}
setAxisTitleEnabled( plotAxis, enabled );
}