Merge pull request #4686 from OPM/system-refactor-welllogplot

#4665 System refactor welllogplot
This commit is contained in:
Gaute Lindkvist
2019-09-10 08:26:32 +02:00
committed by GitHub
39 changed files with 544 additions and 1340 deletions

View File

@@ -112,8 +112,8 @@ void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
pltPlot->setCurrentWellName( wellPathName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->wellLogPlot()->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->wellLogPlot()->trackCount() ) );
pltPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->trackCount() ) );
pltPlotColl->addPlot( pltPlot );
pltPlot->setDescription( plotName );

View File

@@ -73,8 +73,8 @@ void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->wellLogPlot()->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->wellLogPlot()->trackCount() ) );
rftPlot->addTrack( plotTrack );
plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot( rftPlot );
rftPlot->setDescription( plotName );

View File

@@ -121,6 +121,10 @@ RimWellAllocationPlot::RimWellAllocationPlot()
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
this->setAsPlotMdiWindow();
m_accumulatedWellFlowPlot->setAvailableDepthUnits( {} );
m_accumulatedWellFlowPlot->setAvailableDepthTypes(
{RimWellLogPlot::CONNECTION_NUMBER, RimWellLogPlot::TRUE_VERTICAL_DEPTH, RimWellLogPlot::PSEUDO_LENGTH} );
}
//--------------------------------------------------------------------------------------------------

View File

