Remove width scaling factors

This commit is contained in:
Gaute Lindkvist 2019-11-13 14:40:06 +01:00
parent 8252ab8808
commit 4dd0651dae
10 changed files with 105 additions and 86 deletions

View File

@ -191,7 +191,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil
formationTrack->setFormationCase( geoMechCase ); formationTrack->setFormationCase( geoMechCase );
formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
formationTrack->setVisibleXRange( 0.0, 0.0 ); formationTrack->setVisibleXRange( 0.0, 0.0 );
formationTrack->setWidthScaleFactor( RimPlotInterface::NARROW ); formationTrack->setColSpan( RimPlotInterface::ONE );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -202,7 +202,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi
RimGeoMechCase* geoMechCase ) RimGeoMechCase* geoMechCase )
{ {
RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot ); RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot );
casingShoeTrack->setWidthScaleFactor( RimPlotInterface::NARROW ); casingShoeTrack->setColSpan( RimPlotInterface::ONE );
casingShoeTrack->setFormationWellPath( wellPath ); casingShoeTrack->setFormationWellPath( wellPath );
casingShoeTrack->setFormationCase( geoMechCase ); casingShoeTrack->setFormationCase( geoMechCase );
casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS );
@ -226,7 +226,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi
RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"WBS Parameters", "WBS Parameters",
plot ); plot );
paramCurvesTrack->setWidthScaleFactor( RimPlotInterface::WIDE ); paramCurvesTrack->setColSpan( RimPlotInterface::TWO );
paramCurvesTrack->setAutoScaleXEnabled( true ); paramCurvesTrack->setAutoScaleXEnabled( true );
paramCurvesTrack->setTickIntervals( 0.5, 0.05 ); paramCurvesTrack->setTickIntervals( 0.5, 0.05 );
paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@ -272,7 +272,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore
RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false,
"Stability Curves", "Stability Curves",
plot ); plot );
stabilityCurvesTrack->setWidthScaleFactor( RimPlotInterface::EXTRA_WIDE ); stabilityCurvesTrack->setColSpan( RimPlotInterface::FIVE );
stabilityCurvesTrack->setAutoScaleXEnabled( true ); stabilityCurvesTrack->setAutoScaleXEnabled( true );
stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 ); stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 );
stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );
@ -361,7 +361,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability
maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 ); maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 );
minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 ); minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 );
} }
wellPathAnglesTrack->setWidthScaleFactor( RimPlotInterface::NORMAL ); wellPathAnglesTrack->setColSpan( RimPlotInterface::THREE );
wellPathAnglesTrack->setVisibleXRange( minValue, maxValue ); wellPathAnglesTrack->setVisibleXRange( minValue, maxValue );
wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 ); wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 );
wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR );

View File

