diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp index 9b6aa34c40..580937f572 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewWellBoreStabilityPlotFeature.cpp @@ -191,7 +191,7 @@ void RicNewWellBoreStabilityPlotFeature::createFormationTrack( RimWellBoreStabil formationTrack->setFormationCase( geoMechCase ); formationTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); formationTrack->setVisibleXRange( 0.0, 0.0 ); - formationTrack->setWidthScaleFactor( RimPlotInterface::NARROW ); + formationTrack->setColSpan( RimPlotInterface::ONE ); } //-------------------------------------------------------------------------------------------------- @@ -202,7 +202,7 @@ void RicNewWellBoreStabilityPlotFeature::createCasingShoeTrack( RimWellBoreStabi RimGeoMechCase* geoMechCase ) { RimWellLogTrack* casingShoeTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Well Design", plot ); - casingShoeTrack->setWidthScaleFactor( RimPlotInterface::NARROW ); + casingShoeTrack->setColSpan( RimPlotInterface::ONE ); casingShoeTrack->setFormationWellPath( wellPath ); casingShoeTrack->setFormationCase( geoMechCase ); casingShoeTrack->setAnnotationType( RiuPlotAnnotationTool::FORMATION_ANNOTATIONS ); @@ -226,7 +226,7 @@ void RicNewWellBoreStabilityPlotFeature::createParametersTrack( RimWellBoreStabi RimWellLogTrack* paramCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "WBS Parameters", plot ); - paramCurvesTrack->setWidthScaleFactor( RimPlotInterface::WIDE ); + paramCurvesTrack->setColSpan( RimPlotInterface::TWO ); paramCurvesTrack->setAutoScaleXEnabled( true ); paramCurvesTrack->setTickIntervals( 0.5, 0.05 ); paramCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); @@ -272,7 +272,7 @@ void RicNewWellBoreStabilityPlotFeature::createStabilityCurvesTrack( RimWellBore RimWellLogTrack* stabilityCurvesTrack = RicNewWellLogPlotFeatureImpl::createWellLogPlotTrack( false, "Stability Curves", plot ); - stabilityCurvesTrack->setWidthScaleFactor( RimPlotInterface::EXTRA_WIDE ); + stabilityCurvesTrack->setColSpan( RimPlotInterface::FIVE ); stabilityCurvesTrack->setAutoScaleXEnabled( true ); stabilityCurvesTrack->setTickIntervals( 0.5, 0.05 ); stabilityCurvesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); @@ -361,7 +361,7 @@ void RicNewWellBoreStabilityPlotFeature::createAnglesTrack( RimWellBoreStability maxValue = cvf::Math::clamp( maxValue, angleIncrement, 360.0 ); minValue = cvf::Math::clamp( minValue, 0.0, maxValue - 90.0 ); } - wellPathAnglesTrack->setWidthScaleFactor( RimPlotInterface::NORMAL ); + wellPathAnglesTrack->setColSpan( RimPlotInterface::THREE ); wellPathAnglesTrack->setVisibleXRange( minValue, maxValue ); wellPathAnglesTrack->setTickIntervals( 90.0, 30.0 ); wellPathAnglesTrack->setXAxisGridVisibility( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR ); diff --git a/ApplicationCode/ProjectDataModel/RimPlotInterface.cpp b/ApplicationCode/ProjectDataModel/RimPlotInterface.cpp index e98cbf6eef..5a08ac85f8 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotInterface.cpp +++ b/ApplicationCode/ProjectDataModel/RimPlotInterface.cpp @@ -9,24 +9,15 @@ 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 <> void RimPlotInterface::RowOrColSpanEnum::setUp() { + addItem( RimPlotInterface::UNLIMITED, "UNLIMITED", "Unlimited" ); addItem( RimPlotInterface::ONE, "ONE", "1" ); addItem( RimPlotInterface::TWO, "TWO", "2" ); addItem( RimPlotInterface::THREE, "THREE", "3" ); addItem( RimPlotInterface::FOUR, "FOUR", "4" ); + addItem( RimPlotInterface::FIVE, "FIVE", "5" ); setDefault( RimPlotInterface::ONE ); } diff --git a/ApplicationCode/ProjectDataModel/RimPlotInterface.h b/ApplicationCode/ProjectDataModel/RimPlotInterface.h index 753da85c90..c2ebc08683 100644 --- a/ApplicationCode/ProjectDataModel/RimPlotInterface.h +++ b/ApplicationCode/ProjectDataModel/RimPlotInterface.h @@ -33,22 +33,14 @@ class QwtPlotCurve; class RimPlotInterface { public: - enum WidthScaleFactor - { - EXTRA_NARROW = 3, - NARROW = 4, - NORMAL = 5, - WIDE = 7, - EXTRA_WIDE = 10 - }; - typedef caf::AppEnum WidthScaleFactorEnum; - enum RowOrColSpan { - ONE = 1, - TWO = 2, - THREE = 3, - FOUR = 4 + UNLIMITED = -1, + ONE = 1, + TWO = 2, + THREE = 3, + FOUR = 4, + FIVE = 5 }; typedef caf::AppEnum RowOrColSpanEnum; @@ -64,12 +56,6 @@ public: virtual QString description() const = 0; - virtual int widthScaleFactor() const - { - return NORMAL; - } - virtual void setWidthScaleFactor( WidthScaleFactor scaleFactor ) {} - virtual int rowSpan() const { return 1; @@ -78,6 +64,8 @@ public: { return 1; } + virtual void setRowSpan( RowOrColSpan rowSpan ) {} + virtual void setColSpan( RowOrColSpan colSpan ) {} virtual bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const = 0; virtual bool applyFontSize( RiaDefines::FontSettingType fontSettingType, @@ -108,5 +96,5 @@ public: protected: void updatePlotWindowLayout(); - virtual void onWidthScaleFactorChange() {} + virtual void onRowOrColSpanChange() {} }; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp index 146898a975..dc2b896385 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.cpp @@ -156,7 +156,7 @@ RimWellLogTrack::RimWellLogTrack() CAF_PDM_InitFieldNoDefault( &m_description, "TrackDescription", "Name", "", "", "" ); 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", "", "", "", "" ); 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( 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]. // 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( m_colSpan() ) ) ); double componentRangeMin = -0.25; if ( m_showWellPathComponentsBothSides ) { @@ -511,9 +511,9 @@ void RimWellLogTrack::fieldChangedByUi( const caf::PdmFieldHandle* changedField, { updatePlotWindowLayout(); } - else if ( changedField == &m_widthScaleFactor ) + else if ( changedField == &m_colSpan ) { - onWidthScaleFactorChange(); + onRowOrColSpanChange(); updatePlotWindowLayout(); } else if ( changedField == &m_explicitTickIntervals ) @@ -703,25 +703,25 @@ void RimWellLogTrack::updateXAxisAndGridTickIntervals() { int majorTickIntervals = 3; int minorTickIntervals = 0; - switch ( m_widthScaleFactor() ) + switch ( m_colSpan() ) { - case EXTRA_NARROW: + case ONE: majorTickIntervals = 3; minorTickIntervals = 2; break; - case NARROW: + case TWO: majorTickIntervals = 3; minorTickIntervals = 5; break; - case NORMAL: + case THREE: majorTickIntervals = 5; minorTickIntervals = 5; break; - case WIDE: + case FOUR: majorTickIntervals = 5; minorTickIntervals = 10; break; - case EXTRA_WIDE: + case FIVE: majorTickIntervals = 10; minorTickIntervals = 10; break; @@ -1541,7 +1541,7 @@ caf::PdmObject* RimWellLogTrack::findPdmObjectFromQwtCurve( const QwtPlotCurve* void RimWellLogTrack::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { uiOrdering.add( &m_description ); - uiOrdering.add( &m_widthScaleFactor ); + uiOrdering.add( &m_colSpan ); caf::PdmUiGroup* annotationGroup = uiOrdering.addNewGroup( "Regions/Annotations" ); @@ -1729,7 +1729,7 @@ void RimWellLogTrack::updateWellPathAttributesCollection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogTrack::onWidthScaleFactorChange() +void RimWellLogTrack::onRowOrColSpanChange() { updateXZoom(); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h index 0c13a4bb62..288e3f5ca1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogTrack.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogTrack.h @@ -93,8 +93,9 @@ public: void setChecked( bool checked ) override; QString description() const override; 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 insertCurve( RimWellLogCurve* curve, size_t index ); @@ -123,8 +124,8 @@ public: void setFormationTrajectoryType( TrajectoryType trajectoryType ); TrajectoryType formationTrajectoryType() const; - void createPlotWidget(); - void detachAllCurves(); + void createPlotWidget() override; + void detachAllCurves() override; void reattachAllCurves(); void loadDataAndUpdate() override; @@ -261,16 +262,16 @@ private: void updateWellPathAttributesCollection(); - void onWidthScaleFactorChange() override; + void onRowOrColSpanChange() override; RimWellLogPlot* parentWellLogPlot() const; private: QString m_xAxisTitle; - caf::PdmField m_show; - caf::PdmField m_description; - caf::PdmField m_widthScaleFactor; + caf::PdmField m_show; + caf::PdmField m_description; + caf::PdmField m_colSpan; caf::PdmChildArrayField m_curves; caf::PdmField m_visibleXRangeMin; diff --git a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp index 4e52c3ca31..ff15c3a680 100644 --- a/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Summary/RimSummaryPlot.cpp @@ -155,7 +155,7 @@ RimSummaryPlot::RimSummaryPlot() CAF_PDM_InitField( &m_normalizeCurveYValues, "normalizeCurveYValues", false, "Normalize all curves", "", "", "" ); 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", "", "", "", "" ); m_summaryCurveCollection.uiCapability()->setUiTreeHidden( true ); diff --git a/ApplicationCode/ReservoirDataModel/RigWbsParameter.cpp b/ApplicationCode/ReservoirDataModel/RigWbsParameter.cpp new file mode 100644 index 0000000000..f02f5998d7 --- /dev/null +++ b/ApplicationCode/ReservoirDataModel/RigWbsParameter.cpp @@ -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 +// for more details. +// +///////////////////////////////////////////////////////////////////////////////// +#include "RigWbsParameter.h" + +#include "cafAssert.h" + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +RigWbsParameter::RigWbsParameter( const QString& name, + const std::vector>& 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 ) {} diff --git a/ApplicationCode/UserInterface/RiuMultiPlotWindow.cpp b/ApplicationCode/UserInterface/RiuMultiPlotWindow.cpp index 47b5d3158a..aed8cb4d7f 100644 --- a/ApplicationCode/UserInterface/RiuMultiPlotWindow.cpp +++ b/ApplicationCode/UserInterface/RiuMultiPlotWindow.cpp @@ -633,17 +633,10 @@ void RiuMultiPlotWindow::reinsertPlotWidgets() } 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 ) ); } } } diff --git a/ApplicationCode/UserInterface/RiuQwtPlotWidget.cpp b/ApplicationCode/UserInterface/RiuQwtPlotWidget.cpp index cd86472d61..4262393750 100644 --- a/ApplicationCode/UserInterface/RiuQwtPlotWidget.cpp +++ b/ApplicationCode/UserInterface/RiuQwtPlotWidget.cpp @@ -428,18 +428,6 @@ QPoint RiuQwtPlotWidget::dragStartPosition() const return m_clickPosition; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -int RiuQwtPlotWidget::widthScaleFactor() const -{ - if ( plotOwner() ) - { - return plotDefinition()->widthScaleFactor(); - } - return 1; -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- diff --git a/ApplicationCode/UserInterface/RiuQwtPlotWidget.h b/ApplicationCode/UserInterface/RiuQwtPlotWidget.h index 05e5c0da8a..a24f6b26ce 100644 --- a/ApplicationCode/UserInterface/RiuQwtPlotWidget.h +++ b/ApplicationCode/UserInterface/RiuQwtPlotWidget.h @@ -98,8 +98,6 @@ public: bool frameIsInFrontOfThis( const QRect& frameGeometry ); QPoint dragStartPosition() const; - int widthScaleFactor() const; - void scheduleReplot(); void setWidgetState( RiuWidgetStyleSheet::StateTag widgetState );