@@ -57,8 +57,6 @@
#include "RimWellPathCollection.h"
#include "RimWellPlotTools.h"
#include "RiuWellPltPlot.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
#include "cafVecIjk.h"
@@ -100,18 +98,16 @@ const char RimWellPltPlot::PLOT_NAME_QFORMAT_STRING[] = "PLT: %1";
///
//--------------------------------------------------------------------------------------------------
RimWellPltPlot::RimWellPltPlot()
: RimWellLogPlot()
{
CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "PLT Plot" ), "Name", "", "", "" );
m_userName.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot, "WellLog", "WellLog", "", "", "" );
m_wellLogPlot.uiCapability()->setUiHidden( true );
m_wellLogPlot = new RimWellLogPlot();
m_wellLogPlot->setDepthType( RimWellLogPlot::MEASURED_DEPTH );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" );
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault( &m_wellPathName, "WellName", "Well Name", "", "", "" );
@@ -137,9 +133,13 @@ RimWellPltPlot::RimWellPltPlot()
m_phases = std::vector<caf::AppEnum<FlowPhase>>( {FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER} );
m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_nameConfig->setCustomName( "PLT Plot" );
this->setAsPlotMdiWindow();
m_doInitAfterLoad = false;
m_isOnLoad = true;
setAvailableDepthTypes( {RimWellLogPlot::MEASURED_DEPTH} );
}
//--------------------------------------------------------------------------------------------------
@@ -152,18 +152,6 @@ RimWellPltPlot::~RimWellPltPlot()
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::deleteViewWidget()
{
if ( m_wellLogPlotWidget )
{
m_wellLogPlotWidget->deleteLater();
m_wellLogPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -238,12 +226,12 @@ void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack )
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::updateFormationsOnPlot() const
{
if ( m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName( m_wellPathName );
RimCase* formationNamesCase = m_wellLogPlot->trackByIndex( 0 )->formationNamesCase();
RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase();
if ( !formationNamesCase )
{
@@ -257,27 +245,7 @@ void RimWellPltPlot::updateFormationsOnPlot() const
}
}
m_wellLogPlot->trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::updateWidgetTitleWindowTitle()
{
updateMdiWindowTitle();
if ( m_wellLogPlotWidget )
{
if ( m_showPlotTitle )
{
m_wellLogPlotWidget->showTitle( m_userName );
}
else
{
m_wellLogPlotWidget->hideTitle();
}
trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
}
}
@@ -515,7 +483,7 @@ public:
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::syncCurvesFromUiSelection()
{
RimWellLogTrack* plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* plotTrack = trackByIndex( 0 );
const std::set<RiaRftPltCurveDefinition>& curveDefs = selectedCurveDefs();
setPlotXAxisTitles( plotTrack );
@@ -729,8 +697,7 @@ void RimWellPltPlot::syncCurvesFromUiSelection()
curveGroupId++;
}
updateWidgetTitleWindowTitle();
m_wellLogPlot->loadDataAndUpdate();
RimWellLogPlot::onLoadDataAndUpdate();
plotTrack->calculateXZoomRange();
}
@@ -787,30 +754,6 @@ std::vector<RifDataSourceForRftPlt> RimWellPltPlot::selectedSourcesExpanded() co
return sources;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellPltPlot::viewWidget()
{
return m_wellLogPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::zoomAll()
{
m_wellLogPlot()->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RimWellPltPlot::wellLogPlot() const
{
return m_wellLogPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -833,8 +776,9 @@ const char* RimWellPltPlot::plotNameFormatString()
QList<caf::PdmOptionItemInfo> RimWellPltPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName );
QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName );
if ( fieldNeedingOptions == &m_wellPathName )
{
@@ -930,7 +874,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
RimWellLogPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_wellPathName )
{
@@ -939,7 +883,7 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
if ( changedField == &m_wellPathName )
{
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
plotTrack->deleteAllCurves();
m_selectedSources.v().clear();
m_selectedTimeSteps.v().clear();
@@ -977,9 +921,9 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateFormationsOnPlot();
syncSourcesIoFieldFromGuiField();
syncCurvesFromUiSelection();
m_wellLogPlot->updateDepthZoom();
updateDepthZoom();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
plotTrack->calculateXZoomRangeAndUpdateQwt();
}
@@ -987,9 +931,9 @@ void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
changedField == &m_phases )
{
syncCurvesFromUiSelection();
m_wellLogPlot->updateDepthZoom();
updateDepthZoom();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
plotTrack->calculateXZoomRangeAndUpdateQwt();
}
}
@@ -1002,22 +946,6 @@ void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellPltPlot::snapshotWindowContent()
{
QImage image;
if ( m_wellLogPlotWidget )
{
QPixmap pix = QPixmap::grabWidget( m_wellLogPlotWidget );
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1025,7 +953,6 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
{
const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName );
uiOrdering.add( &m_userName );
uiOrdering.add( &m_wellPathName );
caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword( "Sources", "Sources" );
@@ -1040,20 +967,20 @@ void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
flowGroup->add( &m_phases );
if ( m_wellLogPlot && m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
RimWellLogTrack* track = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* track = trackByIndex( 0 );
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
legendAndAxisGroup->setCollapsedByDefault( true );
m_wellLogPlot->uiOrderingForPlotSettings( *legendAndAxisGroup );
uiOrderingForPlotSettings( *legendAndAxisGroup );
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
m_wellLogPlot->uiOrderingForDepthAxis( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
}
uiOrdering.skipRemainingFields( true );
@@ -1082,6 +1009,19 @@ void RimWellPltPlot::initAfterRead()
{
RimViewWindow::initAfterRead();
if ( m_wellLogPlot_OBSOLETE )
{
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
}
if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() )
{
m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
// Postpone init until data has been loaded
m_doInitAfterLoad = true;
}
@@ -1142,24 +1082,6 @@ void RimWellPltPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo
options.push_back( caf::PdmOptionItemInfo( "None", "" ) );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellPltPlot::setDescription( const QString& description )
{
m_userName = description;
updateWidgetTitleWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellPltPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1173,9 +1095,9 @@ void RimWellPltPlot::onLoadDataAndUpdate()
if ( m_isOnLoad )
{
if ( m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
m_wellLogPlot->trackByIndex( 0 )->setShowFormations( true );
trackByIndex( 0 )->setShowFormations( true );
}
m_isOnLoad = false;
}
@@ -1183,14 +1105,4 @@ void RimWellPltPlot::onLoadDataAndUpdate()
updateMdiWindowVisibility();
updateFormationsOnPlot();
syncCurvesFromUiSelection();
m_wellLogPlot->loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellPltPlot::createViewWidget( QWidget* mainWindowParent )
{
m_wellLogPlotWidget = new RiuWellPltPlot( this, mainWindowParent );
return m_wellLogPlotWidget;
}

View File

@@ -19,6 +19,7 @@
#include "RifDataSourceForRftPltQMetaType.h"
#include "RimWellLogPlot.h"
#include "RimWellPlotTools.h"
#include "cafPdmChildArrayField.h"
@@ -38,7 +39,6 @@ class RimEclipseCase;
class RimEclipseResultCase;
class RimWellLogCurve;
class RimWellLogFileChannel;
class RimWellLogPlot;
class RimWellPath;
class RiuWellPltPlot;
class RimWellLogTrack;
@@ -59,7 +59,7 @@ class PdmOptionItemInfo;
///
///
//==================================================================================================
class RimWellPltPlot : public RimViewWindow
class RimWellPltPlot : public RimWellLogPlot
{
CAF_PDM_HEADER_INIT;
@@ -69,24 +69,12 @@ public:
RimWellPltPlot();
~RimWellPltPlot() override;
void setDescription( const QString& description );
QString description() const;
QWidget* viewWidget() override;
void zoomAll() override;
RimWellLogPlot* wellLogPlot() const;
void setCurrentWellName( const QString& currWellName );
static const char* plotNameFormatString();
protected:
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override
{
return &m_userName;
}
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
@@ -96,8 +84,6 @@ protected:
bool* useOptionsOnly ) override;
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
QImage snapshotWindowContent() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
@@ -125,17 +111,12 @@ private:
// RimViewWindow overrides
void updateWidgetTitleWindowTitle();
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void setPlotXAxisTitles( RimWellLogTrack* plotTrack );
void updateFormationsOnPlot() const;
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<QString> m_wellPathName;
@@ -144,9 +125,7 @@ private:
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
QPointer<RiuWellPltPlot> m_wellLogPlotWidget;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
caf::PdmField<bool> m_useStandardConditionCurves;
caf::PdmField<bool> m_useReservoirConditionCurves;

View File

@@ -53,7 +53,6 @@
#include "RimWellPltPlot.h"
#include "RiuWellLogTrack.h"
#include "RiuWellRftPlot.h"
#include "cafPdmUiTreeOrdering.h"
#include "cafPdmUiTreeSelectionEditor.h"
@@ -73,20 +72,21 @@ const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1";
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot::RimWellRftPlot()
: RimWellLogPlot()
{
CAF_PDM_InitObject( "Well Allocation Plot", ":/RFTPlot16x16.png", "", "" );
CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" );
CAF_PDM_InitField( &m_userName, "PlotDescription", QString( "RFT Plot" ), "Name", "", "", "" );
m_userName.uiCapability()->setUiReadOnly( true );
CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField( &m_showPlotTitle, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" );
CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot, "WellLog", "Well Log", "", "", "" );
m_wellLogPlot.uiCapability()->setUiHidden( true );
m_wellLogPlot = new RimWellLogPlot();
m_wellLogPlot->setDepthType( RimWellLogPlot::TRUE_VERTICAL_DEPTH );
CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "Well Log", "", "", "" );
m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
m_depthType = RimWellLogPlot::TRUE_VERTICAL_DEPTH;
CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "" );
CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" );
@@ -110,6 +110,9 @@ RimWellRftPlot::RimWellRftPlot()
m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue( false );
m_nameConfig->setCustomName( "RFT Plot" );
m_trackLegendsHorizontal = true;
this->setAsPlotMdiWindow();
m_isOnLoad = true;
}
@@ -124,18 +127,6 @@ RimWellRftPlot::~RimWellRftPlot()
deleteViewWidget();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::deleteViewWidget()
{
if ( m_wellLogPlotWidget )
{
m_wellLogPlotWidget->deleteLater();
m_wellLogPlotWidget = nullptr;
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -153,7 +144,7 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve )
if ( m_showStatisticsCurves )
{
cvf::Color3f backgroundColor = RiaColorTools::fromQColorTo3f(
m_wellLogPlot->trackByIndex( 0 )->viewer()->canvasBackground().color() );
trackByIndex( 0 )->viewer()->canvasBackground().color() );
currentColor = RiaColorTools::blendCvfColors( backgroundColor, currentColor, 2, 1 );
}
}
@@ -184,12 +175,12 @@ void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve )
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateFormationsOnPlot() const
{
if ( m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
RimProject* proj = RiaApplication::instance()->project();
RimWellPath* wellPath = proj->wellPathByName( m_wellPathNameOrSimWellName );
RimCase* formationNamesCase = m_wellLogPlot->trackByIndex( 0 )->formationNamesCase();
RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase();
if ( !formationNamesCase )
{
@@ -205,14 +196,14 @@ void RimWellRftPlot::updateFormationsOnPlot() const
if ( wellPath )
{
m_wellLogPlot->trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath );
}
else
{
m_wellLogPlot->trackByIndex( 0 )->setAndUpdateSimWellFormationNamesAndBranchData( formationNamesCase,
associatedSimWellName(),
m_branchIndex,
m_branchDetection );
trackByIndex( 0 )->setAndUpdateSimWellFormationNamesAndBranchData( formationNamesCase,
associatedSimWellName(),
m_branchIndex,
m_branchDetection );
}
}
}
@@ -309,32 +300,12 @@ void RimWellRftPlot::updateEditorsFromCurves()
m_selectedTimeSteps = std::vector<QDateTime>( selectedTimeSteps.begin(), selectedTimeSteps.end() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::updateWidgetTitleWindowTitle()
{
updateMdiWindowTitle();
if ( m_wellLogPlotWidget )
{
if ( m_showPlotTitle )
{
m_wellLogPlotWidget->showTitle( m_userName );
}
else
{
m_wellLogPlotWidget->hideTitle();
}
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::syncCurvesFromUiSelection()
{
RimWellLogTrack* plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* plotTrack = trackByIndex( 0 );
const std::set<RiaRftPltCurveDefinition>& allCurveDefs = selectedCurveDefs();
const std::set<RiaRftPltCurveDefinition>& curveDefsInPlot = curveDefsFromCurves();
@@ -396,7 +367,7 @@ std::set<RiaRftPltCurveDefinition> RimWellRftPlot::curveDefsFromCurves() const
{
std::set<RiaRftPltCurveDefinition> curveDefs;
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
for ( RimWellLogCurve* const curve : plotTrack->curvesVector() )
{
curveDefs.insert( RimWellPlotTools::curveDefFromCurve( curve ) );
@@ -412,7 +383,7 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
const std::set<RimWellLogCurve*>& curvesToDelete )
{
const QString simWellName = associatedSimWellName();
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
// Delete curves
plotTrack->deleteAllCurves();
@@ -564,15 +535,15 @@ void RimWellRftPlot::updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition
}
}
if ( m_wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
if ( depthType() == RimWellLogPlot::MEASURED_DEPTH )
{
assignWellPathToExtractionCurves();
}
m_wellLogPlot->loadDataAndUpdate();
RimWellLogPlot::onLoadDataAndUpdate();
if ( plotTrack->curveCount() )
{
m_wellLogPlot->zoomAll();
zoomAll();
}
}
@@ -598,30 +569,6 @@ std::vector<RifDataSourceForRftPlt> RimWellRftPlot::selectedSourcesExpanded() co
return sources;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellRftPlot::viewWidget()
{
return m_wellLogPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::zoomAll()
{
m_wellLogPlot()->zoomAll();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlot* RimWellRftPlot::wellLogPlot() const
{
return m_wellLogPlot();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -663,7 +610,7 @@ const char* RimWellRftPlot::plotNameFormatString()
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData )
{
for ( auto track : m_wellLogPlot->tracks() )
for ( auto track : tracks() )
{
auto curves = track->curvesVector();
for ( auto curve : curves )
@@ -684,7 +631,7 @@ void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedF
QList<caf::PdmOptionItemInfo> RimWellRftPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{
QList<caf::PdmOptionItemInfo> options;
QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
const QString simWellName = associatedSimWellName();
@@ -797,7 +744,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{
RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
RimWellLogPlot::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_wellPathNameOrSimWellName )
{
@@ -805,7 +752,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_branchIndex = 0;
RimWellLogTrack* const plotTrack = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* const plotTrack = trackByIndex( 0 );
if ( plotTrack )
{
plotTrack->deleteAllCurves();
@@ -834,7 +781,7 @@ void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
syncCurvesFromUiSelection();
}
else if ( changedField == &m_showPlotTitle )
else if ( changedField == &m_showTitleInPlot )
{
// m_wellLogPlot->setShowDescription(m_showPlotTitle);
}
@@ -848,28 +795,11 @@ void RimWellRftPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrderin
uiTreeOrdering.skipRemainingChildren( true );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QImage RimWellRftPlot::snapshotWindowContent()
{
QImage image;
if ( m_wellLogPlotWidget )
{
QPixmap pix = QPixmap::grabWidget( m_wellLogPlotWidget );
image = pix.toImage();
}
return image;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{
uiOrdering.add( &m_userName );
uiOrdering.add( &m_wellPathNameOrSimWellName );
uiOrdering.add( &m_showStatisticsCurves );
uiOrdering.add( &m_showEnsembleCurves );
@@ -897,20 +827,18 @@ void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword( "Time Steps", "TimeSteps" );
timeStepsGroup->add( &m_selectedTimeSteps );
if ( m_wellLogPlot && m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
RimWellLogTrack* track = m_wellLogPlot->trackByIndex( 0 );
RimWellLogTrack* track = trackByIndex( 0 );
track->uiOrderingForRftPltFormations( uiOrdering );
caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" );
legendAndAxisGroup->setCollapsedByDefault( true );
m_wellLogPlot->uiOrderingForPlotSettings( *legendAndAxisGroup );
uiOrderingForPlotSettings( *legendAndAxisGroup );
track->uiOrderingForXAxisSettings( *legendAndAxisGroup );
m_wellLogPlot->uiOrderingForDepthAxis( *legendAndAxisGroup );
uiOrderingForDepthAxis( *legendAndAxisGroup );
}
uiOrdering.skipRemainingFields( true );
@@ -990,24 +918,6 @@ void RimWellRftPlot::calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::setDescription( const QString& description )
{
m_userName = description;
updateWidgetTitleWindowTitle();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QString RimWellRftPlot::description() const
{
return m_userName();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1015,9 +925,9 @@ void RimWellRftPlot::onLoadDataAndUpdate()
{
if ( m_isOnLoad )
{
if ( m_wellLogPlot->trackCount() > 0 )
if ( trackCount() > 0 )
{
m_wellLogPlot->trackByIndex( 0 )->setShowFormations( true );
trackByIndex( 0 )->setShowFormations( true );
}
m_isOnLoad = false;
@@ -1026,17 +936,32 @@ void RimWellRftPlot::onLoadDataAndUpdate()
updateMdiWindowVisibility();
updateFormationsOnPlot();
if ( m_wellLogPlot->depthType() == RimWellLogPlot::MEASURED_DEPTH )
if ( depthType() == RimWellLogPlot::MEASURED_DEPTH )
{
assignWellPathToExtractionCurves();
}
m_wellLogPlot->loadDataAndUpdate();
RimWellLogPlot::onLoadDataAndUpdate();
updateEditorsFromCurves();
updateWidgetTitleWindowTitle();
}
// applyInitialSelections();
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::initAfterRead()
{
if ( m_wellLogPlot_OBSOLETE )
{
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() );
}
if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() )
{
m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
}
RimWellLogPlot::initAfterRead();
}
//--------------------------------------------------------------------------------------------------
@@ -1049,7 +974,7 @@ void RimWellRftPlot::assignWellPathToExtractionCurves()
if ( wellPath )
{
for ( RimWellLogCurve* curve : m_wellLogPlot->trackByIndex( 0 )->curvesVector() )
for ( RimWellLogCurve* curve : trackByIndex( 0 )->curvesVector() )
{
auto extractionCurve = dynamic_cast<RimWellLogExtractionCurve*>( curve );
if ( extractionCurve )
@@ -1061,16 +986,6 @@ void RimWellRftPlot::assignWellPathToExtractionCurves()
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QWidget* RimWellRftPlot::createViewWidget( QWidget* mainWindowParent )
{
m_wellLogPlotWidget = new RiuWellRftPlot( this, mainWindowParent );
return m_wellLogPlotWidget;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1155,6 +1070,14 @@ void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveD
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellRftPlot::onDepthTypeChanged()
{
loadDataAndUpdate();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------

View File

@@ -19,6 +19,7 @@
#pragma once
#include "RimViewWindow.h"
#include "RimWellLogPlot.h"
#include "RifDataSourceForRftPltQMetaType.h"
#include "RiuQwtSymbol.h"
@@ -40,7 +41,6 @@ class RimEclipseCase;
class RimEclipseResultCase;
class RimWellLogCurve;
class RimWellLogFileChannel;
class RimWellLogPlot;
class RimWellPath;
class RiuWellRftPlot;
class RigEclipseCaseData;
@@ -62,7 +62,7 @@ class PdmOptionItemInfo;
///
///
//==================================================================================================
class RimWellRftPlot : public RimViewWindow
class RimWellRftPlot : public RimWellLogPlot
{
CAF_PDM_HEADER_INIT;
@@ -73,14 +73,6 @@ public:
RimWellRftPlot();
~RimWellRftPlot() override;
void setDescription( const QString& description );
QString description() const;
QWidget* viewWidget() override;
void zoomAll() override;
RimWellLogPlot* wellLogPlot() const;
const QString& simWellOrWellPathName() const;
void setSimWellOrWellPathName( const QString& currWellName );
@@ -93,11 +85,6 @@ public:
void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData );
protected:
// Overridden PDM methods
caf::PdmFieldHandle* userDescriptionField() override
{
return &m_userName;
}
void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
@@ -106,15 +93,13 @@ protected:
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
QImage snapshotWindowContent() override;
void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override;
private:
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void updateEditorsFromCurves();
void updateWidgetTitleWindowTitle();
void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves();
@@ -131,9 +116,6 @@ private:
// RimViewWindow overrides
QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override;
void applyCurveAppearance( RimWellLogCurve* newCurve );
void updateFormationsOnPlot() const;
@@ -144,10 +126,9 @@ private:
void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
private:
caf::PdmField<bool> m_showPlotTitle;
caf::PdmField<QString> m_userName;
void onDepthTypeChanged() override;
private:
caf::PdmField<QString> m_wellPathNameOrSimWellName;
caf::PdmField<int> m_branchIndex;
caf::PdmField<bool> m_branchDetection;
@@ -158,9 +139,8 @@ private:
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot;
QPointer<RiuWellRftPlot> m_wellLogPlotWidget;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;

View File

@@ -61,6 +61,7 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
m_nameConfig = new RimGridCrossPlotNameConfig();
CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "" );
m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
@@ -76,8 +77,6 @@ RimGridCrossPlot::RimGridCrossPlot()
CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "" );
m_crossPlotDataSets.uiCapability()->setUiHidden( true );
m_nameConfig = new RimGridCrossPlotNameConfig( this );
}
//--------------------------------------------------------------------------------------------------
@@ -963,8 +962,8 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig( RimNameConfigHolderInterface* holder /*= nullptr*/ )
: RimNameConfig( holder )
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Cross Plot Name Generator", "", "", "" );

View File

@@ -40,7 +40,7 @@ class RimGridCrossPlotNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlotNameConfig( RimNameConfigHolderInterface* holder = nullptr );
RimGridCrossPlotNameConfig();
public:
caf::PdmField<bool> addDataSetNames;

View File

@@ -114,7 +114,7 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet()
m_groupingProperty->setTernaryEnabled( false );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name", "", "", "" );
m_nameConfig = new RimGridCrossPlotDataSetNameConfig( this );
m_nameConfig = new RimGridCrossPlotDataSetNameConfig();
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
@@ -1380,8 +1380,8 @@ CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSe
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig( RimNameConfigHolderInterface* parent )
: RimNameConfig( parent )
RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Cross Plot Data Set NameGenerator", "", "", "" );

View File

@@ -58,7 +58,7 @@ class RimGridCrossPlotDataSetNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimGridCrossPlotDataSetNameConfig( RimNameConfigHolderInterface* parent = nullptr );
RimGridCrossPlotDataSetNameConfig();
caf::PdmField<bool> addCaseName;
caf::PdmField<bool> addAxisVariables;

View File

@@ -84,7 +84,7 @@ Rim3dView::Rim3dView( void )
CVF_ASSERT( preferences );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimViewNameConfig( this );
m_nameConfig = new RimViewNameConfig();
CAF_PDM_InitField( &m_name_OBSOLETE, "UserDescription", QString( "" ), "Name", "", "", "" );
m_name_OBSOLETE.xmlCapability()->setIOWritable( false );

View File

@@ -85,7 +85,7 @@ Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
m_geomResultDefinition->setAddWellPathDerivedResults( true );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogExtractionCurveNameConfig( this );
m_nameConfig = new RimWellLogExtractionCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -46,16 +46,13 @@ Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogFileCurveNameConfig( this );
m_nameConfig = new RimWellLogFileCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
{
delete m_nameConfig;
}
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() {}
//--------------------------------------------------------------------------------------------------
///

View File

@@ -55,7 +55,7 @@ Rim3dWellLogRftCurve::Rim3dWellLogRftCurve()
m_2dWellLogRftCurve.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogRftCurveNameConfig( this );
m_nameConfig = new RimWellLogRftCurveNameConfig();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -31,8 +31,7 @@ CAF_PDM_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimNameConfig::RimNameConfig( const RimNameConfigHolderInterface* configHolder /*= nullptr*/ )
: m_configHolder( configHolder )
RimNameConfig::RimNameConfig()
{
CAF_PDM_InitObject( "Curve Name Generator", "", "", "" );
@@ -106,7 +105,9 @@ void RimNameConfig::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
//--------------------------------------------------------------------------------------------------
QString RimNameConfig::autoName() const
{
return m_configHolder->createAutoName();
RimNameConfigHolderInterface* plotHolder;
this->firstAncestorOrThisOfTypeAsserted( plotHolder );
return plotHolder->createAutoName();
}
//--------------------------------------------------------------------------------------------------

View File

@@ -48,8 +48,9 @@ class RimNameConfig : public caf::PdmObject
CAF_PDM_HEADER_INIT;
public:
RimNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
RimNameConfig();
~RimNameConfig() override;
QString customName() const;
void setCustomName( const QString& name );
virtual void enableAllAutoNameTags( bool enable ) {}
@@ -71,6 +72,4 @@ protected:
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
caf::PdmField<QString> m_customName;
caf::PdmProxyValueField<QString> m_autoName;
const RimNameConfigHolderInterface* m_configHolder;
};

View File

@@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT( RimViewNameConfig, "RimViewNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewNameConfig::RimViewNameConfig( const RimNameConfigHolderInterface* configHolder )
: RimNameConfig( configHolder )
RimViewNameConfig::RimViewNameConfig()
: RimNameConfig()
, m_hideCaseNameField( false )
, m_hideAggregationTypeField( false )
, m_hidePropertyField( false )

View File

@@ -29,7 +29,7 @@ class RimViewNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
explicit RimViewNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
explicit RimViewNameConfig();
void setAddCaseName( bool add );
bool addCaseName() const;

View File

@@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionC
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig( const RimNameConfigHolderInterface* configHolder )
: RimNameConfig( configHolder )
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Well Log Extraction Curve Name Generator", "", "", "" );

View File

@@ -29,7 +29,7 @@ class RimWellLogExtractionCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogExtractionCurveNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
RimWellLogExtractionCurveNameConfig();
bool addCaseName() const;
bool addProperty() const;

View File

@@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConf
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig( const RimNameConfigHolderInterface* configHolder )
: RimNameConfig( configHolder )
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" );
m_customName = "Las Curve";

View File

@@ -29,5 +29,5 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogFileCurveNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
RimWellLogFileCurveNameConfig();
};

View File

@@ -26,12 +26,9 @@
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogCurve.h"
#include "RimWellLogCurveCommonDataSource.h"
#include "RimWellLogTrack.h"
#include "RimWellPltPlot.h"
#include "RimWellRftPlot.h"
#include "RiuPlotMainWindow.h"
#include "RiuWellLogPlot.h"
@@ -90,10 +87,10 @@ RimWellLogPlot::RimWellLogPlot()
"",
"Change the Data Source of All Curves in the Plot",
"" );
m_commonDataSource = new RimWellLogCurveCommonDataSource;
m_commonDataSource.uiCapability()->setUiTreeHidden( true );
m_commonDataSource.uiCapability()->setUiTreeChildrenHidden( true );
m_commonDataSource.xmlCapability()->disableIO();
m_commonDataSource = new RimWellLogCurveCommonDataSource;
caf::AppEnum<RimWellLogPlot::DepthTypeEnum> depthType = MEASURED_DEPTH;
CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" );
@@ -115,14 +112,56 @@ RimWellLogPlot::RimWellLogPlot()
m_tracks.uiCapability()->setUiHidden( true );
CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogPlotNameConfig( this );
m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
m_nameConfig = new RimWellLogPlotNameConfig();
m_availableDepthUnits = {RiaDefines::UNIT_METER, RiaDefines::UNIT_FEET};
m_availableDepthTypes = {MEASURED_DEPTH, TRUE_VERTICAL_DEPTH};
m_minAvailableDepth = HUGE_VAL;
m_maxAvailableDepth = -HUGE_VAL;
}
//--------------------------------------------------------------------------------------------------
/// Move-assignment operator. Argument has to be passed with std::move()
//--------------------------------------------------------------------------------------------------
RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs )
{
// Don't copy the obsoleted m_userName_OBSOLETE
// It had its own implementation in the RFT/PLT/WAP plots
auto dataSource = rhs.m_commonDataSource();
rhs.m_commonDataSource.removeChildObject( dataSource );
m_commonDataSource = dataSource;
m_depthType = rhs.m_depthType();
m_depthUnit = rhs.m_depthUnit();
m_minVisibleDepth = rhs.m_minVisibleDepth();
m_maxVisibleDepth = rhs.m_maxVisibleDepth();
m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility();
m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled();
m_showTitleInPlot = rhs.m_showTitleInPlot();
m_showTrackLegends = rhs.m_showTrackLegends();
m_trackLegendsHorizontal = rhs.m_trackLegendsHorizontal();
// Move all tracks
std::vector<RimWellLogTrack*> tracks = rhs.m_tracks.childObjects();
rhs.m_tracks.clear();
for ( RimWellLogTrack* track : tracks )
{
m_tracks.push_back( track );
}
auto nameConfig = rhs.m_nameConfig();
rhs.m_nameConfig.removeChildObject( nameConfig );
m_nameConfig = nameConfig;
m_minAvailableDepth = rhs.m_minAvailableDepth;
m_maxAvailableDepth = rhs.m_maxAvailableDepth;
return *this;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -168,29 +207,23 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
m_isAutoScaleDepthEnabled = false;
}
else if ( changedField == &m_showTitleInPlot || changedField == &m_showTrackLegends ||
changedField == &m_trackLegendsHorizontal || changedField == &m_depthAxisGridVisibility )
else if ( changedField == &m_showTrackLegends || changedField == &m_trackLegendsHorizontal ||
changedField == &m_depthAxisGridVisibility )
{
updateTracks();
if ( m_viewer ) m_viewer->updateChildrenLayout();
}
else if ( changedField == &m_showTitleInPlot )
{
m_viewer->setTitleVisible( m_showTitleInPlot() );
}
else if ( changedField == &m_isAutoScaleDepthEnabled )
{
updateDepthZoom();
}
else if ( changedField == &m_depthType )
{
RimWellAllocationPlot* wellAllocPlot;
firstAncestorOrThisOfType( wellAllocPlot );
if ( wellAllocPlot )
{
wellAllocPlot->loadDataAndUpdate();
}
else if ( isRftPlotChild() )
{
rftPlot()->loadDataAndUpdate();
}
onDepthTypeChanged();
updateTracks();
updateDepthZoom();
}
@@ -200,21 +233,7 @@ void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
updateDepthZoom();
}
RimWellRftPlot* rftPlot( nullptr );
this->firstAncestorOrThisOfType( rftPlot );
if ( rftPlot )
{
rftPlot->updateConnectedEditors();
}
RimWellPltPlot* pltPlot( nullptr );
this->firstAncestorOrThisOfType( pltPlot );
if ( pltPlot )
{
pltPlot->updateConnectedEditors();
}
updateConnectedEditors();
}
//--------------------------------------------------------------------------------------------------
@@ -232,7 +251,7 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::
{
DepthTypeEnum enumVal = DepthAppEnum::fromIndex( i );
if ( m_disabledDepthTypes.count( enumVal ) == 0 )
if ( m_availableDepthTypes.count( enumVal ) )
{
options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( enumVal ), enumVal ) );
}
@@ -241,9 +260,10 @@ QList<caf::PdmOptionItemInfo> RimWellLogPlot::calculateValueOptions( const caf::
else if ( fieldNeedingOptions == &m_depthUnit )
{
using UnitAppEnum = caf::AppEnum<RiaDefines::DepthUnitType>;
options.push_back(
caf::PdmOptionItemInfo( UnitAppEnum::uiText( RiaDefines::UNIT_METER ), RiaDefines::UNIT_METER ) );
options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( RiaDefines::UNIT_FEET ), RiaDefines::UNIT_FEET ) );
for ( auto depthUnit : m_availableDepthUnits )
{
options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( depthUnit ), depthUnit ) );
}
}
else if ( fieldNeedingOptions == &m_trackLegendsHorizontal )
{
@@ -315,7 +335,7 @@ void RimWellLogPlot::removeTrack( RimWellLogTrack* track )
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogTrack* RimWellLogPlot::trackByIndex( size_t index )
RimWellLogTrack* RimWellLogPlot::trackByIndex( size_t index ) const
{
return m_tracks[index];
}
@@ -469,19 +489,7 @@ void RimWellLogPlot::enableAllAutoNameTags( bool enable )
//--------------------------------------------------------------------------------------------------
QString RimWellLogPlot::asciiDataForPlotExport() const
{
QString out;
RimWellAllocationPlot* wellAllocPlot = nullptr;
this->firstAncestorOrThisOfType( wellAllocPlot );
if ( wellAllocPlot )
{
out += wellAllocPlot->description();
}
else
{
out += description();
}
out += "\n";
QString out = description() + "\n";
for ( RimWellLogTrack* track : m_tracks )
{
@@ -562,42 +570,6 @@ QString RimWellLogPlot::asciiDataForPlotExport() const
return out;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RimWellLogPlot::rftPlot() const
{
RimWellRftPlot* rftPlot;
firstAncestorOrThisOfType( rftPlot );
return rftPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlot::isRftPlotChild() const
{
return rftPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPltPlot* RimWellLogPlot::pltPlot() const
{
RimWellPltPlot* pltPlot;
firstAncestorOrThisOfType( pltPlot );
return pltPlot;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
bool RimWellLogPlot::isPltPlotChild() const
{
return pltPlot() != nullptr;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -605,18 +577,16 @@ void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" );
if ( !pltPlot() )
if ( m_availableDepthTypes.size() > 1u )
{
gridGroup->add( &m_depthType );
}
RimWellAllocationPlot* wap;
firstAncestorOrThisOfType( wap );
if ( !wap )
if ( m_availableDepthUnits.size() > 1u )
{
gridGroup->add( &m_depthUnit );
}
gridGroup->add( &m_minVisibleDepth );
gridGroup->add( &m_maxVisibleDepth );
gridGroup->add( &m_depthAxisGridVisibility );
@@ -628,9 +598,10 @@ void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering )
void RimWellLogPlot::uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering )
{
caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Title and Legends" );
titleAndLegendsGroup->add( &m_showTitleInPlot );
titleAndLegendsGroup->add( &m_showTrackLegends );
titleAndLegendsGroup->add( &m_trackLegendsHorizontal );
titleAndLegendsGroup->add( &m_showTitleInPlot );
m_nameConfig->uiOrdering( "", *titleAndLegendsGroup );
}
//--------------------------------------------------------------------------------------------------
@@ -771,6 +742,22 @@ RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const
return m_commonDataSource;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits )
{
m_availableDepthUnits = depthUnits;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::setAvailableDepthTypes( const std::set<DepthTypeEnum>& depthTypes )
{
m_availableDepthTypes = depthTypes;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -789,9 +776,6 @@ void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering&
uiOrderingForDepthAxis( uiOrdering );
uiOrderingForPlotSettings( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Plot Name" );
m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields( true );
}
@@ -820,8 +804,6 @@ void RimWellLogPlot::updateTracks( bool autoScaleXAxis )
{
if ( m_showWindow )
{
updateDisabledDepthTypes();
for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx )
{
m_tracks[tIdx]->loadDataAndUpdate();
@@ -1123,40 +1105,6 @@ void RimWellLogPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit )
updateTracks();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::updateDisabledDepthTypes()
{
m_disabledDepthTypes.clear();
RimWellAllocationPlot* wap;
firstAncestorOrThisOfType( wap );
if ( wap )
{
m_disabledDepthTypes.insert( MEASURED_DEPTH );
if ( m_disabledDepthTypes.count( m_depthType() ) )
{
m_depthType = CONNECTION_NUMBER;
}
}
else if ( isRftPlotChild() )
{
m_disabledDepthTypes.insert( PSEUDO_LENGTH );
m_disabledDepthTypes.insert( CONNECTION_NUMBER );
}
else if ( isPltPlotChild() )
{
m_disabledDepthTypes.insert( TRUE_VERTICAL_DEPTH );
m_disabledDepthTypes.insert( PSEUDO_LENGTH );
m_disabledDepthTypes.insert( CONNECTION_NUMBER );
}
else
{
m_disabledDepthTypes.insert( PSEUDO_LENGTH );
m_disabledDepthTypes.insert( CONNECTION_NUMBER );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -1168,3 +1116,8 @@ void RimWellLogPlot::updatePlotTitle()
}
updateMdiWindowTitle();
}
//--------------------------------------------------------------------------------------------------
/// Default empty implementation
//--------------------------------------------------------------------------------------------------
void RimWellLogPlot::onDepthTypeChanged() {}

View File

@@ -31,11 +31,11 @@
#include <QPointer>
#include <set>
class RimWellLogCurveCommonDataSource;
class RiuWellLogPlot;
class RimWellLogTrack;
class RimWellRftPlot;
class RimWellPltPlot;
class QKeyEvent;
//==================================================================================================
@@ -68,6 +68,8 @@ public:
RimWellLogPlot();
~RimWellLogPlot() override;
RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
QWidget* createPlotWidget();
QWidget* viewWidget() override;
@@ -93,14 +95,14 @@ public:
void addTrack( RimWellLogTrack* track );
void insertTrack( RimWellLogTrack* track, size_t index );
size_t trackCount()
size_t trackCount() const
{
return m_tracks.size();
}
void removeTrack( RimWellLogTrack* track );
size_t trackIndex( const RimWellLogTrack* track ) const;
RimWellLogTrack* trackByIndex( size_t index );
RimWellLogTrack* trackByIndex( size_t index ) const;
size_t firstVisibleTrackIndex() const;
std::vector<RimWellLogTrack*> tracks() const;
void updateTracks( bool autoScaleXAxis = false );
@@ -122,11 +124,6 @@ public:
QString asciiDataForPlotExport() const;
RimWellRftPlot* rftPlot() const;
bool isRftPlotChild() const;
RimWellPltPlot* pltPlot() const;
bool isPltPlotChild() const;
void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering );
@@ -135,6 +132,9 @@ public:
void handleKeyPressEvent( QKeyEvent* keyEvent );
RimWellLogCurveCommonDataSource* commonDataSource() const;
void setAvailableDepthUnits( const std::set<RiaDefines::DepthUnitType>& depthUnits );
void setAvailableDepthTypes( const std::set<RimWellLogPlot::DepthTypeEnum>& depthTypes );
protected:
void performAutoNameUpdate() override;
@@ -161,17 +161,16 @@ private:
void recreateTrackPlots();
void detachAllCurves();
void updateDisabledDepthTypes();
void updatePlotTitle();
void updatePlotTitle();
virtual void onDepthTypeChanged();
private:
protected:
caf::PdmField<QString> m_userName_OBSOLETE;
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
std::set<RimWellLogPlot::DepthTypeEnum> m_disabledDepthTypes;
caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth;
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
@@ -183,6 +182,9 @@ private:
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
std::set<RiaDefines::DepthUnitType> m_availableDepthUnits;
std::set<RimWellLogPlot::DepthTypeEnum> m_availableDepthTypes;
double m_minAvailableDepth;
double m_maxAvailableDepth;

View File

@@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig( const RimNameConfigHolderInterface* configHolder )
: RimNameConfig( configHolder )
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Well Log Plot Name Generator", "", "", "" );

View File

@@ -29,7 +29,7 @@ class RimWellLogPlotNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogPlotNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
RimWellLogPlotNameConfig();
bool addCaseName() const;
bool addWellName() const;

View File

@@ -28,8 +28,8 @@ CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig( const RimNameConfigHolderInterface* configHolder )
: RimNameConfig( configHolder )
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig()
: RimNameConfig()
{
CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" );
m_customName = "Rft Curve";

View File

@@ -29,5 +29,5 @@ class RimWellLogRftCurveNameConfig : public RimNameConfig
CAF_PDM_HEADER_INIT;
public:
RimWellLogRftCurveNameConfig( const RimNameConfigHolderInterface* configHolder = nullptr );
RimWellLogRftCurveNameConfig();
};

View File

@@ -82,10 +82,10 @@ public:
};
enum WidthScaleFactor
{
EXTRA_NARROW_TRACK = 2,
NARROW_TRACK = 3,
NORMAL_TRACK = 4,
WIDE_TRACK = 6,
EXTRA_NARROW_TRACK = 3,
NARROW_TRACK = 4,
NORMAL_TRACK = 5,
WIDE_TRACK = 7,
EXTRA_WIDE_TRACK = 10
};

View File

@@ -58,8 +58,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuFemTimeHistoryResultAccessor.h
${CMAKE_CURRENT_LIST_DIR}/RiuEditPerforationCollectionWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuAdvancedSnapshotExportWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellAllocationPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellRftPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellPltPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuFlowCharacteristicsPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuNightchartsWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuMessagePanel.h
@@ -144,8 +142,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuFemTimeHistoryResultAccessor.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuEditPerforationCollectionWidget.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuAdvancedSnapshotExportWidget.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellAllocationPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellRftPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuWellPltPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuFlowCharacteristicsPlot.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuNightchartsWidget.cpp
${CMAKE_CURRENT_LIST_DIR}/RiuMessagePanel.cpp
@@ -210,8 +206,6 @@ ${CMAKE_CURRENT_LIST_DIR}/RiuCvfOverlayItemWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuEditPerforationCollectionWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuAdvancedSnapshotExportWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellAllocationPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellRftPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuWellPltPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuFlowCharacteristicsPlot.h
${CMAKE_CURRENT_LIST_DIR}/RiuNightchartsWidget.h
${CMAKE_CURRENT_LIST_DIR}/RiuMessagePanel.h

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -21,11 +21,11 @@
#include "RiaApplication.h"
#include "RimContextCommandBuilder.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h"
@@ -38,73 +38,76 @@
#include <QLabel>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent )
: QFrame( parent )
, m_plotDefinition( plotDefinition )
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent)
: QFrame(parent)
, m_plotDefinition(plotDefinition)
{
Q_ASSERT( m_plotDefinition );
Q_ASSERT(m_plotDefinition);
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout( mainLayout );
this->layout()->setMargin( 0 );
this->layout()->setSpacing( 2 );
this->setLayout(mainLayout);
this->layout()->setMargin(0);
this->layout()->setSpacing(2);
m_titleLabel = new QLabel( this );
new RiuPlotObjectPicker( m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot() );
m_titleLabel = new QLabel(this);
new RiuPlotObjectPicker(m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot());
QFont font = m_titleLabel->font();
font.setPointSize( 14 );
font.setBold( true );
m_titleLabel->setFont( font );
font.setPointSize(14);
font.setBold(true);
m_titleLabel->setFont(font);
// White background
QPalette pal = this->palette();
pal.setColor( QPalette::Background, Qt::white );
this->setAutoFillBackground( true );
this->setPalette( pal );
pal.setColor(QPalette::Background, Qt::white);
this->setAutoFillBackground(true);
this->setPalette(pal);
mainLayout->addWidget( m_titleLabel, 0, Qt::AlignCenter );
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter);
auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout( plotWidgetsLayout );
plotWidgetsLayout->addLayout( rightColumnLayout );
m_legendWidget = new RiuNightchartsWidget( this );
new RiuPlotObjectPicker( m_legendWidget, m_plotDefinition->plotLegend() );
mainLayout->addLayout(plotWidgetsLayout);
plotWidgetsLayout->addLayout(rightColumnLayout);
m_legendWidget = new RiuNightchartsWidget(this);
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend());
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
new RiuContextMenuLauncher(m_legendWidget, menuBuilder);
rightColumnLayout->addWidget( m_legendWidget );
m_legendWidget->showPie( false );
rightColumnLayout->addWidget(m_legendWidget);
m_legendWidget->showPie(false);
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget( this );
new RiuPlotObjectPicker( totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot() );
new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this);
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot());
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder);
rightColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
rightColumnLayout->addWidget( m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
Qt::AlignTop );
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop);
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop);
rightColumnLayout->addStretch();
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
plotWidgetsLayout->addWidget( wellFlowWidget );
plotWidgetsLayout->addWidget(wellFlowWidget);
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::~RiuWellAllocationPlot() {}
RiuWellAllocationPlot::~RiuWellAllocationPlot()
{
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
{
@@ -112,7 +115,7 @@ RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const
{
@@ -120,89 +123,96 @@ RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showTitle( const QString& title )
void RiuWellAllocationPlot::showTitle(const QString& title)
{
m_titleLabel->show();
m_titleLabel->setText( title );
m_titleLabel->setText(title);
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::hideTitle()
{
m_titleLabel->hide();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showLegend( bool doShow )
void RiuWellAllocationPlot::showLegend(bool doShow)
{
if ( doShow )
if (doShow)
m_legendWidget->show();
else
m_legendWidget->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::addLegendItem( const QString& name, const cvf::Color3f& color, float value )
{
QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
m_legendWidget->addItem( name, sliceColor, value );
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::addLegendItem(const QString& name, const cvf::Color3f& color, float value)
{
QColor sliceColor(color.rByte(), color.gByte(), color.bByte());
m_legendWidget->addItem(name, sliceColor, value);
m_legendWidget->updateGeometry();
m_legendWidget->update();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::clearLegend()
{
m_legendWidget->clear();
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::minimumSizeHint() const
{
return QSize( 0, 100 );
return QSize(0, 100);
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event )
void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
{
QMenu menu;
QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowContributingWellsFromPlotFeature";
menuBuilder.appendToMenu( &menu );
menuBuilder.appendToMenu(&menu);
if ( menu.actions().size() > 0 )
if (menu.actions().size() > 0)
{
menu.exec( event->globalPos() );
menu.exec(event->globalPos());
}
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::sizeHint() const
{
return QSize( 0, 0 );
return QSize(0, 0);
}
//--------------------------------------------------------------------------------------------------
///
///
//--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::setDefaults() {}
void RiuWellAllocationPlot::setDefaults()
{
}

View File

@@ -1,17 +1,17 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
//
// 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>
//
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
@@ -22,8 +22,8 @@
#include "cafPdmPointer.h"
#include <QFrame>
#include <QPointer>
#include <QFrame>
#include "RiuInterfaceToViewWindow.h"
@@ -32,9 +32,8 @@ class RiuNightchartsWidget;
class QLabel;
namespace cvf
{
class Color3f;
namespace cvf {
class Color3f;
}
//==================================================================================================
@@ -45,31 +44,31 @@ class Color3f;
class RiuWellAllocationPlot : public QFrame, public RiuInterfaceToViewWindow
{
Q_OBJECT;
public:
RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr );
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr);
~RiuWellAllocationPlot() override;
RimWellAllocationPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
RimWellAllocationPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void showTitle(const QString& title);
void hideTitle();
void showLegend(bool doShow);
void addLegendItem(const QString& name, const cvf::Color3f& color, float value);
void clearLegend();
void showTitle( const QString& title );
void hideTitle();
void showLegend( bool doShow );
void addLegendItem( const QString& name, const cvf::Color3f& color, float value );
void clearLegend();
protected:
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void contextMenuEvent( QContextMenuEvent* ) override;
void contextMenuEvent(QContextMenuEvent *) override;
private:
void setDefaults();
void setDefaults();
private:
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
QPointer<RiuNightchartsWidget> m_legendWidget;
QPointer<QLabel> m_titleLabel;
QPointer<RiuNightchartsWidget> m_legendWidget;
QPointer<QLabel> m_titleLabel;
};

View File

@@ -27,6 +27,7 @@
#include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"
#include "RiuPlotObjectPicker.h"
#include "RiuWellLogTrack.h"
#include "cafCmdFeatureMenuBuilder.h"
@@ -51,27 +52,46 @@
//--------------------------------------------------------------------------------------------------
RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: QWidget( parent )
, m_scheduleUpdateChildrenLayoutTimer( nullptr )
{
Q_ASSERT( plotDefinition );
m_plotDefinition = plotDefinition;
m_layout = new QVBoxLayout( this );
m_layout->setMargin( 0 );
m_layout->setSpacing( 2 );
m_plotTitle = createTitleLabel();
m_layout->addWidget( m_plotTitle );
m_plotLayout = new QHBoxLayout;
m_layout->addLayout( m_plotLayout );
m_plotFrame = new QFrame;
m_plotFrame->setVisible( true );
m_plotLayout->addWidget( m_plotFrame, 1 );
m_trackLayout = new QGridLayout( m_plotFrame );
m_trackLayout->setMargin( 0 );
m_trackLayout->setSpacing( 2 );
QPalette newPalette( palette() );
newPalette.setColor( QPalette::Background, Qt::white );
setPalette( newPalette );
setAutoFillBackground( true );
m_plotTitle = new QLabel( "PLOT TITLE HERE", this );
QFont font = m_plotTitle->font();
font.setPointSize( 14 );
font.setBold( true );
m_plotTitle->setFont( font );
m_plotTitle->hide();
m_scrollBar = new QScrollBar( this );
m_scrollBarLayout = new QVBoxLayout;
m_scrollBarLayout->setContentsMargins( 0, 50, 0, 0 );
m_plotLayout->addLayout( m_scrollBarLayout );
m_scrollBar = new QScrollBar( nullptr );
m_scrollBar->setOrientation( Qt::Vertical );
m_scrollBar->setVisible( true );
m_scrollBarLayout->addWidget( m_scrollBar, 0 );
new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
setFocusPolicy( Qt::StrongFocus );
@@ -103,11 +123,9 @@ void RiuWellLogPlot::addTrackPlot( RiuWellLogTrack* trackPlot )
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
{
trackPlot->setParent( this );
m_trackPlots.insert( static_cast<int>( index ), trackPlot );
QwtLegend* legend = new QwtLegend( this );
QwtLegend* legend = new QwtLegend( nullptr );
int legendColumns = 1;
if ( m_plotDefinition->areTrackLegendsHorizontal() )
{
@@ -124,9 +142,9 @@ void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter );
m_legends.insert( static_cast<int>( index ), legend );
this->connect( trackPlot,
SIGNAL( legendDataChanged( const QVariant&, const QList<QwtLegendData>& ) ),
SLOT( scheduleUpdateChildrenLayout() ) );
m_trackLayout->addWidget( legend, 0, static_cast<int>( index ) );
m_trackLayout->addWidget( trackPlot, 1, static_cast<int>( index ) );
m_trackLayout->setRowStretch( 1, 1 );
if ( !m_plotDefinition->areTrackLegendsVisible() )
{
@@ -209,6 +227,68 @@ QSize RiuWellLogPlot::preferredSize() const
return QSize( std::max( titleWidth, sumTrackWidth ), titleHeight + maxTrackHeight );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setTitleVisible( bool visible )
{
m_plotTitle->setVisible( visible );
this->updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateChildrenLayout()
{
int trackCount = m_trackPlots.size();
int numTracksAlreadyShown = 0;
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if ( m_plotDefinition->areTrackLegendsVisible() && m_trackPlots[tIdx]->isVisible() )
{
int legendColumns = 1;
if ( m_plotDefinition->areTrackLegendsHorizontal() )
{
legendColumns = 0; // unlimited
}
m_legends[tIdx]->setMaxColumns( legendColumns );
m_legends[tIdx]->show();
m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle( numTracksAlreadyShown == 0 );
numTracksAlreadyShown++;
}
else
{
m_legends[tIdx]->hide();
}
RiuWellLogTrack* riuTrack = m_trackPlots[tIdx];
m_trackLayout->setColumnStretch( tIdx, riuTrack->widthScaleFactor() );
}
alignCanvasTops();
this->update();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::showEvent( QShowEvent* )
{
updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::changeEvent( QEvent* event )
{
if ( event->type() == QEvent::WindowStateChange )
{
updateChildrenLayout();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -230,6 +310,14 @@ void RiuWellLogPlot::contextMenuEvent( QContextMenuEvent* event )
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent )
{
m_plotDefinition->handleKeyPressEvent( keyEvent );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -241,9 +329,16 @@ QSize RiuWellLogPlot::sizeHint() const
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent )
QLabel* RiuWellLogPlot::createTitleLabel() const
{
m_plotDefinition->handleKeyPressEvent( keyEvent );
QLabel* plotTitle = new QLabel( "PLOT TITLE HERE", nullptr );
QFont font = plotTitle->font();
font.setPointSize( 14 );
font.setBold( true );
plotTitle->setFont( font );
plotTitle->setVisible( m_plotDefinition->isPlotTitleVisible() );
plotTitle->setAlignment( Qt::AlignHCenter );
return plotTitle;
}
//--------------------------------------------------------------------------------------------------
@@ -263,12 +358,56 @@ void RiuWellLogPlot::updateScrollBar( double minDepth, double maxDepth )
m_scrollBar->setRange( (int)availableMinDepth, (int)( ( availableMaxDepth - visibleDepth ) ) );
m_scrollBar->setPageStep( (int)visibleDepth );
m_scrollBar->setValue( (int)minDepth );
m_scrollBar->setVisible( true );
}
m_scrollBar->blockSignals( false );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::alignCanvasTops()
{
CVF_ASSERT( m_legends.size() == m_trackPlots.size() );
int maxCanvasOffset = 0;
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
// Hack to align QWT plots. See below.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int canvasMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop );
maxCanvasOffset = std::max( maxCanvasOffset, static_cast<int>( canvasRect.top() + canvasMargins ) );
}
}
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
// Hack to align QWT plots which doesn't have an x-axis with the other tracks.
// Since they are missing the axis, QWT will shift them upwards.
// So we shift the plot downwards and resize to match the others.
// TODO: Look into subclassing QwtPlotLayout instead.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int canvasMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop );
int myCanvasOffset = static_cast<int>( canvasRect.top() ) + canvasMargins;
int canvasShift = std::max( 0, maxCanvasOffset - myCanvasOffset );
QMargins margins = m_trackPlots[tIdx]->contentsMargins();
margins.setTop( margins.top() + canvasShift );
m_trackPlots[tIdx]->setContentsMargins( margins );
}
}
if ( m_trackLayout->columnCount() > 0 && m_trackLayout->rowCount() > 0 )
{
int legendHeight = m_trackLayout->cellRect( 0, 0 ).height();
m_scrollBarLayout->setContentsMargins( 0, legendHeight, 0, 0 );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
@@ -298,265 +437,3 @@ RimViewWindow* RiuWellLogPlot::ownerViewWindow() const
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::resizeEvent( QResizeEvent* event )
{
int height = event->size().height();
int width = event->size().width();
placeChildWidgets( height, width );
QWidget::resizeEvent( event );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame( int frameWidth ) const
{
int trackCount = m_trackPlots.size();
int visibleTrackCount = 0;
int firstTrackAxisOffset = 0; // Account for first track having the y-axis labels and markers
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
if ( visibleTrackCount == 0 )
{
firstTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
}
else if ( visibleTrackCount == 1 )
{
// The others axes also have markers, and so we need to subtract for this to get the shift due to labels and title
int otherTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
firstTrackAxisOffset -= otherTrackAxisOffset;
}
++visibleTrackCount;
}
}
int scrollBarWidth = 0;
if ( m_scrollBar->isVisible() ) scrollBarWidth = m_scrollBar->sizeHint().width();
std::map<int, int> trackWidths;
if ( visibleTrackCount )
{
int totalTrackWidth = ( frameWidth - firstTrackAxisOffset - scrollBarWidth );
int trackWidthExtra = ( frameWidth - firstTrackAxisOffset - scrollBarWidth ) % visibleTrackCount;
int totalWidthWeights = 0;
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
totalWidthWeights += m_trackPlots[tIdx]->widthScaleFactor();
}
}
bool firstVisible = true;
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
int realTrackWidth = ( totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor() ) / totalWidthWeights;
if ( firstVisible )
{
realTrackWidth += firstTrackAxisOffset;
firstVisible = false;
}
if ( trackWidthExtra > 0 )
{
realTrackWidth += 1;
--trackWidthExtra;
}
trackWidths[tIdx] = realTrackWidth;
}
}
}
return trackWidths;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::placeChildWidgets( int frameHeight, int frameWidth )
{
CVF_ASSERT( m_legends.size() == m_trackPlots.size() );
positionTitle( frameWidth );
const int trackPadding = 2;
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame( frameWidth );
size_t visibleTrackCount = trackWidths.size();
int maxLegendHeight = 0;
if ( m_plotDefinition && m_plotDefinition->areTrackLegendsVisible() )
{
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
int legendHeight = m_legends[tIdx]->heightForWidth( trackWidths[tIdx] - 2 * trackPadding );
if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight;
}
}
}
int titleHeight = 0;
if ( m_plotTitle && m_plotTitle->isVisible() )
{
titleHeight = m_plotTitle->height() + 10;
}
int trackHeight = frameHeight - maxLegendHeight - titleHeight;
int trackX = 0;
if ( visibleTrackCount )
{
int maxCanvasOffset = 0;
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
// Hack to align QWT plots. See below.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
maxCanvasOffset = std::max( maxCanvasOffset, static_cast<int>( canvasRect.top() ) );
}
}
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
int adjustedVerticalPosition = titleHeight + maxLegendHeight + 10;
int adjustedTrackHeight = trackHeight;
{
// Hack to align QWT plots which doesn't have an x-axis with the other tracks.
// Since they are missing the axis, QWT will shift them upwards.
// So we shift the plot downwards and resize to match the others.
// TODO: Look into subclassing QwtPlotLayout instead.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int myCanvasOffset = static_cast<int>( canvasRect.top() );
int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop );
int canvasShift = std::max( 0, maxCanvasOffset - myCanvasOffset );
adjustedVerticalPosition += canvasShift - myMargins;
adjustedTrackHeight -= canvasShift;
}
int realTrackWidth = trackWidths[tIdx];
m_legends[tIdx]->setGeometry( trackX + trackPadding,
titleHeight,
realTrackWidth - 2 * trackPadding,
maxLegendHeight );
m_trackPlots[tIdx]->setGeometry( trackX + trackPadding,
adjustedVerticalPosition,
realTrackWidth - 2 * trackPadding,
adjustedTrackHeight );
trackX += realTrackWidth;
}
}
}
if ( m_scrollBar->isVisible() )
{
m_scrollBar->setGeometry( trackX, titleHeight + maxLegendHeight, m_scrollBar->sizeHint().width(), trackHeight );
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::positionTitle( int frameWidth )
{
if ( m_plotDefinition && m_plotDefinition->isPlotTitleVisible() )
{
int textWidth = m_plotTitle->sizeHint().width();
m_plotTitle->setGeometry( frameWidth / 2 - textWidth / 2, 0, textWidth, m_plotTitle->sizeHint().height() );
m_plotTitle->show();
}
else
{
m_plotTitle->hide();
}
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateChildrenLayout()
{
int trackCount = m_trackPlots.size();
int numTracksAlreadyShown = 0;
for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{
if ( m_trackPlots[tIdx]->isVisible() )
{
int legendColumns = 1;
if ( m_plotDefinition->areTrackLegendsHorizontal() )
{
legendColumns = 0; // unlimited
}
m_legends[tIdx]->setMaxColumns( legendColumns );
m_legends[tIdx]->show();
m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle( numTracksAlreadyShown == 0 );
numTracksAlreadyShown++;
}
else
{
m_legends[tIdx]->hide();
}
}
placeChildWidgets( this->height(), this->width() );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::showEvent( QShowEvent* )
{
updateChildrenLayout();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::changeEvent( QEvent* event )
{
if ( event->type() == QEvent::WindowStateChange )
{
updateChildrenLayout();
}
}
//--------------------------------------------------------------------------------------------------
/// Schedule an update of the widget positions
/// Will happen just a bit after the event loop is entered
/// Used to delay the positioning to after the legend widgets is actually updated.
//--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::scheduleUpdateChildrenLayout()
{
if ( !m_scheduleUpdateChildrenLayoutTimer )
{
m_scheduleUpdateChildrenLayoutTimer = new QTimer( this );
connect( m_scheduleUpdateChildrenLayoutTimer, SIGNAL( timeout() ), this, SLOT( updateChildrenLayout() ) );
}
if ( !m_scheduleUpdateChildrenLayoutTimer->isActive() )
{
m_scheduleUpdateChildrenLayoutTimer->setSingleShot( true );
m_scheduleUpdateChildrenLayoutTimer->start( 100 );
}
}

View File

@@ -23,6 +23,9 @@
#include "cafPdmPointer.h"
#include <QFrame>
#include <QGridLayout>
#include <QHBoxLayout>
#include <QList>
#include <QPointer>
#include <QWidget>
@@ -48,6 +51,7 @@ class RiuWellLogPlot : public QWidget, public RiuInterfaceToViewWindow
public:
RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellLogPlot() override;
RimWellLogPlot* ownerPlotDefinition();
@@ -60,33 +64,38 @@ public:
void setDepthZoomAndReplot( double minDepth, double maxDepth );
void setPlotTitle( const QString& plotTitle );
virtual QSize preferredSize() const;
void setTitleVisible( bool visible );
public slots:
void updateChildrenLayout();
protected:
void resizeEvent( QResizeEvent* event ) override;
void showEvent( QShowEvent* ) override;
void changeEvent( QEvent* ) override;
void contextMenuEvent( QContextMenuEvent* ) override;
QSize sizeHint() const override;
void showEvent( QShowEvent* ) override;
void changeEvent( QEvent* event ) override;
void contextMenuEvent( QContextMenuEvent* ) override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
QSize sizeHint() const override;
QLabel* createTitleLabel() const;
private:
void updateScrollBar( double minDepth, double maxDepth );
std::map<int, int> calculateTrackWidthsToMatchFrame( int frameWidth ) const;
void placeChildWidgets( int frameHeight, int frameWidth );
void positionTitle( int frameWidth );
void updateScrollBar( double minDepth, double maxDepth );
void alignCanvasTops();
private slots:
void slotSetMinDepth( int value );
void scheduleUpdateChildrenLayout();
private:
QLabel* m_plotTitle;
protected:
QPointer<QVBoxLayout> m_layout;
QPointer<QHBoxLayout> m_plotLayout;
QPointer<QFrame> m_plotFrame;
QPointer<QGridLayout> m_trackLayout;
QPointer<QLabel> m_plotTitle;
QPointer<QVBoxLayout> m_scrollBarLayout;
QScrollBar* m_scrollBar;
QList<QPointer<QwtLegend>> m_legends;
QList<QPointer<RiuWellLogTrack>> m_trackPlots;
caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
QTimer* m_scheduleUpdateChildrenLayoutTimer;
};

View File

@@ -1,146 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 "RiuWellPltPlot.h"
#include "RiaApplication.h"
#include "RimContextCommandBuilder.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellPltPlot.h"
#include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h"
#include "RiuPlotObjectPicker.h"
#include "cvfColor3.h"
#include <QBoxLayout>
#include <QContextMenuEvent>
#include <QLabel>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPltPlot::RiuWellPltPlot( RimWellPltPlot* plotDefinition, QWidget* parent )
: QFrame( parent )
, m_plotDefinition( plotDefinition )
{
Q_ASSERT( m_plotDefinition );
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout( mainLayout );
this->layout()->setMargin( 0 );
this->layout()->setSpacing( 2 );
m_titleLabel = new QLabel( this );
new RiuPlotObjectPicker( m_titleLabel, m_plotDefinition->wellLogPlot() );
QFont font = m_titleLabel->font();
font.setPointSize( 14 );
font.setBold( true );
m_titleLabel->setFont( font );
// White background
QPalette pal = this->palette();
pal.setColor( QPalette::Background, Qt::white );
this->setAutoFillBackground( true );
this->setPalette( pal );
mainLayout->addWidget( m_titleLabel, 0, Qt::AlignCenter );
auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout( plotWidgetsLayout );
plotWidgetsLayout->addLayout( rightColumnLayout );
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createPlotWidget();
plotWidgetsLayout->addWidget( wellFlowWidget );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellPltPlot::~RiuWellPltPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellPltPlot* RiuWellPltPlot::ownerPlotDefinition()
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellPltPlot::ownerViewWindow() const
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPltPlot::showTitle( const QString& title )
{
m_titleLabel->show();
m_titleLabel->setText( title );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPltPlot::hideTitle()
{
m_titleLabel->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellPltPlot::minimumSizeHint() const
{
return QSize( 0, 100 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPltPlot::contextMenuEvent( QContextMenuEvent* event ) {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellPltPlot::sizeHint() const
{
return QSize( 0, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellPltPlot::setDefaults() {}

View File

@@ -1,71 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "qwt_plot.h"
#include "cafPdmPointer.h"
#include <QFrame>
#include <QPointer>
#include "RiuInterfaceToViewWindow.h"
class RimWellPltPlot;
class RiuNightchartsWidget;
class QLabel;
namespace cvf
{
class Color3f;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RiuWellPltPlot : public QFrame, public RiuInterfaceToViewWindow
{
Q_OBJECT;
public:
RiuWellPltPlot( RimWellPltPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellPltPlot() override;
RimWellPltPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void showTitle( const QString& title );
void hideTitle();
protected:
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void contextMenuEvent( QContextMenuEvent* ) override;
private:
void setDefaults();
private:
caf::PdmPointer<RimWellPltPlot> m_plotDefinition;
QPointer<QLabel> m_titleLabel;
};

View File

@@ -1,146 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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 "RiuWellRftPlot.h"
#include "RiaApplication.h"
#include "RimContextCommandBuilder.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h"
#include "RimWellLogPlot.h"
#include "RimWellLogTrack.h"
#include "RimWellRftPlot.h"
#include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h"
#include "RiuPlotObjectPicker.h"
#include "cvfColor3.h"
#include <QBoxLayout>
#include <QContextMenuEvent>
#include <QLabel>
#include <QMenu>
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellRftPlot::RiuWellRftPlot( RimWellRftPlot* plotDefinition, QWidget* parent )
: QFrame( parent )
, m_plotDefinition( plotDefinition )
{
Q_ASSERT( m_plotDefinition );
QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout( mainLayout );
this->layout()->setMargin( 0 );
this->layout()->setSpacing( 2 );
m_titleLabel = new QLabel( this );
new RiuPlotObjectPicker( m_titleLabel, m_plotDefinition->wellLogPlot() );
QFont font = m_titleLabel->font();
font.setPointSize( 14 );
font.setBold( true );
m_titleLabel->setFont( font );
// White background
QPalette pal = this->palette();
pal.setColor( QPalette::Background, Qt::white );
this->setAutoFillBackground( true );
this->setPalette( pal );
mainLayout->addWidget( m_titleLabel, 0, Qt::AlignCenter );
auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout( plotWidgetsLayout );
plotWidgetsLayout->addLayout( rightColumnLayout );
QWidget* wellFlowWidget = m_plotDefinition->wellLogPlot()->createPlotWidget();
plotWidgetsLayout->addWidget( wellFlowWidget );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RiuWellRftPlot::~RiuWellRftPlot() {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimWellRftPlot* RiuWellRftPlot::ownerPlotDefinition()
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellRftPlot::ownerViewWindow() const
{
return m_plotDefinition;
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::showTitle( const QString& title )
{
m_titleLabel->show();
m_titleLabel->setText( title );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::hideTitle()
{
m_titleLabel->hide();
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellRftPlot::minimumSizeHint() const
{
return QSize( 0, 100 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::contextMenuEvent( QContextMenuEvent* event ) {}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
QSize RiuWellRftPlot::sizeHint() const
{
return QSize( 0, 0 );
}
//--------------------------------------------------------------------------------------------------
///
//--------------------------------------------------------------------------------------------------
void RiuWellRftPlot::setDefaults() {}

View File

@@ -1,71 +0,0 @@
/////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2017 Statoil ASA
//
// 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.
//
/////////////////////////////////////////////////////////////////////////////////
#pragma once
#include "qwt_plot.h"
#include "cafPdmPointer.h"
#include <QFrame>
#include <QPointer>
#include "RiuInterfaceToViewWindow.h"
class RimWellRftPlot;
class RiuNightchartsWidget;
class QLabel;
namespace cvf
{
class Color3f;
}
//==================================================================================================
//
//
//
//==================================================================================================
class RiuWellRftPlot : public QFrame, public RiuInterfaceToViewWindow
{
Q_OBJECT;
public:
RiuWellRftPlot( RimWellRftPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellRftPlot() override;
RimWellRftPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override;
void showTitle( const QString& title );
void hideTitle();
protected:
QSize sizeHint() const override;
QSize minimumSizeHint() const override;
void contextMenuEvent( QContextMenuEvent* ) override;
private:
void setDefaults();
private:
caf::PdmPointer<RimWellRftPlot> m_plotDefinition;
QPointer<QLabel> m_titleLabel;
};