mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-11 07:56:08 -06:00
#9092 WLP: show only axis for first and last track.
This commit is contained in:
parent
80961161d2
commit
b4bca2276f
@ -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;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@ -146,6 +146,9 @@ public:
|
||||
|
||||
RiaDefines::DepthUnitType caseDepthUnit() const;
|
||||
|
||||
bool isFirstVisibleTrack( RimWellLogTrack* track );
|
||||
bool isLastVisibleTrack( RimWellLogTrack* track );
|
||||
|
||||
protected:
|
||||
QImage snapshotWindowContent() override;
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user