#5473 Improve WBS plot layout by removing gaps and tweaking column spans

This commit is contained in:
Gaute Lindkvist 2020-02-07 10:38:31 +01:00
parent 1a9b1bf95c
commit 47f9c8c7c6
5 changed files with 31 additions and 11 deletions

View File

@ -214,7 +214,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
formationTrack->setFormationCase( geoMechCase );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setColSpan( RimPlot::ONE );
formationTrack->setColSpan( RimPlot::TWO );
}
//--------------------------------------------------------------------------------------------------
@ -229,9 +229,11 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::DARK_LINES );
casingShoeTrack->setAnnotationDisplay( RiuPlotAnnotationTool::COLOR_SHADING_AND_LINES );
casingShoeTrack->setShowRegionLabels( false );
casingShoeTrack->setShowWellPathAttributes( true );
casingShoeTrack->setShowBothSidesOfWell( false );
casingShoeTrack->setAnnotationTransparency( 90 );
casingShoeTrack->setWellPathAttributesSource( wellPath );
casingShoeTrack->setVisibleXRange( 0.0, 0.0 );
casingShoeTrack->setAutoScaleXEnabled( true );
@ -303,7 +305,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
plot );
stabilityCurvesTrack->setVisibleXRange( 0.0, 2.5 );
stabilityCurvesTrack->setColSpan( RimPlot::FIVE );
stabilityCurvesTrack->setColSpan( RimPlot::SIX );
stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 0.5, 0.1 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );

View File

@ -20,6 +20,7 @@ void RimPlot::RowOrColSpanEnum::setUp()
addItem( RimPlot::THREE, "THREE", "3" );
addItem( RimPlot::FOUR, "FOUR", "4" );
addItem( RimPlot::FIVE, "FIVE", "5" );
addItem( RimPlot::SIX, "SIX", "6" );
setDefault( RimPlot::ONE );
}
} // namespace caf

View File

@ -53,7 +53,8 @@ public:
TWO = 2,
THREE = 3,
FOUR = 4,
FIVE = 5
FIVE = 5,
SIX = 6
};
using RowOrColSpanEnum = caf::AppEnum<RowOrColSpan>;

View File

@ -182,6 +182,7 @@ void RiuQwtPlotWidget::setAxisFontsAndAlignment( QwtPlot::Axis axis,
axisTitle.setRenderFlags( alignment | Qt::TextWordWrap );
setAxisTitle( axis, axisTitle );
applyAxisTitleToQwt( axis );
}
//--------------------------------------------------------------------------------------------------
@ -275,6 +276,7 @@ void RiuQwtPlotWidget::setAxisLabelsAndTicksEnabled( QwtPlot::Axis axis, bool en
{
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Ticks, enable );
this->axisScaleDraw( axis )->enableComponent( QwtAbstractScaleDraw::Labels, enable );
recalculateAxisExtents( axis );
}
//--------------------------------------------------------------------------------------------------
@ -367,10 +369,14 @@ double RiuQwtPlotWidget::minorTickInterval( QwtPlot::Axis axis ) const
//--------------------------------------------------------------------------------------------------
int RiuQwtPlotWidget::axisExtent( QwtPlot::Axis axis ) const
{
int lineExtent = 5;
int lineExtent = 0;
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Ticks ) )
{
lineExtent += this->axisScaleDraw( axis )->maxTickLength();
}
if ( this->axisScaleDraw( axis )->hasComponent( QwtAbstractScaleDraw::Labels ) )
{
QFont tickLabelFont = axisFont( axis );
// Make space for a fairly long value label
@ -641,12 +647,8 @@ void RiuQwtPlotWidget::applyAxisTitleToQwt( QwtPlot::Axis axis )
axisTitle.setText( titleToApply );
setAxisTitle( axis, axisTitle );
if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
{
axisScaleDraw( axis )->setMinimumExtent( axisExtent( axis ) );
setMinimumWidth( defaultMinimumWidth() + axisExtent( axis ) );
}
}
recalculateAxisExtents( axis );
}
//--------------------------------------------------------------------------------------------------
@ -780,6 +782,19 @@ void RiuQwtPlotWidget::onAxisSelected( QwtScaleWidget* scale, bool toggleItemInS
emit axisSelected( axisId, toggleItemInSelection );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuQwtPlotWidget::recalculateAxisExtents( QwtPlot::Axis axis )
{
if ( axis == QwtPlot::yLeft || axis == QwtPlot::yRight )
{
int extent = axisExtent( axis );
axisScaleDraw( axis )->setMinimumExtent( extent );
setMinimumWidth( defaultMinimumWidth() + extent );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@ -154,6 +154,7 @@ private:
void highlightCurve( const QwtPlotCurve* closestCurve );
void resetCurveHighlighting();
void onAxisSelected( QwtScaleWidget* scale, bool toggleItemInSelection );
void recalculateAxisExtents( QwtPlot::Axis axis );
caf::UiStyleSheet createPlotStyleSheet() const;
caf::UiStyleSheet createCanvasStyleSheet() const;