Clang-format after merge

This commit is contained in:
Magne Sjaastad
2019-09-13 16:51:21 +02:00
parent aaeafa6aef
commit 33cd6bb0c8
7 changed files with 186 additions and 183 deletions

View File

@@ -452,7 +452,7 @@ void RicExportFractureCompletionsImpl::getWellPressuresAndInitialProductionTimeS
{ {
RimSummaryCase* summaryCase = mainCollection->findSummaryCaseFromEclipseResultCase( resultCase ); RimSummaryCase* summaryCase = mainCollection->findSummaryCaseFromEclipseResultCase( resultCase );
if (summaryCase && summaryCase->summaryReader()) if ( summaryCase && summaryCase->summaryReader() )
{ {
std::vector<double> values; std::vector<double> values;
if ( summaryCase->summaryReader()->values( wbhpPressureAddress, &values ) ) if ( summaryCase->summaryReader()->values( wbhpPressureAddress, &values ) )

View File

@@ -32,40 +32,48 @@
namespace caf namespace caf
{ {
template<> template <>
void RimWellBoreStabilityPlot::ParameterSourceEnum::setUp() void RimWellBoreStabilityPlot::ParameterSourceEnum::setUp()
{ {
addItem(RigGeoMechWellLogExtractor::AUTO, "AUTO", "Automatic"); addItem( RigGeoMechWellLogExtractor::AUTO, "AUTO", "Automatic" );
addItem(RigGeoMechWellLogExtractor::GRID, "GRID", "Grid"); addItem( RigGeoMechWellLogExtractor::GRID, "GRID", "Grid" );
addItem(RigGeoMechWellLogExtractor::LAS_FILE, "LAS_FILE", "LAS File"); addItem( RigGeoMechWellLogExtractor::LAS_FILE, "LAS_FILE", "LAS File" );
addItem(RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE, "ELEMENT_PROPERTY_TABLE", "Element Property Table"); addItem( RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE, "ELEMENT_PROPERTY_TABLE", "Element Property Table" );
addItem(RigGeoMechWellLogExtractor::USER_DEFINED, "USER_DEFINED", "User Defined"); addItem( RigGeoMechWellLogExtractor::USER_DEFINED, "USER_DEFINED", "User Defined" );
addItem(RigGeoMechWellLogExtractor::HYDROSTATIC_PP, "HYDROSTATIC_PP", "Hydrostatic"); addItem( RigGeoMechWellLogExtractor::HYDROSTATIC_PP, "HYDROSTATIC_PP", "Hydrostatic" );
setDefault(RigGeoMechWellLogExtractor::AUTO); setDefault( RigGeoMechWellLogExtractor::AUTO );
} }
} // End namespace caf } // End namespace caf
CAF_PDM_SOURCE_INIT(RimWellBoreStabilityPlot, "WellBoreStabilityPlot"); CAF_PDM_SOURCE_INIT( RimWellBoreStabilityPlot, "WellBoreStabilityPlot" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellBoreStabilityPlot::RimWellBoreStabilityPlot() RimWellBoreStabilityPlot::RimWellBoreStabilityPlot()
{ {
CAF_PDM_InitObject("Well Bore Stability Plot", ":/WellLogPlot16x16.png", "", ""); CAF_PDM_InitObject( "Well Bore Stability Plot", ":/WellLogPlot16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault( CAF_PDM_InitFieldNoDefault( &m_porePressureSource,
&m_porePressureSource, "PorePressureSource", "Pore Pressure", "", "Data source for Pore Pressure", ""); "PorePressureSource",
CAF_PDM_InitFieldNoDefault( "Pore Pressure",
&m_poissonRatioSource, "PoissionRatioSource", "Poisson Ratio", "", "Data source for Poisson Ratio", ""); "",
CAF_PDM_InitFieldNoDefault(&m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", ""); "Data source for Pore Pressure",
"" );
CAF_PDM_InitFieldNoDefault( &m_poissonRatioSource,
"PoissionRatioSource",
"Poisson Ratio",
"",
"Data source for Poisson Ratio",
"" );
CAF_PDM_InitFieldNoDefault( &m_ucsSource, "UcsSource", "Uniaxial Compressive Strength", "", "Data source for UCS", "" );
CAF_PDM_InitField(&m_userDefinedPoissionRatio, "UserPoissionRatio", 0.25, "", "", "User defined Poisson Ratio", ""); CAF_PDM_InitField( &m_userDefinedPoissionRatio, "UserPoissionRatio", 0.25, "", "", "User defined Poisson Ratio", "" );
m_userDefinedPoissionRatio.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_userDefinedPoissionRatio.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
// Typical UCS: http://ceae.colorado.edu/~amadei/CVEN5768/PDF/NOTES8.pdf // Typical UCS: http://ceae.colorado.edu/~amadei/CVEN5768/PDF/NOTES8.pdf
// Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar. // Typical UCS for Shale is 5 - 100 MPa -> 50 - 1000 bar.
CAF_PDM_InitField(&m_userDefinedUcs, "UserUcs", 100.0, "", "", "User defined UCS [bar]", ""); CAF_PDM_InitField( &m_userDefinedUcs, "UserUcs", 100.0, "", "", "User defined UCS [bar]", "" );
m_userDefinedUcs.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); m_userDefinedUcs.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@@ -111,110 +119,111 @@ double RimWellBoreStabilityPlot::userDefinedUcs() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimWellBoreStabilityPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup("Parameter Sources"); caf::PdmUiGroup* parameterSources = uiOrdering.addNewGroup( "Parameter Sources" );
parameterSources->add(&m_porePressureSource); parameterSources->add( &m_porePressureSource );
parameterSources->add(&m_poissonRatioSource); parameterSources->add( &m_poissonRatioSource );
parameterSources->add(&m_userDefinedPoissionRatio, {false, 1, 1}); parameterSources->add( &m_userDefinedPoissionRatio, {false, 1, 1} );
parameterSources->add(&m_ucsSource); parameterSources->add( &m_ucsSource );
parameterSources->add(&m_userDefinedUcs, {false, 1, 1}); parameterSources->add( &m_userDefinedUcs, {false, 1, 1} );
m_userDefinedPoissionRatio.uiCapability()->setUiReadOnly(m_poissonRatioSource() != RigGeoMechWellLogExtractor::USER_DEFINED); m_userDefinedPoissionRatio.uiCapability()->setUiReadOnly( m_poissonRatioSource() !=
m_userDefinedUcs.uiCapability()->setUiReadOnly(m_ucsSource() != RigGeoMechWellLogExtractor::USER_DEFINED); RigGeoMechWellLogExtractor::USER_DEFINED );
RimWellLogPlot::defineUiOrdering(uiConfigName, uiOrdering); m_userDefinedUcs.uiCapability()->setUiReadOnly( m_ucsSource() != RigGeoMechWellLogExtractor::USER_DEFINED );
RimWellLogPlot::defineUiOrdering( uiConfigName, uiOrdering );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellBoreStabilityPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo>
bool* useOptionsOnly) RimWellBoreStabilityPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
RimWellPath* wellPath = m_commonDataSource->wellPathToApply(); RimWellPath* wellPath = m_commonDataSource->wellPathToApply();
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_commonDataSource->caseToApply()); RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_commonDataSource->caseToApply() );
int timeStep = m_commonDataSource->timeStepToApply(); int timeStep = m_commonDataSource->timeStepToApply();
RigFemPartResultsCollection* femPartResults = nullptr; RigFemPartResultsCollection* femPartResults = nullptr;
if (geoMechCase) if ( geoMechCase )
{ {
femPartResults = geoMechCase->geoMechData()->femPartResults(); femPartResults = geoMechCase->geoMechData()->femPartResults();
} }
if (fieldNeedingOptions == &m_porePressureSource) if ( fieldNeedingOptions == &m_porePressureSource )
{ {
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForPorePressure()) for ( auto source : RigGeoMechWellLogExtractor::supportedSourcesForPorePressure() )
{ {
if (source == RigGeoMechWellLogExtractor::LAS_FILE) if ( source == RigGeoMechWellLogExtractor::LAS_FILE )
{ {
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "PP").empty()) if ( wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath( wellPath, "PP" ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE) else if ( source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE )
{ {
RigFemResultAddress resAddr(RIG_ELEMENT, "POR", ""); RigFemResultAddress resAddr( RIG_ELEMENT, "POR", "" );
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty()) if ( timeStep > 0 && femPartResults && !femPartResults->resultValues( resAddr, 0, timeStep ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else else
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
} }
else if (fieldNeedingOptions == &m_poissonRatioSource) else if ( fieldNeedingOptions == &m_poissonRatioSource )
{ {
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForPoissonRatio()) for ( auto source : RigGeoMechWellLogExtractor::supportedSourcesForPoissonRatio() )
{ {
if (source == RigGeoMechWellLogExtractor::LAS_FILE) if ( source == RigGeoMechWellLogExtractor::LAS_FILE )
{ {
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "POISSON_RATIO").empty()) if ( wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath( wellPath, "POISSON_RATIO" ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE) else if ( source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE )
{ {
RigFemResultAddress resAddr(RIG_ELEMENT, "RATIO", ""); RigFemResultAddress resAddr( RIG_ELEMENT, "RATIO", "" );
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty()) if ( timeStep > 0 && femPartResults && !femPartResults->resultValues( resAddr, 0, timeStep ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else else
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
} }
else if (fieldNeedingOptions == &m_ucsSource) else if ( fieldNeedingOptions == &m_ucsSource )
{ {
for (auto source : RigGeoMechWellLogExtractor::supportedSourcesForUcs()) for ( auto source : RigGeoMechWellLogExtractor::supportedSourcesForUcs() )
{ {
if (source == RigGeoMechWellLogExtractor::LAS_FILE) if ( source == RigGeoMechWellLogExtractor::LAS_FILE )
{ {
if (wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath(wellPath, "UCS").empty()) if ( wellPath && !RimWellLogFile::findMdAndChannelValuesForWellPath( wellPath, "UCS" ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else if (source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE) else if ( source == RigGeoMechWellLogExtractor::ELEMENT_PROPERTY_TABLE )
{ {
RigFemResultAddress resAddr(RIG_ELEMENT, "UCS", ""); RigFemResultAddress resAddr( RIG_ELEMENT, "UCS", "" );
if (timeStep > 0 && femPartResults && !femPartResults->resultValues(resAddr, 0, timeStep).empty()) if ( timeStep > 0 && femPartResults && !femPartResults->resultValues( resAddr, 0, timeStep ).empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
else else
{ {
options.push_back(caf::PdmOptionItemInfo(ParameterSourceEnum::uiText(source), source)); options.push_back( caf::PdmOptionItemInfo( ParameterSourceEnum::uiText( source ), source ) );
} }
} }
} }
@@ -224,14 +233,14 @@ QList<caf::PdmOptionItemInfo> RimWellBoreStabilityPlot::calculateValueOptions(co
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellBoreStabilityPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, void RimWellBoreStabilityPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue )
{ {
RimWellLogPlot::fieldChangedByUi(changedField, oldValue, newValue); RimWellLogPlot::fieldChangedByUi( changedField, oldValue, newValue );
if (changedField == &m_porePressureSource || changedField == &m_poissonRatioSource || changedField == &m_ucsSource || if ( changedField == &m_porePressureSource || changedField == &m_poissonRatioSource || changedField == &m_ucsSource ||
changedField == &m_userDefinedPoissionRatio || changedField == &m_userDefinedUcs) changedField == &m_userDefinedPoissionRatio || changedField == &m_userDefinedUcs )
{ {
this->loadDataAndUpdate(); this->loadDataAndUpdate();
} }

View File

@@ -278,12 +278,12 @@ std::set<RifEclipseSummaryAddress> RimSummaryCaseCollection::ensembleSummaryAddr
} }
} }
if (maxAddrIndex >= 0 && m_cases[maxAddrIndex]->summaryReader()) if ( maxAddrIndex >= 0 && m_cases[maxAddrIndex]->summaryReader() )
{ {
const std::set<RifEclipseSummaryAddress>& addrs = m_cases[maxAddrIndex]->summaryReader()->allResultAddresses(); const std::set<RifEclipseSummaryAddress>& addrs = m_cases[maxAddrIndex]->summaryReader()->allResultAddresses();
addresses.insert(addrs.begin(), addrs.end()); addresses.insert( addrs.begin(), addrs.end() );
} }
return addresses; return addresses;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------

View File

@@ -513,18 +513,21 @@ void RimSummaryCurve::onLoadDataAndUpdate( bool updateParentPlot )
if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE ) if ( plot->timeAxisProperties()->timeMode() == RimSummaryTimeAxisProperties::DATE )
{ {
auto reader = summaryCaseY()->summaryReader(); auto reader = summaryCaseY()->summaryReader();
if (reader) if ( reader )
{ {
auto errAddress = reader->errorAddress(summaryAddressY()); auto errAddress = reader->errorAddress( summaryAddressY() );
if (errAddress.isValid()) if ( errAddress.isValid() )
{ {
std::vector<double> errValues; std::vector<double> errValues;
reader->values(errAddress, &errValues); reader->values( errAddress, &errValues );
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, errValues, isLogCurve); m_qwtPlotCurve->setSamplesFromTimeTAndYValues( curveTimeStepsY,
curveValuesY,
errValues,
isLogCurve );
} }
else else
{ {
m_qwtPlotCurve->setSamplesFromTimeTAndYValues(curveTimeStepsY, curveValuesY, isLogCurve); m_qwtPlotCurve->setSamplesFromTimeTAndYValues( curveTimeStepsY, curveValuesY, isLogCurve );
} }
} }
} }

View File

@@ -583,12 +583,12 @@ std::vector<RifSummaryReaderInterface*> RimSummaryPlotSourceStepping::summaryRea
{ {
for ( auto curve : curveCollection->curves() ) for ( auto curve : curveCollection->curves() )
{ {
if (isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader()) if ( isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader() )
{ {
readers.push_back( curve->summaryCaseY()->summaryReader() ); readers.push_back( curve->summaryCaseY()->summaryReader() );
} }
if (isXAxisStepping() && curve->summaryCaseX() && curve->summaryCaseX()->summaryReader()) if ( isXAxisStepping() && curve->summaryCaseX() && curve->summaryCaseX()->summaryReader() )
{ {
readers.push_back( curve->summaryCaseX()->summaryReader() ); readers.push_back( curve->summaryCaseX()->summaryReader() );
} }
@@ -604,7 +604,7 @@ std::vector<RifSummaryReaderInterface*> RimSummaryPlotSourceStepping::summaryRea
{ {
for ( auto curve : curveSet->curves() ) for ( auto curve : curveSet->curves() )
{ {
if (isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader()) if ( isYAxisStepping() && curve->summaryCaseY() && curve->summaryCaseY()->summaryReader() )
{ {
readers.push_back( curve->summaryCaseY()->summaryReader() ); readers.push_back( curve->summaryCaseY()->summaryReader() );
} }

View File

@@ -1,17 +1,17 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
// //
// Copyright (C) 2017 Statoil ASA // Copyright (C) 2017 Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // 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. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@@ -21,11 +21,11 @@
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RimContextCommandBuilder.h" #include "RimContextCommandBuilder.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h" #include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlot.h" #include "RimWellAllocationPlot.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RiuContextMenuLauncher.h" #include "RiuContextMenuLauncher.h"
#include "RiuNightchartsWidget.h" #include "RiuNightchartsWidget.h"
@@ -38,76 +38,73 @@
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent) RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent )
: QFrame(parent) : QFrame( parent )
, m_plotDefinition(plotDefinition) , m_plotDefinition( plotDefinition )
{ {
Q_ASSERT(m_plotDefinition); Q_ASSERT( m_plotDefinition );
QVBoxLayout* mainLayout = new QVBoxLayout(); QVBoxLayout* mainLayout = new QVBoxLayout();
this->setLayout(mainLayout); this->setLayout( mainLayout );
this->layout()->setMargin(0); this->layout()->setMargin( 0 );
this->layout()->setSpacing(2); this->layout()->setSpacing( 2 );
m_titleLabel = new QLabel(this); m_titleLabel = new QLabel( this );
new RiuPlotObjectPicker(m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot()); new RiuPlotObjectPicker( m_titleLabel, m_plotDefinition->accumulatedWellFlowPlot() );
QFont font = m_titleLabel->font(); QFont font = m_titleLabel->font();
font.setPointSize(14); font.setPointSize( 14 );
font.setBold(true); font.setBold( true );
m_titleLabel->setFont(font); m_titleLabel->setFont( font );
// White background // White background
QPalette pal = this->palette(); QPalette pal = this->palette();
pal.setColor(QPalette::Background, Qt::white); pal.setColor( QPalette::Background, Qt::white );
this->setAutoFillBackground(true); this->setAutoFillBackground( true );
this->setPalette(pal); this->setPalette( pal );
mainLayout->addWidget(m_titleLabel, 0, Qt::AlignCenter); mainLayout->addWidget( m_titleLabel, 0, Qt::AlignCenter );
auto plotWidgetsLayout = new QHBoxLayout(); auto plotWidgetsLayout = new QHBoxLayout();
auto rightColumnLayout = new QVBoxLayout(); auto rightColumnLayout = new QVBoxLayout();
mainLayout->addLayout(plotWidgetsLayout); mainLayout->addLayout( plotWidgetsLayout );
plotWidgetsLayout->addLayout(rightColumnLayout); plotWidgetsLayout->addLayout( rightColumnLayout );
m_legendWidget = new RiuNightchartsWidget(this); m_legendWidget = new RiuNightchartsWidget( this );
new RiuPlotObjectPicker(m_legendWidget, m_plotDefinition->plotLegend()); new RiuPlotObjectPicker( m_legendWidget, m_plotDefinition->plotLegend() );
caf::CmdFeatureMenuBuilder menuBuilder; caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowTotalAllocationDataFeature"; menuBuilder << "RicShowTotalAllocationDataFeature";
new RiuContextMenuLauncher(m_legendWidget, menuBuilder); new RiuContextMenuLauncher( m_legendWidget, menuBuilder );
rightColumnLayout->addWidget(m_legendWidget); rightColumnLayout->addWidget( m_legendWidget );
m_legendWidget->showPie(false); m_legendWidget->showPie( false );
QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget(this); QWidget* totalFlowAllocationWidget = m_plotDefinition->totalWellFlowPlot()->createViewWidget( this );
new RiuPlotObjectPicker(totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot()); new RiuPlotObjectPicker( totalFlowAllocationWidget, m_plotDefinition->totalWellFlowPlot() );
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder); new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop); rightColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
rightColumnLayout->addWidget(m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop); rightColumnLayout->addWidget( m_plotDefinition->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
Qt::AlignTop );
rightColumnLayout->addStretch(); rightColumnLayout->addStretch();
QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget(); QWidget* wellFlowWidget = m_plotDefinition->accumulatedWellFlowPlot()->createPlotWidget();
plotWidgetsLayout->addWidget(wellFlowWidget); plotWidgetsLayout->addWidget( wellFlowWidget );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::~RiuWellAllocationPlot() RiuWellAllocationPlot::~RiuWellAllocationPlot() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition() RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
{ {
@@ -115,7 +112,7 @@ RimWellAllocationPlot* RiuWellAllocationPlot::ownerPlotDefinition()
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const
{ {
@@ -123,96 +120,89 @@ RimViewWindow* RiuWellAllocationPlot::ownerViewWindow() const
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showTitle(const QString& title) void RiuWellAllocationPlot::showTitle( const QString& title )
{ {
m_titleLabel->show(); m_titleLabel->show();
m_titleLabel->setText(title); m_titleLabel->setText( title );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::hideTitle() void RiuWellAllocationPlot::hideTitle()
{ {
m_titleLabel->hide(); m_titleLabel->hide();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::showLegend(bool doShow) void RiuWellAllocationPlot::showLegend( bool doShow )
{ {
if (doShow) if ( doShow )
m_legendWidget->show(); m_legendWidget->show();
else else
m_legendWidget->hide(); m_legendWidget->hide();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::addLegendItem(const QString& name, const cvf::Color3f& color, float value) void RiuWellAllocationPlot::addLegendItem( const QString& name, const cvf::Color3f& color, float value )
{ {
QColor sliceColor(color.rByte(), color.gByte(), color.bByte()); QColor sliceColor( color.rByte(), color.gByte(), color.bByte() );
m_legendWidget->addItem(name, sliceColor, value); m_legendWidget->addItem( name, sliceColor, value );
m_legendWidget->updateGeometry(); m_legendWidget->updateGeometry();
m_legendWidget->update(); m_legendWidget->update();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellAllocationPlot::clearLegend() void RiuWellAllocationPlot::clearLegend()
{ {
m_legendWidget->clear(); m_legendWidget->clear();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::minimumSizeHint() const 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; caf::CmdFeatureMenuBuilder menuBuilder;
menuBuilder << "RicShowContributingWellsFromPlotFeature"; 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 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 // Copyright (C) 2017 Statoil ASA
// //
// ResInsight is free software: you can redistribute it and/or modify // ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or // WARRANTY; without even the implied warranty of MERCHANTABILITY or
// FITNESS FOR A PARTICULAR PURPOSE. // 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. // for more details.
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
@@ -22,8 +22,8 @@
#include "cafPdmPointer.h" #include "cafPdmPointer.h"
#include <QPointer>
#include <QFrame> #include <QFrame>
#include <QPointer>
#include "RiuInterfaceToViewWindow.h" #include "RiuInterfaceToViewWindow.h"
@@ -32,8 +32,9 @@ class RiuNightchartsWidget;
class QLabel; class QLabel;
namespace cvf { namespace cvf
class Color3f; {
class Color3f;
} }
//================================================================================================== //==================================================================================================
@@ -44,31 +45,31 @@ namespace cvf {
class RiuWellAllocationPlot : public QFrame, public RiuInterfaceToViewWindow class RiuWellAllocationPlot : public QFrame, public RiuInterfaceToViewWindow
{ {
Q_OBJECT; Q_OBJECT;
public: public:
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr); RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellAllocationPlot() override; ~RiuWellAllocationPlot() override;
RimWellAllocationPlot* ownerPlotDefinition(); RimWellAllocationPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override; 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: protected:
QSize sizeHint() const override; QSize sizeHint() const override;
QSize minimumSizeHint() const override; QSize minimumSizeHint() const override;
void contextMenuEvent(QContextMenuEvent *) override; void contextMenuEvent( QContextMenuEvent* ) override;
private: private:
void setDefaults(); void setDefaults();
private: private:
caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition; caf::PdmPointer<RimWellAllocationPlot> m_plotDefinition;
QPointer<RiuNightchartsWidget> m_legendWidget; QPointer<RiuNightchartsWidget> m_legendWidget;
QPointer<QLabel> m_titleLabel; QPointer<QLabel> m_titleLabel;
}; };