@ -9,24 +9,15 @@
namespace caf namespace caf
{ {
template <>
void RimPlotInterface::WidthScaleFactorEnum::setUp()
{
addItem( RimPlotInterface::EXTRA_NARROW, "EXTRA_NARROW_TRACK", "Extra Narrow" );
addItem( RimPlotInterface::NARROW, "NARROW_TRACK", "Narrow" );
addItem( RimPlotInterface::NORMAL, "NORMAL_TRACK", "Normal" );
addItem( RimPlotInterface::WIDE, "WIDE_TRACK", "Wide" );
addItem( RimPlotInterface::EXTRA_WIDE, "EXTRA_WIDE_TRACK", "Extra wide" );
setDefault( RimPlotInterface::NORMAL );
}
template <> template <>
void RimPlotInterface::RowOrColSpanEnum::setUp() void RimPlotInterface::RowOrColSpanEnum::setUp()
{ {
addItem( RimPlotInterface::UNLIMITED, "UNLIMITED", "Unlimited" );
addItem( RimPlotInterface::ONE, "ONE", "1" ); addItem( RimPlotInterface::ONE, "ONE", "1" );
addItem( RimPlotInterface::TWO, "TWO", "2" ); addItem( RimPlotInterface::TWO, "TWO", "2" );
addItem( RimPlotInterface::THREE, "THREE", "3" ); addItem( RimPlotInterface::THREE, "THREE", "3" );
addItem( RimPlotInterface::FOUR, "FOUR", "4" ); addItem( RimPlotInterface::FOUR, "FOUR", "4" );
addItem( RimPlotInterface::FIVE, "FIVE", "5" );
setDefault( RimPlotInterface::ONE ); setDefault( RimPlotInterface::ONE );
} }

View File

@ -33,22 +33,14 @@ class QwtPlotCurve;
class RimPlotInterface class RimPlotInterface
{ {
public: public:
enum WidthScaleFactor
{
EXTRA_NARROW = 3,
NARROW = 4,
NORMAL = 5,
WIDE = 7,
EXTRA_WIDE = 10
};
typedef caf::AppEnum<WidthScaleFactor> WidthScaleFactorEnum;
enum RowOrColSpan enum RowOrColSpan
{ {
UNLIMITED = -1,
ONE = 1, ONE = 1,
TWO = 2, TWO = 2,
THREE = 3, THREE = 3,
FOUR = 4 FOUR = 4,
FIVE = 5
}; };
typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum; typedef caf::AppEnum<RowOrColSpan> RowOrColSpanEnum;
@ -64,12 +56,6 @@ public:
virtual QString description() const = 0; virtual QString description() const = 0;
virtual int widthScaleFactor() const
{
return NORMAL;
}
virtual void setWidthScaleFactor( WidthScaleFactor scaleFactor ) {}
virtual int rowSpan() const virtual int rowSpan() const
{ {
return 1; return 1;
@ -78,6 +64,8 @@ public:
{ {
return 1; return 1;
} }
virtual void setRowSpan( RowOrColSpan rowSpan ) {}
virtual void setColSpan( RowOrColSpan colSpan ) {}
virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0; virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0;
virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType, virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
@ -108,5 +96,5 @@ public:
protected: protected:
void updatePlotWindowLayout(); void updatePlotWindowLayout();
virtual void onWidthScaleFactorChange() {} virtual void onRowOrColSpanChange() {}
}; };

View File

@ -156,7 +156,7 @@ RimWellLogTrack::RimWellLogTrack()
CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" );
m_description.uiCapability()->setUiReadOnly( true ); m_description.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitFieldNoDefault( &m_widthScaleFactor, "Width", "Track Width", "", "Set width of track. ", "" ); CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Column Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_curves, "Curves", "", "", "", "" );
m_curves.uiCapability()->setUiHidden( true ); m_curves.uiCapability()->setUiHidden( true );
@ -295,17 +295,17 @@ void RimWellLogTrack::setDescription( const QString& description )
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RimWellLogTrack::widthScaleFactor() const int RimWellLogTrack::colSpan() const
{ {
return static_cast<int>( m_widthScaleFactor() ); return m_colSpan();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::setWidthScaleFactor( WidthScaleFactor scaleFactor ) void RimWellLogTrack::setColSpan( RowOrColSpan colSpan )
{ {
m_widthScaleFactor = scaleFactor; m_colSpan = colSpan;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -471,7 +471,7 @@ void RimWellLogTrack::updateXZoom()
// Attribute range. Fixed range where well components are positioned [-1, 1]. // Attribute range. Fixed range where well components are positioned [-1, 1].
// Set an extended range here to allow for some label space. // Set an extended range here to allow for some label space.
double componentRangeMax = 1.5 * ( 10.0 / ( m_widthScaleFactor() ) ); double componentRangeMax = 1.5 * ( 4 / ( static_cast<int>( m_colSpan() ) ) );
double componentRangeMin = -0.25; double componentRangeMin = -0.25;
if ( m_showWellPathComponentsBothSides ) if ( m_showWellPathComponentsBothSides )
{ {
@ -511,9 +511,9 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
{ {
updatePlotWindowLayout(); updatePlotWindowLayout();
} }
else if ( changedField == &m_widthScaleFactor ) else if ( changedField == &m_colSpan )
{ {
onWidthScaleFactorChange(); onRowOrColSpanChange();
updatePlotWindowLayout(); updatePlotWindowLayout();
} }
else if ( changedField == &m_explicitTickIntervals ) else if ( changedField == &m_explicitTickIntervals )
@ -703,25 +703,25 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals()
{ {
int majorTickIntervals = 3; int majorTickIntervals = 3;
int minorTickIntervals = 0; int minorTickIntervals = 0;
switch ( m_widthScaleFactor() ) switch ( m_colSpan() )
{ {
case EXTRA_NARROW: case ONE:
majorTickIntervals = 3; majorTickIntervals = 3;
minorTickIntervals = 2; minorTickIntervals = 2;
break; break;
case NARROW: case TWO:
majorTickIntervals = 3; majorTickIntervals = 3;
minorTickIntervals = 5; minorTickIntervals = 5;
break; break;
case NORMAL: case THREE:
majorTickIntervals = 5; majorTickIntervals = 5;
minorTickIntervals = 5; minorTickIntervals = 5;
break; break;
case WIDE: case FOUR:
majorTickIntervals = 5; majorTickIntervals = 5;
minorTickIntervals = 10; minorTickIntervals = 10;
break; break;
case EXTRA_WIDE: case FIVE:
majorTickIntervals = 10; majorTickIntervals = 10;
minorTickIntervals = 10; minorTickIntervals = 10;
break; break;
@ -1541,7 +1541,7 @@ caf::PdmObject* RimWellLogTrack::findPdmObjectFromQwtCurve( const QwtPlotCurve*
void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add( &m_description ); uiOrdering.add( &m_description );
uiOrdering.add( &m_widthScaleFactor ); uiOrdering.add( &m_colSpan );
caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" ); caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" );
@ -1729,7 +1729,7 @@ void RimWellLogTrack::updateWellPathAttributesCollection()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogTrack::onWidthScaleFactorChange() void RimWellLogTrack::onRowOrColSpanChange()
{ {
updateXZoom(); updateXZoom();
} }

View File

@ -93,8 +93,9 @@ public:
void setChecked( bool checked ) override; void setChecked( bool checked ) override;
QString description() const override; QString description() const override;
void setDescription( const QString& description ); void setDescription( const QString& description );
int widthScaleFactor() const override;
void setWidthScaleFactor( WidthScaleFactor scaleFactor ) override; int colSpan() const override;
void setColSpan( RowOrColSpan colSpan ) override;
void addCurve( RimWellLogCurve* curve ); void addCurve( RimWellLogCurve* curve );
void insertCurve( RimWellLogCurve* curve, size_t index ); void insertCurve( RimWellLogCurve* curve, size_t index );
@ -123,8 +124,8 @@ public:
void setFormationTrajectoryType( TrajectoryType trajectoryType ); void setFormationTrajectoryType( TrajectoryType trajectoryType );
TrajectoryType formationTrajectoryType() const; TrajectoryType formationTrajectoryType() const;
void createPlotWidget(); void createPlotWidget() override;
void detachAllCurves(); void detachAllCurves() override;
void reattachAllCurves(); void reattachAllCurves();
void loadDataAndUpdate() override; void loadDataAndUpdate() override;
@ -261,7 +262,7 @@ private:
void updateWellPathAttributesCollection(); void updateWellPathAttributesCollection();
void onWidthScaleFactorChange() override; void onRowOrColSpanChange() override;
RimWellLogPlot* parentWellLogPlot() const; RimWellLogPlot* parentWellLogPlot() const;
@ -270,7 +271,7 @@ private:
caf::PdmField<bool> m_show; caf::PdmField<bool> m_show;
caf::PdmField<QString> m_description; caf::PdmField<QString> m_description;
caf::PdmField<RimPlotInterface::WidthScaleFactorEnum> m_widthScaleFactor; caf::PdmField<RimPlotInterface::RowOrColSpanEnum> m_colSpan;
caf::PdmChildArrayField<RimWellLogCurve*> m_curves; caf::PdmChildArrayField<RimWellLogCurve*> m_curves;
caf::PdmField<double> m_visibleXRangeMin; caf::PdmField<double> m_visibleXRangeMin;

View File

@ -155,7 +155,7 @@ RimSummaryPlot::RimSummaryPlot()
CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" ); CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_rowSpan, "RowSpan", "Row Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Col Span", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_colSpan, "ColSpan", "Column Span", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" ); CAF_PDM_InitFieldNoDefault( &m_summaryCurveCollection, "SummaryCurveCollection", "", "", "", "" );
m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true );

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Ceetron Solutions AS
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE.
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "RigWbsParameter.h"
#include "cafAssert.h"
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWbsParameter::RigWbsParameter( const QString& name,
const std::vector<std::pair<RigWbsParameter::Source, QString>>& sources )
: m_name( name )
, m_currentSource( INVALID )
, m_validSources( sources )
{
if ( !m_validSources.empty() )
{
m_currentSource = m_validSources.front();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWbsParameter::addSource( Source source, const QString& entryName )
{
if ( m_currentSource == INVALID )
{
m_currentSource = source;
}
m_validSources.push_back( std::make_pair( source, entryName ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RigWbsParameter::Source RigWbsParameter::currentSource() const
{
return m_currentSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RigWbsParameter::setCurrentSource( Source source ) {}

View File

@ -633,17 +633,10 @@ void RiuMultiPlotWindow::reinsertPlotWidgets()
} }
for ( int c = column; c < column + colSpan; ++c ) for ( int c = column; c < column + colSpan; ++c )
{ {
m_gridLayout->setColumnStretch( c, std::max( 1, m_gridLayout->columnStretch( c ) ) ); int colStretch = 1;
if ( showYAxis( row, column ) ) colStretch += 1;
m_gridLayout->setColumnStretch( c, std::max( colStretch, m_gridLayout->columnStretch( c ) ) );
} }
// Set column stretches for main widget column based on width scale factor
int widthScaleFactor = plotWidgets[visibleIndex]->widthScaleFactor();
if ( showYAxis( row, column ) )
{
widthScaleFactor += 1; // Give it a bit extra room due to axis
}
m_gridLayout->setColumnStretch( column, std::max( m_gridLayout->columnStretch( column ), widthScaleFactor ) );
} }
} }
} }

View File

@ -428,18 +428,6 @@ QPoint RiuQwtPlotWidget::dragStartPosition() const
return m_clickPosition; return m_clickPosition;
} }
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
int RiuQwtPlotWidget::widthScaleFactor() const
{
if ( plotOwner() )
{
return plotDefinition()->widthScaleFactor();
}
return 1;
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@ -98,8 +98,6 @@ public:
bool frameIsInFrontOfThis( const QRect& frameGeometry ); bool frameIsInFrontOfThis( const QRect& frameGeometry );
QPoint dragStartPosition() const; QPoint dragStartPosition() const;
int widthScaleFactor() const;
void scheduleReplot(); void scheduleReplot();
void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState ); void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState );