mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Depth Axis : Improve visibility logic
This commit is contained in:
@@ -574,6 +574,10 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
|
||||
}
|
||||
|
||||
updateParentLayout();
|
||||
|
||||
RimDepthTrackPlot* depthTrackPlot;
|
||||
this->firstAncestorOrThisOfTypeAsserted( depthTrackPlot );
|
||||
depthTrackPlot->updateDepthAxisVisibility();
|
||||
}
|
||||
else if ( changedField == &m_description )
|
||||
{
|
||||
@@ -1263,6 +1267,46 @@ bool RimWellLogTrack::isEmptyVisiblePropertyRange() const
|
||||
1.0e-6 * std::max( 1.0, std::max( m_visiblePropertyValueRangeMax(), m_visiblePropertyValueRangeMin() ) );
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RimWellLogTrack::updateAxesVisibility( RimDepthTrackPlot::DepthOrientation orientation, bool isFirstTrack, bool isLastTrack )
|
||||
{
|
||||
if ( !m_plotWidget ) return;
|
||||
|
||||
auto setAxisVisible = [this]( QwtAxis::Position axis, bool enable ) {
|
||||
auto plot = m_plotWidget->qwtPlot();
|
||||
if ( !plot ) return false;
|
||||
|
||||
bool isCurrentlyEnabled = plot->isAxisVisible( axis );
|
||||
if ( enable == isCurrentlyEnabled ) return false;
|
||||
|
||||
m_plotWidget->setAxisEnabled( axis, enable );
|
||||
return true;
|
||||
};
|
||||
|
||||
bool needUpdate = false;
|
||||
|
||||
if ( orientation == RimDepthTrackPlot::DepthOrientation::VERTICAL )
|
||||
{
|
||||
// Show depth axis only for the first track (on the left side)
|
||||
needUpdate |= setAxisVisible( QwtAxis::XBottom, false );
|
||||
needUpdate |= setAxisVisible( QwtAxis::XTop, true );
|
||||
needUpdate |= setAxisVisible( QwtAxis::YLeft, isFirstTrack );
|
||||
needUpdate |= setAxisVisible( QwtAxis::YRight, false );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Show depth axis only for the last track (on the bottom side)
|
||||
needUpdate |= setAxisVisible( QwtAxis::XTop, false );
|
||||
needUpdate |= setAxisVisible( QwtAxis::XBottom, isLastTrack );
|
||||
needUpdate |= setAxisVisible( QwtAxis::YLeft, true );
|
||||
needUpdate |= setAxisVisible( QwtAxis::YRight, false );
|
||||
}
|
||||
|
||||
if ( needUpdate ) onLoadDataAndUpdate();
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@@ -1287,25 +1331,6 @@ void RimWellLogTrack::onLoadDataAndUpdate()
|
||||
{
|
||||
m_plotWidget->setAxisTitleText( valueAxis(), m_propertyValueAxisTitle );
|
||||
m_plotWidget->setAxisTitleText( depthAxis(), wellLogPlot->depthAxisTitle() );
|
||||
|
||||
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, isLastTrack );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::YLeft, true );
|
||||
m_plotWidget->setAxisEnabled( QwtAxis::YRight, false );
|
||||
}
|
||||
}
|
||||
|
||||
for ( size_t cIdx = 0; cIdx < m_curves.size(); ++cIdx )
|
||||
|
||||
@@ -237,6 +237,7 @@ public:
|
||||
void setCurvesTreeVisibility( bool isVisible );
|
||||
|
||||
void setEnsembleWellLogCurveSet( RimEnsembleWellLogCurveSet* curveSet );
|
||||
void updateAxesVisibility( RimDepthTrackPlot::DepthOrientation orientation, bool isFirstTrack, bool isLastTrack );
|
||||
|
||||
protected:
|
||||
// RimViewWindow overrides
|
||||
|
||||
Reference in New Issue
Block a user