Clang-format changed files

This commit is contained in:
Gaute Lindkvist 2019-09-06 13:17:36 +02:00
parent bf9f43c3b4
commit de8a5a59f3
34 changed files with 3612 additions and 3469 deletions

View File

@ -19,27 +19,27 @@
#include "RicNewPltPlotFeature.h" #include "RicNewPltPlotFeature.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RicNewWellLogPlotFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h"
#include "RicWellLogPlotCurveFeatureImpl.h"
#include "RiaApplication.h" #include "RiaApplication.h"
#include "RigWellLogCurveData.h" #include "RigWellLogCurveData.h"
#include "Rim3dView.h"
#include "RimEclipseResultCase.h"
#include "RimMainPlotCollection.h"
#include "RimPltPlotCollection.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSimWellInView.h" #include "RimSimWellInView.h"
#include "Rim3dView.h"
#include "RimWellLogExtractionCurve.h" #include "RimWellLogExtractionCurve.h"
#include "RimWellPltPlot.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "RimPltPlotCollection.h" #include "RimWellPltPlot.h"
#include "RimMainPlotCollection.h"
#include "RimEclipseResultCase.h"
#include "RiuPlotMainWindowTools.h"
#include "Riu3dSelectionManager.h" #include "Riu3dSelectionManager.h"
#include "RiuPlotMainWindowTools.h"
#include "cafSelectionManagerTools.h" #include "cafSelectionManagerTools.h"
@ -47,36 +47,35 @@
#include <vector> #include <vector>
CAF_CMD_SOURCE_INIT( RicNewPltPlotFeature, "RicNewPltPlotFeature" );
CAF_CMD_SOURCE_INIT(RicNewPltPlotFeature, "RicNewPltPlotFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RicNewPltPlotFeature::isCommandEnabled() bool RicNewPltPlotFeature::isCommandEnabled()
{ {
if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false; if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false;
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>(); RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>(); RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
bool enable = true; bool enable = true;
if (selectedWellPath) if ( selectedWellPath )
{ {
if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath)) if ( selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData( selectedWellPath ) )
{ {
return false; return false;
} }
} }
if (simWell != nullptr) if ( simWell != nullptr )
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
QString simWellName = simWell->name(); QString simWellName = simWell->name();
RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName); RimWellPath* wellPath = proj->wellPathFromSimWellName( simWellName );
enable = wellPath != nullptr; enable = wellPath != nullptr;
} }
return enable; return enable;
} }
@ -84,58 +83,58 @@ bool RicNewPltPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::onActionTriggered(bool isChecked) void RicNewPltPlotFeature::onActionTriggered( bool isChecked )
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection(); RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection();
if (pltPlotColl) if ( pltPlotColl )
{ {
QString wellPathName; QString wellPathName;
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
RimSimWellInView* eclipseWell = nullptr; RimSimWellInView* eclipseWell = nullptr;
if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>()) != nullptr) if ( ( wellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>() ) != nullptr )
{ {
wellPathName = wellPath->name(); wellPathName = wellPath->name();
} }
else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>()) != nullptr) else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>() ) != nullptr )
{ {
wellPath = proj->wellPathFromSimWellName(eclipseWell->name()); wellPath = proj->wellPathFromSimWellName( eclipseWell->name() );
if (!wellPath ) return; if ( !wellPath ) return;
wellPathName = wellPath->name(); wellPathName = wellPath->name();
} }
QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName); QString plotName = QString( RimWellPltPlot::plotNameFormatString() ).arg( wellPathName );
RimWellPltPlot* pltPlot = new RimWellPltPlot(); RimWellPltPlot* pltPlot = new RimWellPltPlot();
pltPlot->setCurrentWellName(wellPathName); pltPlot->setCurrentWellName( wellPathName );
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
pltPlot->addTrack(plotTrack); pltPlot->addTrack( plotTrack );
plotTrack->setDescription(QString("Track %1").arg(pltPlot->trackCount())); plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->trackCount() ) );
pltPlotColl->addPlot(pltPlot); pltPlotColl->addPlot( pltPlot );
pltPlot->setDescription(plotName); pltPlot->setDescription( plotName );
//pltPlot->applyInitialSelections(); // pltPlot->applyInitialSelections();
pltPlot->loadDataAndUpdate(); pltPlot->loadDataAndUpdate();
pltPlotColl->updateConnectedEditors(); pltPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack); RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot); RiuPlotMainWindowTools::selectAsCurrentItem( pltPlot );
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewPltPlotFeature::setupActionLook(QAction* actionToSetup) void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup )
{ {
actionToSetup->setText("New PLT Plot"); actionToSetup->setText( "New PLT Plot" );
actionToSetup->setIcon(QIcon(":/WellFlowPlot16x16.png")); actionToSetup->setIcon( QIcon( ":/WellFlowPlot16x16.png" ) );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -150,20 +149,20 @@ RimWellPath* RicNewPltPlotFeature::selectedWellPath() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex ) const
{ {
RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY); RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY );
RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>(selItem); RiuSimWellSelectionItem* simWellSelItem = dynamic_cast<RiuSimWellSelectionItem*>( selItem );
if (simWellSelItem) if ( simWellSelItem )
{ {
(*branchIndex) = static_cast<int>(simWellSelItem->m_branchIndex); ( *branchIndex ) = static_cast<int>( simWellSelItem->m_branchIndex );
return simWellSelItem->m_simWell; return simWellSelItem->m_simWell;
} }
else else
{ {
std::vector<RimSimWellInView*> selection; std::vector<RimSimWellInView*> selection;
caf::SelectionManager::instance()->objectsByType(&selection); caf::SelectionManager::instance()->objectsByType( &selection );
(*branchIndex) = 0; ( *branchIndex ) = 0;
return selection.size() > 0 ? selection[0] : nullptr; return selection.size() > 0 ? selection[0] : nullptr;
} }
} }
@ -174,8 +173,7 @@ RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex
bool RicNewPltPlotFeature::caseAvailable() const bool RicNewPltPlotFeature::caseAvailable() const
{ {
std::vector<RimCase*> cases; std::vector<RimCase*> cases;
RiaApplication::instance()->project()->allCases(cases); RiaApplication::instance()->project()->allCases( cases );
return cases.size() > 0; return cases.size() > 0;
} }

View File

@ -37,8 +37,7 @@
#include <vector> #include <vector>
CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" );
CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -46,9 +45,9 @@ CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature");
bool RicNewRftPlotFeature::isCommandEnabled() bool RicNewRftPlotFeature::isCommandEnabled()
{ {
RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>(); RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimRftPlotCollection*>();
if (simWell) return true; if ( simWell ) return true;
if (selectedWellName().isEmpty()) if ( selectedWellName().isEmpty() )
{ {
return false; return false;
} }
@ -59,44 +58,44 @@ bool RicNewRftPlotFeature::isCommandEnabled()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::onActionTriggered(bool isChecked) void RicNewRftPlotFeature::onActionTriggered( bool isChecked )
{ {
RimProject* proj = RiaApplication::instance()->project(); RimProject* proj = RiaApplication::instance()->project();
RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection(); RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection();
if (rftPlotColl) if ( rftPlotColl )
{ {
QString wellName = selectedWellName(); QString wellName = selectedWellName();
QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName); QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName );
RimWellRftPlot* rftPlot = new RimWellRftPlot(); RimWellRftPlot* rftPlot = new RimWellRftPlot();
rftPlot->setSimWellOrWellPathName(wellName); rftPlot->setSimWellOrWellPathName( wellName );
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
rftPlot->addTrack(plotTrack); rftPlot->addTrack( plotTrack );
plotTrack->setDescription(QString("Track %1").arg(rftPlot->trackCount())); plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) );
rftPlotColl->addPlot(rftPlot); rftPlotColl->addPlot( rftPlot );
rftPlot->setDescription(plotName); rftPlot->setDescription( plotName );
rftPlot->applyInitialSelections(); rftPlot->applyInitialSelections();
rftPlot->loadDataAndUpdate(); rftPlot->loadDataAndUpdate();
rftPlotColl->updateConnectedEditors(); rftPlotColl->updateConnectedEditors();
RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::showPlotMainWindow();
RiuPlotMainWindowTools::setExpanded(plotTrack); RiuPlotMainWindowTools::setExpanded( plotTrack );
RiuPlotMainWindowTools::selectAsCurrentItem(rftPlot); RiuPlotMainWindowTools::selectAsCurrentItem( rftPlot );
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup) void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup )
{ {
actionToSetup->setText("New RFT Plot"); actionToSetup->setText( "New RFT Plot" );
actionToSetup->setIcon(QIcon(":/FlowCharPlot16x16.png")); actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -105,10 +104,10 @@ void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup)
QString RicNewRftPlotFeature::selectedWellName() QString RicNewRftPlotFeature::selectedWellName()
{ {
RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>(); RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject<RimSimWellInView*>();
if (simWell) return simWell->name(); if ( simWell ) return simWell->name();
RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>(); RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject<RimWellPath*>();
if (rimWellPath) return rimWellPath->name(); if ( rimWellPath ) return rimWellPath->name();
return QString(); return QString();
} }

View File

@ -24,33 +24,33 @@
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigFlowDiagResultAddress.h" #include "RigFlowDiagResultAddress.h"
#include "RigFlowDiagResults.h" #include "RigFlowDiagResults.h"
#include "RigSimWellData.h"
#include "RigSimulationWellCenterLineCalculator.h" #include "RigSimulationWellCenterLineCalculator.h"
#include "RigSimulationWellCoordsAndMD.h" #include "RigSimulationWellCoordsAndMD.h"
#include "RigSimWellData.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimEclipseView.h" #include "RimEclipseView.h"
#include "RimSimWellInViewCollection.h"
#include "RimFlowDiagSolution.h" #include "RimFlowDiagSolution.h"
#include "RimProject.h" #include "RimProject.h"
#include "RimSimWellInView.h" #include "RimSimWellInView.h"
#include "RimSimWellInViewCollection.h"
#include "RimTofAccumulatedPhaseFractionsPlot.h" #include "RimTofAccumulatedPhaseFractionsPlot.h"
#include "RimTotalWellAllocationPlot.h" #include "RimTotalWellAllocationPlot.h"
#include "RimWellAllocationPlotLegend.h" #include "RimWellAllocationPlotLegend.h"
#include "RimWellFlowRateCurve.h" #include "RimWellFlowRateCurve.h"
#include "RimWellLogFile.h" #include "RimWellLogFile.h"
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellPlotTools.h"
#include "RimWellLogTrack.h" #include "RimWellLogTrack.h"
#include "RimWellPlotTools.h"
#include "RiuWellLogPlot.h"
#include "RiuPlotMainWindow.h" #include "RiuPlotMainWindow.h"
#include "RiuWellAllocationPlot.h" #include "RiuWellAllocationPlot.h"
#include "RiuWellLogPlot.h"
#include "RiuWellLogTrack.h" #include "RiuWellLogTrack.h"
CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); CAF_PDM_SOURCE_INIT( RimWellAllocationPlot, "WellAllocationPlot" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -58,16 +58,14 @@ CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot");
namespace caf namespace caf
{ {
template <>
template<>
void AppEnum<RimWellAllocationPlot::FlowType>::setUp() void AppEnum<RimWellAllocationPlot::FlowType>::setUp()
{ {
addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated"); addItem( RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated" );
addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates"); addItem( RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates" );
setDefault(RimWellAllocationPlot::ACCUMULATED); setDefault( RimWellAllocationPlot::ACCUMULATED );
}
} }
} // namespace caf
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -75,45 +73,60 @@ void AppEnum<RimWellAllocationPlot::FlowType>::setUp()
RimWellAllocationPlot::RimWellAllocationPlot() RimWellAllocationPlot::RimWellAllocationPlot()
: RimWellLogPlot() : RimWellLogPlot()
{ {
CAF_PDM_InitObject("Well Allocation Plot", ":/WellAllocPlot16x16.png", "", ""); CAF_PDM_InitObject( "Well Allocation Plot", ":/WellAllocPlot16x16.png", "", "" );
CAF_PDM_InitField(&m_showPlotTitle_OBSOLETE, "ShowPlotTitle", true, "Show Plot Title", "", "", ""); CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", true, "Show Plot Title", "", "", "" );
m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false); m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitField(&m_branchDetection, "BranchDetection", true, "Branch Detection", "", CAF_PDM_InitField( &m_branchDetection,
"Compute branches based on how simulation well cells are organized", ""); "BranchDetection",
true,
"Branch Detection",
"",
"Compute branches based on how simulation well cells are organized",
"" );
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" );
m_case.uiCapability()->setUiTreeChildrenHidden(true); m_case.uiCapability()->setUiTreeChildrenHidden( true );
CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", ""); CAF_PDM_InitField( &m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "" );
CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", ""); CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_flowType, "FlowType", "Flow Type", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_flowType, "FlowType", "Flow Type", "", "", "" );
CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", ""); CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" );
CAF_PDM_InitField(&m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", ""); CAF_PDM_InitField( &m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot_OBSOLETE, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_accumulatedWellFlowPlot_OBSOLETE,
m_accumulatedWellFlowPlot_OBSOLETE.uiCapability()->setUiHidden(true); "AccumulatedWellFlowPlot",
"Accumulated Well Flow",
"",
"",
"" );
m_accumulatedWellFlowPlot_OBSOLETE.uiCapability()->setUiHidden( true );
m_accumulatedWellFlowPlot_OBSOLETE = new RimWellLogPlot; m_accumulatedWellFlowPlot_OBSOLETE = new RimWellLogPlot;
m_accumulatedWellFlowPlot_OBSOLETE->setDepthUnit(RiaDefines::UNIT_NONE); m_accumulatedWellFlowPlot_OBSOLETE->setDepthUnit( RiaDefines::UNIT_NONE );
m_accumulatedWellFlowPlot_OBSOLETE->setDepthType(RimWellLogPlot::CONNECTION_NUMBER); m_accumulatedWellFlowPlot_OBSOLETE->setDepthType( RimWellLogPlot::CONNECTION_NUMBER );
m_accumulatedWellFlowPlot_OBSOLETE->setTrackLegendsVisible(false); m_accumulatedWellFlowPlot_OBSOLETE->setTrackLegendsVisible( false );
m_accumulatedWellFlowPlot_OBSOLETE->uiCapability()->setUiIconFromResourceString(":/WellFlowPlot16x16.png"); m_accumulatedWellFlowPlot_OBSOLETE->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" );
m_accumulatedWellFlowPlot_OBSOLETE.xmlCapability()->setIOWritable(false); m_accumulatedWellFlowPlot_OBSOLETE.xmlCapability()->setIOWritable( false );
CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" );
m_totalWellAllocationPlot.uiCapability()->setUiHidden(true); m_totalWellAllocationPlot.uiCapability()->setUiHidden( true );
m_totalWellAllocationPlot = new RimTotalWellAllocationPlot; m_totalWellAllocationPlot = new RimTotalWellAllocationPlot;
CAF_PDM_InitFieldNoDefault(&m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", "" );
m_wellAllocationPlotLegend.uiCapability()->setUiHidden(true); m_wellAllocationPlotLegend.uiCapability()->setUiHidden( true );
m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend; m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend;
CAF_PDM_InitFieldNoDefault(&m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", "TOF Accumulated Phase Fractions", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_tofAccumulatedPhaseFractionsPlot,
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden(true); "TofAccumulatedPhaseFractionsPlot",
"TOF Accumulated Phase Fractions",
"",
"",
"" );
m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden( true );
m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot; m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot;
m_nameConfig->setCustomName("Well Allocation Plot"); m_nameConfig->setCustomName( "Well Allocation Plot" );
this->setAsPlotMdiWindow(); this->setAsPlotMdiWindow();
} }
@ -134,14 +147,14 @@ RimWellAllocationPlot::~RimWellAllocationPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::setFromSimulationWell(RimSimWellInView* simWell) void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell )
{ {
RimEclipseView* eclView; RimEclipseView* eclView;
simWell->firstAncestorOrThisOfType(eclView); simWell->firstAncestorOrThisOfType( eclView );
RimEclipseResultCase* eclCase; RimEclipseResultCase* eclCase;
simWell->firstAncestorOrThisOfType(eclCase); simWell->firstAncestorOrThisOfType( eclCase );
m_case = eclCase; m_case = eclCase;
m_wellName = simWell->simWellData()->m_wellName; m_wellName = simWell->simWellData()->m_wellName;
m_timeStep = eclView->currentTimeStep(); m_timeStep = eclView->currentTimeStep();
@ -163,183 +176,189 @@ void RimWellAllocationPlot::updateFromWell()
// Delete existing tracks // Delete existing tracks
{ {
std::vector<RimWellLogTrack*> tracks; std::vector<RimWellLogTrack*> tracks;
descendantsIncludingThisOfType(tracks); descendantsIncludingThisOfType( tracks );
for (RimWellLogTrack* t : tracks) for ( RimWellLogTrack* t : tracks )
{ {
removeTrack(t); removeTrack( t );
delete t; delete t;
} }
} }
CVF_ASSERT(trackCount() == 0); CVF_ASSERT( trackCount() == 0 );
QString description; QString description;
if (m_flowType() == ACCUMULATED) description = "Accumulated Flow"; if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow";
if (m_flowType() == INFLOW) description = "Inflow Rates"; if ( m_flowType() == INFLOW ) description = "Inflow Rates";
setDescription(description + " (" + m_wellName + ")"); setDescription( description + " (" + m_wellName + ")" );
if (!m_case) return; if ( !m_case ) return;
const RigSimWellData* simWellData = m_case->eclipseCaseData()->findSimWellData(m_wellName); const RigSimWellData* simWellData = m_case->eclipseCaseData()->findSimWellData( m_wellName );
if (!simWellData) return; if ( !simWellData ) return;
// Set up the Accumulated Well Flow Calculator // Set up the Accumulated Well Flow Calculator
std::vector< std::vector <cvf::Vec3d> > pipeBranchesCLCoords; std::vector<std::vector<cvf::Vec3d>> pipeBranchesCLCoords;
std::vector< std::vector <RigWellResultPoint> > pipeBranchesCellIds; std::vector<std::vector<RigWellResultPoint>> pipeBranchesCellIds;
RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->eclipseCaseData(), RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame( m_case->eclipseCaseData(),
simWellData, simWellData,
m_timeStep, m_timeStep,
m_branchDetection, m_branchDetection,
true, true,
pipeBranchesCLCoords, pipeBranchesCLCoords,
pipeBranchesCellIds); pipeBranchesCellIds );
std::map<QString, const std::vector<double>* > tracerFractionCellValues = findRelevantTracerCellFractions(simWellData); std::map<QString, const std::vector<double>*> tracerFractionCellValues = findRelevantTracerCellFractions(
simWellData );
std::unique_ptr< RigAccWellFlowCalculator > wfCalculator; std::unique_ptr<RigAccWellFlowCalculator> wfCalculator;
double smallContributionThreshold = 0.0; double smallContributionThreshold = 0.0;
if (m_groupSmallContributions()) smallContributionThreshold = m_smallContributionsThreshold; if ( m_groupSmallContributions() ) smallContributionThreshold = m_smallContributionsThreshold;
if ( tracerFractionCellValues.size() ) if ( tracerFractionCellValues.size() )
{ {
bool isProducer = ( simWellData->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER bool isProducer = ( simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::PRODUCER ||
|| simWellData->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ); simWellData->wellProductionType( m_timeStep ) ==
RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)); RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE );
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(),
pipeBranchesCellIds, m_case->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL ) );
tracerFractionCellValues, wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords,
cellIdxCalc, pipeBranchesCellIds,
smallContributionThreshold, tracerFractionCellValues,
isProducer)); cellIdxCalc,
smallContributionThreshold,
isProducer ) );
} }
else else
{ {
if (pipeBranchesCLCoords.size() > 0) if ( pipeBranchesCLCoords.size() > 0 )
{ {
wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, wfCalculator.reset(
pipeBranchesCellIds, new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) );
smallContributionThreshold));
} }
} }
auto depthType = this->depthType(); auto depthType = this->depthType();
if (depthType == RimWellLogPlot::MEASURED_DEPTH) return; if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return;
// Create tracks and curves from the calculated data // Create tracks and curves from the calculated data
size_t branchCount = pipeBranchesCLCoords.size(); size_t branchCount = pipeBranchesCLCoords.size();
for (size_t brIdx = 0; brIdx < branchCount; ++brIdx) for ( size_t brIdx = 0; brIdx < branchCount; ++brIdx )
{ {
// Skip Tiny dummy branches // Skip Tiny dummy branches
if (pipeBranchesCellIds[brIdx].size() <= 3) continue; if ( pipeBranchesCellIds[brIdx].size() <= 3 ) continue;
RimWellLogTrack* plotTrack = new RimWellLogTrack(); RimWellLogTrack* plotTrack = new RimWellLogTrack();
plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1)); plotTrack->setDescription( QString( "Branch %1" ).arg( brIdx + 1 ) );
plotTrack->setFormationsForCaseWithSimWellOnly(true); plotTrack->setFormationsForCaseWithSimWellOnly( true );
plotTrack->setFormationBranchIndex((int)brIdx); plotTrack->setFormationBranchIndex( (int)brIdx );
addTrack(plotTrack); addTrack( plotTrack );
const std::vector<double>& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) : const std::vector<double>& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER
depthType == RimWellLogPlot::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop(brIdx) : ? wfCalculator->connectionNumbersFromTop( brIdx )
depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) : : depthType == RimWellLogPlot::PSEUDO_LENGTH
std::vector<double>(); ? wfCalculator->pseudoLengthFromTop( brIdx )
: depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH
? wfCalculator->trueVerticalDepth( brIdx )
: std::vector<double>();
{ {
std::vector<QString> tracerNames = wfCalculator->tracerNames(); std::vector<QString> tracerNames = wfCalculator->tracerNames();
for (const QString& tracerName: tracerNames) for ( const QString& tracerName : tracerNames )
{ {
const std::vector<double>* accFlow = nullptr; const std::vector<double>* accFlow = nullptr;
if (depthType == RimWellLogPlot::CONNECTION_NUMBER) if ( depthType == RimWellLogPlot::CONNECTION_NUMBER )
{ {
accFlow = &(m_flowType == ACCUMULATED ? accFlow = &( m_flowType == ACCUMULATED
wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): ? wfCalculator->accumulatedTracerFlowPrConnection( tracerName, brIdx )
wfCalculator->tracerFlowPrConnection(tracerName, brIdx)); : wfCalculator->tracerFlowPrConnection( tracerName, brIdx ) );
} }
else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH) else if ( depthType == RimWellLogPlot::PSEUDO_LENGTH || depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH )
{ {
accFlow = &(m_flowType == ACCUMULATED ? accFlow = &( m_flowType == ACCUMULATED
wfCalculator->accumulatedTracerFlowPrPseudoLength(tracerName, brIdx): ? wfCalculator->accumulatedTracerFlowPrPseudoLength( tracerName, brIdx )
wfCalculator->tracerFlowPrPseudoLength(tracerName, brIdx)); : wfCalculator->tracerFlowPrPseudoLength( tracerName, brIdx ) );
} }
if (accFlow) if ( accFlow )
{ {
addStackedCurve(tracerName, depthValues, *accFlow, plotTrack); addStackedCurve( tracerName, depthValues, *accFlow, plotTrack );
// TODO: THIs is the data to be plotted... // TODO: THIs is the data to be plotted...
} }
} }
} }
updateWellFlowPlotXAxisTitle( plotTrack );
updateWellFlowPlotXAxisTitle(plotTrack);
} }
QString wellStatusText = QString("(%1)").arg(RimWellAllocationPlot::wellStatusTextForTimeStep(m_wellName, m_case, m_timeStep)); QString wellStatusText = QString( "(%1)" ).arg(
RimWellAllocationPlot::wellStatusTextForTimeStep( m_wellName, m_case, m_timeStep ) );
QString flowTypeText = m_flowDiagSolution() ? "Well Allocation": "Well Flow"; QString flowTypeText = m_flowDiagSolution() ? "Well Allocation" : "Well Flow";
setDescription(flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")"); setDescription( flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " +
m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")" );
/// Pie chart /// Pie chart
m_totalWellAllocationPlot->clearSlices(); m_totalWellAllocationPlot->clearSlices();
if (allocationPlotWidget()) if ( allocationPlotWidget() )
{ {
allocationPlotWidget()->clearLegend(); allocationPlotWidget()->clearLegend();
} }
if (wfCalculator) if ( wfCalculator )
{ {
std::vector<std::pair<QString, double> > totalTracerFractions = wfCalculator->totalTracerFractions() ; std::vector<std::pair<QString, double>> totalTracerFractions = wfCalculator->totalTracerFractions();
for ( const auto& tracerVal : totalTracerFractions ) for ( const auto& tracerVal : totalTracerFractions )
{ {
cvf::Color3f color; cvf::Color3f color;
if (m_flowDiagSolution) if ( m_flowDiagSolution )
color = m_flowDiagSolution->tracerColor(tracerVal.first); color = m_flowDiagSolution->tracerColor( tracerVal.first );
else else
color = getTracerColor(tracerVal.first); color = getTracerColor( tracerVal.first );
double tracerPercent = 100*tracerVal.second; double tracerPercent = 100 * tracerVal.second;
m_totalWellAllocationPlot->addSlice(tracerVal.first, color, tracerPercent); m_totalWellAllocationPlot->addSlice( tracerVal.first, color, tracerPercent );
if (allocationPlotWidget()) allocationPlotWidget()->addLegendItem(tracerVal.first, color, tracerPercent); if ( allocationPlotWidget() )
allocationPlotWidget()->addLegendItem( tracerVal.first, color, tracerPercent );
} }
} }
if (allocationPlotWidget()) allocationPlotWidget()->showLegend(m_wellAllocationPlotLegend->isShowingLegend()); if ( allocationPlotWidget() ) allocationPlotWidget()->showLegend( m_wellAllocationPlotLegend->isShowingLegend() );
m_totalWellAllocationPlot->updateConnectedEditors(); m_totalWellAllocationPlot->updateConnectedEditors();
updateConnectedEditors(); updateConnectedEditors();
m_tofAccumulatedPhaseFractionsPlot->reloadFromWell(); m_tofAccumulatedPhaseFractionsPlot->reloadFromWell();
m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors(); m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors();
if (allocationPlotWidget()) allocationPlotWidget()->updateGeometry(); if ( allocationPlotWidget() ) allocationPlotWidget()->updateGeometry();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findRelevantTracerCellFractions(const RigSimWellData* simWellData) std::map<QString, const std::vector<double>*>
RimWellAllocationPlot::findRelevantTracerCellFractions( const RigSimWellData* simWellData )
{ {
std::map<QString, const std::vector<double> *> tracerCellFractionValues; std::map<QString, const std::vector<double>*> tracerCellFractionValues;
if ( m_flowDiagSolution && simWellData->hasWellResult(m_timeStep) ) if ( m_flowDiagSolution && simWellData->hasWellResult( m_timeStep ) )
{ {
RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED; RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED;
const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType(m_timeStep); const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType( m_timeStep );
if ( prodType == RigWellResultFrame::PRODUCER if ( prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
|| prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE )
{ {
requestedTracerType = RimFlowDiagSolution::INJECTOR; requestedTracerType = RimFlowDiagSolution::INJECTOR;
} }
@ -351,11 +370,14 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames(); std::vector<QString> tracerNames = m_flowDiagSolution->tracerNames();
for ( const QString& tracerName : tracerNames ) for ( const QString& tracerName : tracerNames )
{ {
if ( m_flowDiagSolution->tracerStatusInTimeStep(tracerName, m_timeStep) == requestedTracerType ) if ( m_flowDiagSolution->tracerStatusInTimeStep( tracerName, m_timeStep ) == requestedTracerType )
{ {
RigFlowDiagResultAddress resAddr(RIG_FLD_CELL_FRACTION_RESNAME, RigFlowDiagResultAddress::PHASE_ALL, tracerName.toStdString()); RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME,
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep); RigFlowDiagResultAddress::PHASE_ALL,
if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions; tracerName.toStdString() );
const std::vector<double>* tracerCellFractions = m_flowDiagSolution->flowDiagResults()
->resultValues( resAddr, m_timeStep );
if ( tracerCellFractions ) tracerCellFractionValues[tracerName] = tracerCellFractions;
} }
} }
} }
@ -366,16 +388,16 @@ std::map<QString, const std::vector<double> *> RimWellAllocationPlot::findReleva
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack) void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack )
{ {
RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType(); RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType();
RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR : RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR
RimWellLogFile::WELL_FLOW_COND_STANDARD; : RimWellLogFile::WELL_FLOW_COND_STANDARD;
QString axisTitle = RimWellPlotTools::flowPlotAxisTitle(condition, unitSet); QString axisTitle = RimWellPlotTools::flowPlotAxisTitle( condition, unitSet );
plotTrack->setXAxisTitle(axisTitle); plotTrack->setXAxisTitle( axisTitle );
#if 0 #if 0
if (m_flowDiagSolution) if (m_flowDiagSolution)
{ {
QString unitText; QString unitText;
@ -417,72 +439,72 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr
plotTrack->setXAxisTitle("Surface Flow Rate " + unitText); plotTrack->setXAxisTitle("Surface Flow Rate " + unitText);
} }
#endif #endif
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::addStackedCurve(const QString& tracerName, void RimWellAllocationPlot::addStackedCurve( const QString& tracerName,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack) RimWellLogTrack* plotTrack )
{ {
RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; RimWellFlowRateCurve* curve = new RimWellFlowRateCurve;
curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow); curve->setFlowValuesPrDepthValue( tracerName, depthValues, accFlow );
if ( m_flowDiagSolution ) if ( m_flowDiagSolution )
{ {
curve->setColor(m_flowDiagSolution->tracerColor(tracerName)); curve->setColor( m_flowDiagSolution->tracerColor( tracerName ) );
} }
else else
{ {
curve->setColor(getTracerColor(tracerName)); curve->setColor( getTracerColor( tracerName ) );
} }
plotTrack->addCurve(curve); plotTrack->addCurve( curve );
curve->loadDataAndUpdate(true); curve->loadDataAndUpdate( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimWellAllocationPlot::wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep) QString RimWellAllocationPlot::wellStatusTextForTimeStep( const QString& wellName,
const RimEclipseResultCase* eclipseResultCase,
size_t timeStep )
{ {
QString statusText = "Undefined"; QString statusText = "Undefined";
if (eclipseResultCase) if ( eclipseResultCase )
{ {
const RigSimWellData* simWellData = eclipseResultCase->eclipseCaseData()->findSimWellData(wellName); const RigSimWellData* simWellData = eclipseResultCase->eclipseCaseData()->findSimWellData( wellName );
if (simWellData) if ( simWellData )
{ {
if (simWellData->hasWellResult(timeStep)) if ( simWellData->hasWellResult( timeStep ) )
{ {
const RigWellResultFrame& wellResultFrame = simWellData->wellResultFrame(timeStep); const RigWellResultFrame& wellResultFrame = simWellData->wellResultFrame( timeStep );
RigWellResultFrame::WellProductionType prodType = wellResultFrame.m_productionType; RigWellResultFrame::WellProductionType prodType = wellResultFrame.m_productionType;
switch (prodType) switch ( prodType )
{ {
case RigWellResultFrame::PRODUCER: case RigWellResultFrame::PRODUCER:
statusText = "Producer"; statusText = "Producer";
break; break;
case RigWellResultFrame::OIL_INJECTOR: case RigWellResultFrame::OIL_INJECTOR:
statusText = "Oil Injector"; statusText = "Oil Injector";
break; break;
case RigWellResultFrame::GAS_INJECTOR: case RigWellResultFrame::GAS_INJECTOR:
statusText = "Gas Injector"; statusText = "Gas Injector";
break; break;
case RigWellResultFrame::WATER_INJECTOR: case RigWellResultFrame::WATER_INJECTOR:
statusText = "Water Injector"; statusText = "Water Injector";
break; break;
case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE:
break; break;
default: default:
break; break;
} }
} }
} }
@ -502,7 +524,7 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimTofAccumulatedPhaseFractionsPlot * RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot() RimTofAccumulatedPhaseFractionsPlot* RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot()
{ {
return m_tofAccumulatedPhaseFractionsPlot(); return m_tofAccumulatedPhaseFractionsPlot();
} }
@ -534,70 +556,71 @@ int RimWellAllocationPlot::timeStep()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) QList<caf::PdmOptionItemInfo>
RimWellAllocationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); QList<caf::PdmOptionItemInfo> options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if (fieldNeedingOptions == &m_wellName) if ( fieldNeedingOptions == &m_wellName )
{ {
std::set<QString> sortedWellNames = this->findSortedWellNames(); std::set<QString> sortedWellNames = this->findSortedWellNames();
caf::QIconProvider simWellIcon(":/Well.png"); caf::QIconProvider simWellIcon( ":/Well.png" );
for ( const QString& wname: sortedWellNames ) for ( const QString& wname : sortedWellNames )
{ {
options.push_back(caf::PdmOptionItemInfo(wname, wname, false, simWellIcon)); options.push_back( caf::PdmOptionItemInfo( wname, wname, false, simWellIcon ) );
} }
if (options.size() == 0) if ( options.size() == 0 )
{ {
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
} }
else if (fieldNeedingOptions == &m_timeStep) else if ( fieldNeedingOptions == &m_timeStep )
{ {
QStringList timeStepNames; QStringList timeStepNames;
if (m_case && m_case->eclipseCaseData()) if ( m_case && m_case->eclipseCaseData() )
{ {
timeStepNames = m_case->timeStepStrings(); timeStepNames = m_case->timeStepStrings();
} }
for (int i = 0; i < timeStepNames.size(); i++) for ( int i = 0; i < timeStepNames.size(); i++ )
{ {
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i)); options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
} }
} }
else if (fieldNeedingOptions == &m_case) else if ( fieldNeedingOptions == &m_case )
{ {
RimProject* proj = nullptr; RimProject* proj = nullptr;
this->firstAncestorOrThisOfType(proj); this->firstAncestorOrThisOfType( proj );
if (proj) if ( proj )
{ {
std::vector<RimEclipseResultCase*> cases; std::vector<RimEclipseResultCase*> cases;
proj->descendantsIncludingThisOfType(cases); proj->descendantsIncludingThisOfType( cases );
for (RimEclipseResultCase* c : cases) for ( RimEclipseResultCase* c : cases )
{ {
options.push_back(caf::PdmOptionItemInfo(c->caseUserDescription(), c, false, c->uiIconProvider())); options.push_back( caf::PdmOptionItemInfo( c->caseUserDescription(), c, false, c->uiIconProvider() ) );
} }
} }
} }
else if (fieldNeedingOptions == &m_flowDiagSolution) else if ( fieldNeedingOptions == &m_flowDiagSolution )
{ {
if (m_case) if ( m_case )
{ {
//std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions(); // std::vector<RimFlowDiagSolution*> flowSols = m_case->flowDiagSolutions();
// options.push_back(caf::PdmOptionItemInfo("None", nullptr)); // options.push_back(caf::PdmOptionItemInfo("None", nullptr));
//for (RimFlowDiagSolution* flowSol : flowSols) // for (RimFlowDiagSolution* flowSol : flowSols)
//{ //{
// options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon())); // options.push_back(caf::PdmOptionItemInfo(flowSol->userDescription(), flowSol, false, flowSol->uiIcon()));
//} //}
RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution(); RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution();
options.push_back(caf::PdmOptionItemInfo("Well Flow", nullptr)); options.push_back( caf::PdmOptionItemInfo( "Well Flow", nullptr ) );
if (defaultFlowSolution) if ( defaultFlowSolution )
{ {
options.push_back(caf::PdmOptionItemInfo("Allocation", defaultFlowSolution )); options.push_back( caf::PdmOptionItemInfo( "Allocation", defaultFlowSolution ) );
} }
} }
} }
@ -625,19 +648,21 @@ void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::showPlotLegend(bool doShow) void RimWellAllocationPlot::showPlotLegend( bool doShow )
{ {
if (allocationPlotWidget()) allocationPlotWidget()->showLegend(doShow); if ( allocationPlotWidget() ) allocationPlotWidget()->showLegend( doShow );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimWellAllocationPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{ {
RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue); RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue );
if ( changedField == &m_case) if ( changedField == &m_case )
{ {
if ( m_flowDiagSolution && m_case ) if ( m_flowDiagSolution && m_case )
{ {
@ -648,25 +673,26 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF
m_flowDiagSolution = nullptr; m_flowDiagSolution = nullptr;
} }
if (!m_case) m_timeStep = 0; if ( !m_case )
else if (m_timeStep >= static_cast<int>(m_case->timeStepDates().size())) m_timeStep = 0;
else if ( m_timeStep >= static_cast<int>( m_case->timeStepDates().size() ) )
{ {
m_timeStep = std::max(0, ((int)m_case->timeStepDates().size()) - 1); m_timeStep = std::max( 0, ( (int)m_case->timeStepDates().size() ) - 1 );
} }
std::set<QString> sortedWellNames = findSortedWellNames(); std::set<QString> sortedWellNames = findSortedWellNames();
if (!sortedWellNames.size()) m_wellName = ""; if ( !sortedWellNames.size() )
else if ( sortedWellNames.count(m_wellName()) == 0 ){ m_wellName = *sortedWellNames.begin();} m_wellName = "";
else if ( sortedWellNames.count( m_wellName() ) == 0 )
{
m_wellName = *sortedWellNames.begin();
}
onLoadDataAndUpdate(); onLoadDataAndUpdate();
} }
else if ( changedField == &m_wellName else if ( changedField == &m_wellName || changedField == &m_timeStep || changedField == &m_flowDiagSolution ||
|| changedField == &m_timeStep changedField == &m_groupSmallContributions || changedField == &m_smallContributionsThreshold ||
|| changedField == &m_flowDiagSolution changedField == &m_flowType || changedField == &m_branchDetection )
|| changedField == &m_groupSmallContributions
|| changedField == &m_smallContributionsThreshold
|| changedField == &m_flowType
|| changedField == &m_branchDetection)
{ {
onLoadDataAndUpdate(); onLoadDataAndUpdate();
} }
@ -684,7 +710,7 @@ std::set<QString> RimWellAllocationPlot::findSortedWellNames()
for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx ) for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx )
{ {
sortedWellNames.insert(simWellData[wIdx]->m_wellName); sortedWellNames.insert( simWellData[wIdx]->m_wellName );
} }
} }
@ -694,20 +720,20 @@ std::set<QString> RimWellAllocationPlot::findSortedWellNames()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimWellAllocationPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup("Plot Data"); caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup( "Plot Data" );
dataGroup.add(&m_case); dataGroup.add( &m_case );
dataGroup.add(&m_timeStep); dataGroup.add( &m_timeStep );
dataGroup.add(&m_wellName); dataGroup.add( &m_wellName );
dataGroup.add(&m_branchDetection); dataGroup.add( &m_branchDetection );
caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup("Options"); caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup( "Options" );
optionGroup.add(&m_flowDiagSolution); optionGroup.add( &m_flowDiagSolution );
optionGroup.add(&m_flowType); optionGroup.add( &m_flowType );
optionGroup.add(&m_groupSmallContributions); optionGroup.add( &m_groupSmallContributions );
optionGroup.add(&m_smallContributionsThreshold); optionGroup.add( &m_smallContributionsThreshold );
m_smallContributionsThreshold.uiCapability()->setUiReadOnly(!m_groupSmallContributions()); m_smallContributionsThreshold.uiCapability()->setUiReadOnly( !m_groupSmallContributions() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -726,14 +752,14 @@ void RimWellAllocationPlot::onLoadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::initAfterRead() void RimWellAllocationPlot::initAfterRead()
{ {
if (m_accumulatedWellFlowPlot_OBSOLETE) if ( m_accumulatedWellFlowPlot_OBSOLETE )
{ {
RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>(*this); RimWellLogPlot& wellLogPlot = dynamic_cast<RimWellLogPlot&>( *this );
wellLogPlot = std::move(*m_accumulatedWellFlowPlot_OBSOLETE.value()); wellLogPlot = std::move( *m_accumulatedWellFlowPlot_OBSOLETE.value() );
m_accumulatedWellFlowPlot_OBSOLETE = nullptr; m_accumulatedWellFlowPlot_OBSOLETE = nullptr;
} }
if (m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot()) if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() )
{ {
m_showTitleInPlot = m_showPlotTitle_OBSOLETE(); m_showTitleInPlot = m_showPlotTitle_OBSOLETE();
} }
@ -744,21 +770,20 @@ void RimWellAllocationPlot::initAfterRead()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QWidget* RimWellAllocationPlot::createViewWidget(QWidget* mainWindowParent) QWidget* RimWellAllocationPlot::createViewWidget( QWidget* mainWindowParent )
{ {
m_viewer = new RiuWellAllocationPlot(this, mainWindowParent); m_viewer = new RiuWellAllocationPlot( this, mainWindowParent );
return m_viewer; return m_viewer;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
cvf::Color3f RimWellAllocationPlot::getTracerColor(const QString& tracerName) cvf::Color3f RimWellAllocationPlot::getTracerColor( const QString& tracerName )
{ {
if ( tracerName == RIG_FLOW_OIL_NAME ) return cvf::Color3f::DARK_GREEN;
if (tracerName == RIG_FLOW_OIL_NAME) return cvf::Color3f::DARK_GREEN; if ( tracerName == RIG_FLOW_GAS_NAME ) return cvf::Color3f::DARK_RED;
if (tracerName == RIG_FLOW_GAS_NAME) return cvf::Color3f::DARK_RED; if ( tracerName == RIG_FLOW_WATER_NAME ) return cvf::Color3f::BLUE;
if (tracerName == RIG_FLOW_WATER_NAME) return cvf::Color3f::BLUE;
return cvf::Color3f::DARK_GRAY; return cvf::Color3f::DARK_GRAY;
} }
@ -767,10 +792,10 @@ cvf::Color3f RimWellAllocationPlot::getTracerColor(const QString& tracerName)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellAllocationPlot::updateFormationNamesData() const void RimWellAllocationPlot::updateFormationNamesData() const
{ {
for (size_t i = 0; i < trackCount(); ++i) for ( size_t i = 0; i < trackCount(); ++i )
{ {
RimWellLogTrack* track = trackByIndex(i); RimWellLogTrack* track = trackByIndex( i );
track->setAndUpdateSimWellFormationNamesData(m_case, m_wellName); track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName );
} }
} }
@ -803,6 +828,6 @@ void RimWellAllocationPlot::onDepthTypeChanged()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot* RimWellAllocationPlot::allocationPlotWidget() const RiuWellAllocationPlot* RimWellAllocationPlot::allocationPlotWidget() const
{ {
RiuWellAllocationPlot* plotWidget = dynamic_cast<RiuWellAllocationPlot*>(m_viewer.data()); RiuWellAllocationPlot* plotWidget = dynamic_cast<RiuWellAllocationPlot*>( m_viewer.data() );
return plotWidget; return plotWidget;
} }

View File

@ -38,15 +38,16 @@ class RimWellAllocationPlotLegend;
class RimWellLogTrack; class RimWellLogTrack;
class RiuWellAllocationPlot; class RiuWellAllocationPlot;
namespace cvf { namespace cvf
class Color3f; {
class Color3f;
} }
namespace caf { namespace caf
class PdmOptionItemInfo; {
class PdmOptionItemInfo;
} }
//================================================================================================== //==================================================================================================
/// ///
/// ///
@ -54,77 +55,89 @@ namespace caf {
class RimWellAllocationPlot : public RimWellLogPlot class RimWellAllocationPlot : public RimWellLogPlot
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
enum FlowType { ACCUMULATED, INFLOW}; enum FlowType
{
ACCUMULATED,
INFLOW
};
public: public:
RimWellAllocationPlot(); RimWellAllocationPlot();
~RimWellAllocationPlot() override; ~RimWellAllocationPlot() override;
void setFromSimulationWell(RimSimWellInView* simWell); void setFromSimulationWell( RimSimWellInView* simWell );
RimTotalWellAllocationPlot* totalWellFlowPlot(); RimTotalWellAllocationPlot* totalWellFlowPlot();
RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot(); RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot();
caf::PdmObject* plotLegend(); caf::PdmObject* plotLegend();
RimEclipseResultCase* rimCase(); RimEclipseResultCase* rimCase();
int timeStep(); int timeStep();
QString wellName() const; QString wellName() const;
void removeFromMdiAreaAndDeleteViewWidget(); void removeFromMdiAreaAndDeleteViewWidget();
void showPlotLegend( bool doShow );
void showPlotLegend(bool doShow);
protected: protected:
// Overridden PDM methods // Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue ) override;
std::set<QString> findSortedWellNames(); std::set<QString> findSortedWellNames();
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override; void onLoadDataAndUpdate() override;
void initAfterRead() override; void initAfterRead() override;
private: private:
void updateFromWell(); void updateFromWell();
std::map<QString, const std::vector<double> *> findRelevantTracerCellFractions(const RigSimWellData* simWellData); std::map<QString, const std::vector<double>*> findRelevantTracerCellFractions( const RigSimWellData* simWellData );
void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack); void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack );
void addStackedCurve(const QString& tracerName, void addStackedCurve( const QString& tracerName,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack); RimWellLogTrack* plotTrack );
static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep); static QString wellStatusTextForTimeStep( const QString& wellName,
const RimEclipseResultCase* eclipseResultCase,
size_t timeStep );
QWidget* createViewWidget(QWidget* mainWindowParent) override; QWidget* createViewWidget( QWidget* mainWindowParent ) override;
cvf::Color3f getTracerColor(const QString& tracerName); cvf::Color3f getTracerColor( const QString& tracerName );
void updateFormationNamesData() const; void updateFormationNamesData() const;
std::set<RiaDefines::DepthUnitType> availableDepthUnits() const override; std::set<RiaDefines::DepthUnitType> availableDepthUnits() const override;
std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override; std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override;
void onDepthTypeChanged() override; void onDepthTypeChanged() override;
RiuWellAllocationPlot* allocationPlotWidget() const;
RiuWellAllocationPlot* allocationPlotWidget() const;
private: private:
caf::PdmField<bool> m_branchDetection; caf::PdmField<bool> m_branchDetection;
caf::PdmPtrField<RimEclipseResultCase*> m_case; caf::PdmPtrField<RimEclipseResultCase*> m_case;
caf::PdmField<QString> m_wellName; caf::PdmField<QString> m_wellName;
caf::PdmField<int> m_timeStep; caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution; caf::PdmPtrField<RimFlowDiagSolution*> m_flowDiagSolution;
caf::PdmField<bool> m_groupSmallContributions; caf::PdmField<bool> m_groupSmallContributions;
caf::PdmField<double> m_smallContributionsThreshold; caf::PdmField<double> m_smallContributionsThreshold;
caf::PdmField<caf::AppEnum<FlowType> > m_flowType; caf::PdmField<caf::AppEnum<FlowType>> m_flowType;
caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot; caf::PdmChildField<RimTotalWellAllocationPlot*> m_totalWellAllocationPlot;
caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend; caf::PdmChildField<RimWellAllocationPlotLegend*> m_wellAllocationPlotLegend;
caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot; caf::PdmChildField<RimTofAccumulatedPhaseFractionsPlot*> m_tofAccumulatedPhaseFractionsPlot;
caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot_OBSOLETE; caf::PdmChildField<RimWellLogPlot*> m_accumulatedWellFlowPlot_OBSOLETE;
caf::PdmField<bool> m_showPlotTitle_OBSOLETE; caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -22,18 +22,18 @@
#include "RimWellLogPlot.h" #include "RimWellLogPlot.h"
#include "RimWellPlotTools.h" #include "RimWellPlotTools.h"
#include "cafPdmChildArrayField.h"
#include "cafPdmField.h" #include "cafPdmField.h"
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "cafPdmPtrField.h" #include "cafPdmPtrField.h"
#include "cafPdmChildArrayField.h"
#include "cvfCollection.h" #include "cvfCollection.h"
#include <QPointer>
#include <QDate> #include <QDate>
#include <QMetaType> #include <QMetaType>
#include <QPointer>
#include <set>
#include <map> #include <map>
#include <set>
class RimEclipseCase; class RimEclipseCase;
class RimEclipseResultCase; class RimEclipseResultCase;
@ -45,13 +45,14 @@ class RimWellLogTrack;
class RiaRftPltCurveDefinition; class RiaRftPltCurveDefinition;
class RimDataSourceForRftPlt; class RimDataSourceForRftPlt;
namespace cvf
namespace cvf { {
class Color3f; class Color3f;
} }
namespace caf { namespace caf
class PdmOptionItemInfo; {
class PdmOptionItemInfo;
} }
//================================================================================================== //==================================================================================================
@ -68,64 +69,69 @@ public:
RimWellPltPlot(); RimWellPltPlot();
~RimWellPltPlot() override; ~RimWellPltPlot() override;
void setCurrentWellName(const QString& currWellName); void setCurrentWellName( const QString& currWellName );
static const char* plotNameFormatString();
static const char* plotNameFormatString();
protected: protected:
// Overridden PDM methods // Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options); bool* useOptionsOnly ) override;
void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute( const caf::PdmFieldHandle* field,
void onLoadDataAndUpdate() override; QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void onLoadDataAndUpdate() override;
void initAfterRead() override; void initAfterRead() override;
void setupBeforeSave() override; void setupBeforeSave() override;
void initAfterLoad(); void initAfterLoad();
private: private:
void syncSourcesIoFieldFromGuiField(); void syncSourcesIoFieldFromGuiField();
void syncCurvesFromUiSelection(); void syncCurvesFromUiSelection();
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const; std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
void addStackedCurve(const QString& tracerName, void addStackedCurve( const QString& tracerName,
const std::vector<double>& depthValues, const std::vector<double>& depthValues,
const std::vector<double>& accFlow, const std::vector<double>& accFlow,
RimWellLogTrack* plotTrack, RimWellLogTrack* plotTrack,
cvf::Color3f color, cvf::Color3f color,
int curveGroupId, int curveGroupId,
bool doFillCurve); bool doFillCurve );
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const; std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
// RimViewWindow overrides // RimViewWindow overrides
void setPlotXAxisTitles(RimWellLogTrack* plotTrack); void setPlotXAxisTitles( RimWellLogTrack* plotTrack );
void updateFormationsOnPlot() const; void updateFormationsOnPlot() const;
std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override; std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const override;
private: private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE; caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmField<QString> m_wellPathName; caf::PdmField<QString> m_wellPathName;
caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources; caf::PdmField<std::vector<RifDataSourceForRftPlt>> m_selectedSources;
caf::PdmChildArrayField<RimDataSourceForRftPlt*> m_selectedSourcesForIo; caf::PdmChildArrayField<RimDataSourceForRftPlt*> m_selectedSourcesForIo;
caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps; caf::PdmField<std::vector<QDateTime>> m_selectedTimeSteps;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE; caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
caf::PdmField<bool> m_useStandardConditionCurves; caf::PdmField<bool> m_useStandardConditionCurves;
caf::PdmField<bool> m_useReservoirConditionCurves; caf::PdmField<bool> m_useReservoirConditionCurves;
caf::PdmField<std::vector<caf::AppEnum<FlowPhase>>> m_phases; caf::PdmField<std::vector<caf::AppEnum<FlowPhase>>> m_phases;
bool m_doInitAfterLoad; bool m_doInitAfterLoad;
bool m_isOnLoad; bool m_isOnLoad;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ public:
~RimWellRftPlot() override; ~RimWellRftPlot() override;
const QString& simWellOrWellPathName() const; const QString& simWellOrWellPathName() const;
void setSimWellOrWellPathName(const QString& currWellName); void setSimWellOrWellPathName( const QString& currWellName );
int branchIndex() const; int branchIndex() const;
@ -82,49 +82,52 @@ public:
static const char* plotNameFormatString(); static const char* plotNameFormatString();
void deleteCurvesAssosicatedWithObservedData(const RimObservedFmuRftData* observedFmuRftData); void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData );
protected: protected:
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; const QVariant& oldValue,
const QVariant& newValue ) override;
void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override; bool* useOptionsOnly ) override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override; void onLoadDataAndUpdate() override;
void initAfterRead() override; void initAfterRead() override;
private: private:
void calculateValueOptionsForWells(QList<caf::PdmOptionItemInfo>& options); void calculateValueOptionsForWells( QList<caf::PdmOptionItemInfo>& options );
void updateEditorsFromCurves(); void updateEditorsFromCurves();
void syncCurvesFromUiSelection(); void syncCurvesFromUiSelection();
void assignWellPathToExtractionCurves(); void assignWellPathToExtractionCurves();
RimObservedFmuRftData* findObservedFmuData(const QString& wellPathName, const QDateTime& timeStep) const; RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const;
std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const; std::set<RiaRftPltCurveDefinition> selectedCurveDefs() const;
std::set<RiaRftPltCurveDefinition> curveDefsFromCurves() const; std::set<RiaRftPltCurveDefinition> curveDefsFromCurves() const;
void updateCurvesInPlot(const std::set<RiaRftPltCurveDefinition>& allCurveDefs, void updateCurvesInPlot( const std::set<RiaRftPltCurveDefinition>& allCurveDefs,
const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd, const std::set<RiaRftPltCurveDefinition>& curveDefsToAdd,
const std::set<RimWellLogCurve*>& curvesToDelete); const std::set<RimWellLogCurve*>& curvesToDelete );
std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const; std::vector<RifDataSourceForRftPlt> selectedSourcesExpanded() const;
// RimViewWindow overrides // RimViewWindow overrides
void applyCurveAppearance(RimWellLogCurve* newCurve); void applyCurveAppearance( RimWellLogCurve* newCurve );
void updateFormationsOnPlot() const; void updateFormationsOnPlot() const;
QString associatedSimWellName() const; QString associatedSimWellName() const;
static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress(const RifEclipseRftAddress& address); static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address );
static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress(const RifEclipseRftAddress& address); static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address );
void defineCurveColorsAndSymbols(const std::set<RiaRftPltCurveDefinition>& allCurveDefs); void defineCurveColorsAndSymbols( const std::set<RiaRftPltCurveDefinition>& allCurveDefs );
void onDepthTypeChanged() override; void onDepthTypeChanged() override;
private: private:
caf::PdmField<QString> m_wellPathNameOrSimWellName; caf::PdmField<QString> m_wellPathNameOrSimWellName;
caf::PdmField<int> m_branchIndex; caf::PdmField<int> m_branchIndex;
@ -139,7 +142,7 @@ private:
caf::PdmField<bool> m_showPlotTitle_OBSOLETE; caf::PdmField<bool> m_showPlotTitle_OBSOLETE;
caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE; caf::PdmChildField<RimWellLogPlot*> m_wellLogPlot_OBSOLETE;
std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors; std::map<RifDataSourceForRftPlt, cvf::Color3f> m_dataSourceColors;
std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols; std::map<QDateTime, RiuQwtSymbol::PointSymbolEnum> m_timeStepSymbols;
bool m_isOnLoad; bool m_isOnLoad;
}; };

View File

@ -43,41 +43,40 @@
#include <QDebug> #include <QDebug>
CAF_PDM_SOURCE_INIT(RimGridCrossPlot, "RimGridCrossPlot"); CAF_PDM_SOURCE_INIT( RimGridCrossPlot, "RimGridCrossPlot" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimGridCrossPlot::RimGridCrossPlot() RimGridCrossPlot::RimGridCrossPlot()
{ {
CAF_PDM_InitObject("Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", ""); CAF_PDM_InitObject( "Grid Cross Plot", ":/SummaryXPlotLight16x16.png", "", "" );
CAF_PDM_InitField(&m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", ""); CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" );
CAF_PDM_InitField(&m_showLegend, "ShowLegend", true, "Show Legend", "", "", ""); CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend", "", "", "" );
CAF_PDM_InitField(&m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", ""); CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "" );
m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize()); m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(
RiaApplication::instance()->preferences()->defaultPlotFontSize() );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name Config", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" );
m_nameConfig.uiCapability()->setUiTreeHidden(true); m_nameConfig.uiCapability()->setUiTreeHidden( true );
m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true); m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true );
m_nameConfig = new RimGridCrossPlotNameConfig(); m_nameConfig = new RimGridCrossPlotNameConfig();
CAF_PDM_InitFieldNoDefault(&m_xAxisProperties, "xAxisProperties", "X Axis", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "" );
m_xAxisProperties.uiCapability()->setUiTreeHidden(true); m_xAxisProperties.uiCapability()->setUiTreeHidden( true );
m_xAxisProperties = new RimPlotAxisProperties; m_xAxisProperties = new RimPlotAxisProperties;
m_xAxisProperties->setNameAndAxis("X-Axis", QwtPlot::xBottom); m_xAxisProperties->setNameAndAxis( "X-Axis", QwtPlot::xBottom );
m_xAxisProperties->setEnableTitleTextSettings(false); m_xAxisProperties->setEnableTitleTextSettings( false );
CAF_PDM_InitFieldNoDefault(&m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "" );
m_yAxisProperties.uiCapability()->setUiTreeHidden(true); m_yAxisProperties.uiCapability()->setUiTreeHidden( true );
m_yAxisProperties = new RimPlotAxisProperties; m_yAxisProperties = new RimPlotAxisProperties;
m_yAxisProperties->setNameAndAxis("Y-Axis", QwtPlot::yLeft); m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft );
m_yAxisProperties->setEnableTitleTextSettings(false); m_yAxisProperties->setEnableTitleTextSettings( false );
CAF_PDM_InitFieldNoDefault(&m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "");
m_crossPlotDataSets.uiCapability()->setUiHidden(true);
CAF_PDM_InitFieldNoDefault( &m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", "" );
m_crossPlotDataSets.uiCapability()->setUiHidden( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -95,23 +94,23 @@ RimGridCrossPlot::~RimGridCrossPlot()
RimGridCrossPlotDataSet* RimGridCrossPlot::createDataSet() RimGridCrossPlotDataSet* RimGridCrossPlot::createDataSet()
{ {
RimGridCrossPlotDataSet* dataSet = new RimGridCrossPlotDataSet(); RimGridCrossPlotDataSet* dataSet = new RimGridCrossPlotDataSet();
m_crossPlotDataSets.push_back(dataSet); m_crossPlotDataSets.push_back( dataSet );
return dataSet; return dataSet;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
int RimGridCrossPlot::indexOfDataSet(const RimGridCrossPlotDataSet* dataSetToCheck) const int RimGridCrossPlot::indexOfDataSet( const RimGridCrossPlotDataSet* dataSetToCheck ) const
{ {
int index = 0; int index = 0;
for (auto dataSet : m_crossPlotDataSets()) for ( auto dataSet : m_crossPlotDataSets() )
{ {
if (dataSet == dataSetToCheck) if ( dataSet == dataSetToCheck )
{ {
return index; return index;
} }
if (dataSet->isChecked() && dataSet->visibleCurveCount() > 0u) if ( dataSet->isChecked() && dataSet->visibleCurveCount() > 0u )
{ {
index++; index++;
} }
@ -122,9 +121,9 @@ int RimGridCrossPlot::indexOfDataSet(const RimGridCrossPlotDataSet* dataSetToChe
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::addDataSet(RimGridCrossPlotDataSet* dataSet) void RimGridCrossPlot::addDataSet( RimGridCrossPlotDataSet* dataSet )
{ {
m_crossPlotDataSets.push_back(dataSet); m_crossPlotDataSets.push_back( dataSet );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -150,9 +149,9 @@ QImage RimGridCrossPlot::snapshotWindowContent()
{ {
QImage image; QImage image;
if (m_qwtPlot) if ( m_qwtPlot )
{ {
QPixmap pix = QPixmap::grabWidget(m_qwtPlot); QPixmap pix = QPixmap::grabWidget( m_qwtPlot );
image = pix.toImage(); image = pix.toImage();
} }
@ -164,16 +163,16 @@ QImage RimGridCrossPlot::snapshotWindowContent()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::zoomAll() void RimGridCrossPlot::zoomAll()
{ {
if (!m_qwtPlot) return; if ( !m_qwtPlot ) return;
setAutoZoomForAllAxes(true); setAutoZoomForAllAxes( true );
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT); updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM); updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
m_qwtPlot->replot(); m_qwtPlot->replot();
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT); updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM); updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -181,7 +180,7 @@ void RimGridCrossPlot::zoomAll()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt() void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
{ {
if (m_qwtPlot) if ( m_qwtPlot )
{ {
m_qwtPlot->replot(); m_qwtPlot->replot();
} }
@ -192,14 +191,14 @@ void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::reattachCurvesToQwtAndReplot() void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
{ {
if (m_qwtPlot) if ( m_qwtPlot )
{ {
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->detachAllCurves(); dataSet->detachAllCurves();
if (dataSet->isChecked()) if ( dataSet->isChecked() )
{ {
dataSet->setParentQwtPlotNoReplot(m_qwtPlot); dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
} }
} }
updateAxisDisplay(); updateAxisDisplay();
@ -212,52 +211,52 @@ void RimGridCrossPlot::reattachCurvesToQwtAndReplot()
QString RimGridCrossPlot::createAutoName() const QString RimGridCrossPlot::createAutoName() const
{ {
QStringList autoName; QStringList autoName;
if (!m_nameConfig->customName().isEmpty()) if ( !m_nameConfig->customName().isEmpty() )
{ {
autoName += m_nameConfig->customName(); autoName += m_nameConfig->customName();
} }
if (m_nameConfig->addDataSetNames()) if ( m_nameConfig->addDataSetNames() )
{ {
QStringList dataSetStrings; QStringList dataSetStrings;
std::map<RimGridCrossPlotDataSet::NameComponents, std::set<QString>> allNameComponents; std::map<RimGridCrossPlotDataSet::NameComponents, std::set<QString>> allNameComponents;
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
if (dataSet->isChecked()) if ( dataSet->isChecked() )
{ {
QStringList componentList; QStringList componentList;
auto dataSetNameComponents = dataSet->nameComponents(); auto dataSetNameComponents = dataSet->nameComponents();
for (auto dataSetNameComponent : dataSetNameComponents) for ( auto dataSetNameComponent : dataSetNameComponents )
{ {
if (!dataSetNameComponent.second.isEmpty()) if ( !dataSetNameComponent.second.isEmpty() )
{ {
if (allNameComponents[dataSetNameComponent.first].count(dataSetNameComponent.second) == 0u) if ( allNameComponents[dataSetNameComponent.first].count( dataSetNameComponent.second ) == 0u )
{ {
componentList += dataSetNameComponent.second; componentList += dataSetNameComponent.second;
allNameComponents[dataSetNameComponent.first].insert(dataSetNameComponent.second); allNameComponents[dataSetNameComponent.first].insert( dataSetNameComponent.second );
} }
} }
} }
if (!componentList.isEmpty()) if ( !componentList.isEmpty() )
{ {
dataSetStrings += componentList.join(", "); dataSetStrings += componentList.join( ", " );
} }
} }
} }
dataSetStrings.removeDuplicates(); dataSetStrings.removeDuplicates();
if (dataSetStrings.size() > 2) if ( dataSetStrings.size() > 2 )
{ {
autoName += QString("(%1 Data Sets)").arg(dataSetStrings.size()); autoName += QString( "(%1 Data Sets)" ).arg( dataSetStrings.size() );
} }
if (!dataSetStrings.isEmpty()) if ( !dataSetStrings.isEmpty() )
{ {
autoName += QString("(%1)").arg(dataSetStrings.join("; ")); autoName += QString( "(%1)" ).arg( dataSetStrings.join( "; " ) );
} }
} }
return autoName.join(" "); return autoName.join( " " );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -281,7 +280,7 @@ caf::PdmFieldHandle* RimGridCrossPlot::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::detachAllCurves() void RimGridCrossPlot::detachAllCurves()
{ {
for (auto dataSet : m_crossPlotDataSets()) for ( auto dataSet : m_crossPlotDataSets() )
{ {
dataSet->detachAllCurves(); dataSet->detachAllCurves();
} }
@ -300,13 +299,13 @@ void RimGridCrossPlot::updateAxisScaling()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisDisplay() void RimGridCrossPlot::updateAxisDisplay()
{ {
if (!m_qwtPlot) return; if ( !m_qwtPlot ) return;
updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM); updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM );
updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT); updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT );
m_qwtPlot->updateAnnotationObjects(m_xAxisProperties); m_qwtPlot->updateAnnotationObjects( m_xAxisProperties );
m_qwtPlot->updateAnnotationObjects(m_yAxisProperties); m_qwtPlot->updateAnnotationObjects( m_yAxisProperties );
m_qwtPlot->replot(); m_qwtPlot->replot();
} }
@ -316,48 +315,48 @@ void RimGridCrossPlot::updateAxisDisplay()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateZoomWindowFromQwt() void RimGridCrossPlot::updateZoomWindowFromQwt()
{ {
if (!m_qwtPlot) return; if ( !m_qwtPlot ) return;
updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT); updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT );
updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM); updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM );
setAutoZoomForAllAxes(false); setAutoZoomForAllAxes( false );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::selectAxisInPropertyEditor(int axis) void RimGridCrossPlot::selectAxisInPropertyEditor( int axis )
{ {
RiuPlotMainWindowTools::showPlotMainWindow(); RiuPlotMainWindowTools::showPlotMainWindow();
if (axis == QwtPlot::yLeft) if ( axis == QwtPlot::yLeft )
{ {
RiuPlotMainWindowTools::selectAsCurrentItem(m_yAxisProperties); RiuPlotMainWindowTools::selectAsCurrentItem( m_yAxisProperties );
} }
else if (axis == QwtPlot::xBottom) else if ( axis == QwtPlot::xBottom )
{ {
RiuPlotMainWindowTools::selectAsCurrentItem(m_xAxisProperties); RiuPlotMainWindowTools::selectAsCurrentItem( m_xAxisProperties );
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setAutoZoomForAllAxes(bool enableAutoZoom) void RimGridCrossPlot::setAutoZoomForAllAxes( bool enableAutoZoom )
{ {
m_xAxisProperties->setAutoZoom(enableAutoZoom); m_xAxisProperties->setAutoZoom( enableAutoZoom );
m_yAxisProperties->setAutoZoom(enableAutoZoom); m_yAxisProperties->setAutoZoom( enableAutoZoom );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCurve* qwtCurve) const caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve( const QwtPlotCurve* qwtCurve ) const
{ {
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
for (auto curve : dataSet->curves()) for ( auto curve : dataSet->curves() )
{ {
if (curve->qwtPlotCurve() == qwtCurve) if ( curve->qwtPlotCurve() == qwtCurve )
{ {
return curve; return curve;
} }
@ -369,15 +368,15 @@ caf::PdmObject* RimGridCrossPlot::findRimPlotObjectFromQwtCurve(const QwtPlotCur
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent) QWidget* RimGridCrossPlot::createViewWidget( QWidget* mainWindowParent )
{ {
if (!m_qwtPlot) if ( !m_qwtPlot )
{ {
m_qwtPlot = new RiuGridCrossQwtPlot(this, mainWindowParent); m_qwtPlot = new RiuGridCrossQwtPlot( this, mainWindowParent );
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->setParentQwtPlotNoReplot(m_qwtPlot); dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
} }
m_qwtPlot->replot(); m_qwtPlot->replot();
} }
@ -391,7 +390,7 @@ QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent)
void RimGridCrossPlot::deleteViewWidget() void RimGridCrossPlot::deleteViewWidget()
{ {
detachAllCurves(); detachAllCurves();
if (m_qwtPlot) if ( m_qwtPlot )
{ {
m_qwtPlot->deleteLater(); m_qwtPlot->deleteLater();
m_qwtPlot = nullptr; m_qwtPlot = nullptr;
@ -405,9 +404,9 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
{ {
updateMdiWindowVisibility(); updateMdiWindowVisibility();
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->loadDataAndUpdate(false); dataSet->loadDataAndUpdate( false );
dataSet->updateConnectedEditors(); dataSet->updateConnectedEditors();
} }
@ -418,47 +417,47 @@ void RimGridCrossPlot::onLoadDataAndUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimGridCrossPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add(&m_showInfoBox); uiOrdering.add( &m_showInfoBox );
uiOrdering.add(&m_showLegend); uiOrdering.add( &m_showLegend );
if (m_showLegend()) if ( m_showLegend() )
{ {
uiOrdering.add(&m_legendFontSize); uiOrdering.add( &m_legendFontSize );
} }
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Name Configuration"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" );
m_nameConfig->uiOrdering(uiConfigName, *nameGroup); m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) void RimGridCrossPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/ )
{ {
caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add("Axes", ":/Axes16x16.png"); caf::PdmUiTreeOrdering* axisFolder = uiTreeOrdering.add( "Axes", ":/Axes16x16.png" );
axisFolder->add(&m_xAxisProperties); axisFolder->add( &m_xAxisProperties );
axisFolder->add(&m_yAxisProperties); axisFolder->add( &m_yAxisProperties );
uiTreeOrdering.add(&m_crossPlotDataSets); uiTreeOrdering.add( &m_crossPlotDataSets );
uiTreeOrdering.skipRemainingChildren(true); uiTreeOrdering.skipRemainingChildren( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue )
{ {
if (changedField == &m_legendFontSize) if ( changedField == &m_legendFontSize )
{ {
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->updateLegendIcons(); dataSet->updateLegendIcons();
} }
@ -469,24 +468,24 @@ void RimGridCrossPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField,
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> RimGridCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_legendFontSize) if ( fieldNeedingOptions == &m_legendFontSize )
{ {
std::vector<int> fontSizes; std::vector<int> fontSizes;
fontSizes.push_back(8); fontSizes.push_back( 8 );
fontSizes.push_back(10); fontSizes.push_back( 10 );
fontSizes.push_back(12); fontSizes.push_back( 12 );
fontSizes.push_back(14); fontSizes.push_back( 14 );
fontSizes.push_back(16); fontSizes.push_back( 16 );
for (int value : fontSizes) for ( int value : fontSizes )
{ {
QString text = QString("%1").arg(value); QString text = QString( "%1" ).arg( value );
options.push_back(caf::PdmOptionItemInfo(text, value)); options.push_back( caf::PdmOptionItemInfo( text, value ) );
} }
} }
return options; return options;
@ -505,31 +504,31 @@ void RimGridCrossPlot::performAutoNameUpdate()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updatePlot() void RimGridCrossPlot::updatePlot()
{ {
if (m_qwtPlot) if ( m_qwtPlot )
{ {
RiuQwtPlotTools::setCommonPlotBehaviour(m_qwtPlot); RiuQwtPlotTools::setCommonPlotBehaviour( m_qwtPlot );
RiuQwtPlotTools::setDefaultAxes(m_qwtPlot); RiuQwtPlotTools::setDefaultAxes( m_qwtPlot );
updateAxisDisplay(); updateAxisDisplay();
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->setParentQwtPlotNoReplot(m_qwtPlot); dataSet->setParentQwtPlotNoReplot( m_qwtPlot );
} }
if (m_showLegend()) if ( m_showLegend() )
{ {
// Will be released in plot destructor or when a new legend is set // Will be released in plot destructor or when a new legend is set
QwtLegend* legend = new QwtLegend(m_qwtPlot); QwtLegend* legend = new QwtLegend( m_qwtPlot );
auto font = legend->font(); auto font = legend->font();
font.setPointSize(m_legendFontSize()); font.setPointSize( m_legendFontSize() );
legend->setFont(font); legend->setFont( font );
m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend); m_qwtPlot->insertLegend( legend, QwtPlot::BottomLegend );
} }
else else
{ {
m_qwtPlot->insertLegend(nullptr); m_qwtPlot->insertLegend( nullptr );
} }
m_qwtPlot->updateLegendSizesToMatchPlot(); m_qwtPlot->updateLegendSizesToMatchPlot();
m_qwtPlot->replot(); m_qwtPlot->replot();
@ -541,14 +540,14 @@ void RimGridCrossPlot::updatePlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateCurveNamesAndPlotTitle() void RimGridCrossPlot::updateCurveNamesAndPlotTitle()
{ {
for (size_t i = 0; i < m_crossPlotDataSets.size(); ++i) for ( size_t i = 0; i < m_crossPlotDataSets.size(); ++i )
{ {
m_crossPlotDataSets[i]->updateCurveNames(i, m_crossPlotDataSets.size()); m_crossPlotDataSets[i]->updateCurveNames( i, m_crossPlotDataSets.size() );
} }
if (m_qwtPlot) if ( m_qwtPlot )
{ {
m_qwtPlot->setTitle(this->createAutoName()); m_qwtPlot->setTitle( this->createAutoName() );
} }
updateMdiWindowTitle(); updateMdiWindowTitle();
} }
@ -563,17 +562,17 @@ void RimGridCrossPlot::swapAxes()
QString tmpName = xAxisProperties->name(); QString tmpName = xAxisProperties->name();
QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType(); QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType();
xAxisProperties->setNameAndAxis(yAxisProperties->name(), yAxisProperties->qwtPlotAxisType()); xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->qwtPlotAxisType() );
yAxisProperties->setNameAndAxis(tmpName, tmpAxis); yAxisProperties->setNameAndAxis( tmpName, tmpAxis );
m_xAxisProperties.removeChildObject(xAxisProperties); m_xAxisProperties.removeChildObject( xAxisProperties );
m_yAxisProperties.removeChildObject(yAxisProperties); m_yAxisProperties.removeChildObject( yAxisProperties );
m_yAxisProperties = xAxisProperties; m_yAxisProperties = xAxisProperties;
m_xAxisProperties = yAxisProperties; m_xAxisProperties = yAxisProperties;
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
dataSet->swapAxisProperties(false); dataSet->swapAxisProperties( false );
} }
loadDataAndUpdate(); loadDataAndUpdate();
@ -584,9 +583,9 @@ void RimGridCrossPlot::swapAxes()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiTitleForPlotExport(int dataSetIndex) const QString RimGridCrossPlot::asciiTitleForPlotExport( int dataSetIndex ) const
{ {
if ((size_t)dataSetIndex < m_crossPlotDataSets.size()) if ( (size_t)dataSetIndex < m_crossPlotDataSets.size() )
{ {
return m_crossPlotDataSets[dataSetIndex]->createAutoName(); return m_crossPlotDataSets[dataSetIndex]->createAutoName();
} }
@ -596,20 +595,20 @@ QString RimGridCrossPlot::asciiTitleForPlotExport(int dataSetIndex) const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString RimGridCrossPlot::asciiDataForPlotExport(int dataSetIndex) const QString RimGridCrossPlot::asciiDataForPlotExport( int dataSetIndex ) const
{ {
if ((size_t)dataSetIndex < m_crossPlotDataSets.size()) if ( (size_t)dataSetIndex < m_crossPlotDataSets.size() )
{ {
QString asciiData; QString asciiData;
QTextStream stringStream(&asciiData); QTextStream stringStream( &asciiData );
RifEclipseDataTableFormatter formatter(stringStream); RifEclipseDataTableFormatter formatter( stringStream );
formatter.setCommentPrefix(""); formatter.setCommentPrefix( "" );
formatter.setTableRowPrependText(""); formatter.setTableRowPrependText( "" );
formatter.setTableRowLineAppendText(""); formatter.setTableRowLineAppendText( "" );
formatter.setColumnSpacing(3); formatter.setColumnSpacing( 3 );
m_crossPlotDataSets[dataSetIndex]->exportFormattedData(formatter); m_crossPlotDataSets[dataSetIndex]->exportFormattedData( formatter );
formatter.tableCompleted(); formatter.tableCompleted();
return asciiData; return asciiData;
} }
@ -646,9 +645,9 @@ bool RimGridCrossPlot::isYAxisLogarithmic() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setYAxisInverted(bool inverted) void RimGridCrossPlot::setYAxisInverted( bool inverted )
{ {
m_yAxisProperties->setAxisInverted(inverted); m_yAxisProperties->setAxisInverted( inverted );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -662,19 +661,19 @@ int RimGridCrossPlot::legendFontSize() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const bool RimGridCrossPlot::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const
{ {
if (fontSettingType != RiaDefines::PLOT_FONT) return false; if ( fontSettingType != RiaDefines::PLOT_FONT ) return false;
for (auto plotAxis : allPlotAxes()) for ( auto plotAxis : allPlotAxes() )
{ {
if (plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize) if ( plotAxis->titleFontSize() != defaultFontSize || plotAxis->valuesFontSize() != defaultFontSize )
{ {
return true; return true;
} }
} }
if (legendFontSize() != defaultFontSize) if ( legendFontSize() != defaultFontSize )
{ {
return true; return true;
} }
@ -684,32 +683,35 @@ bool RimGridCrossPlot::hasCustomFontSizes(RiaDefines::FontSettingType fontSettin
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/) bool RimGridCrossPlot::applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange /*= false*/ )
{ {
if (fontSettingType != RiaDefines::PLOT_FONT) return false; if ( fontSettingType != RiaDefines::PLOT_FONT ) return false;
bool anyChange = false; bool anyChange = false;
for (auto plotAxis : allPlotAxes()) for ( auto plotAxis : allPlotAxes() )
{ {
if (forceChange || plotAxis->titleFontSize() == oldFontSize) if ( forceChange || plotAxis->titleFontSize() == oldFontSize )
{ {
plotAxis->setTitleFontSize(fontSize); plotAxis->setTitleFontSize( fontSize );
anyChange = true; anyChange = true;
} }
if (forceChange || plotAxis->valuesFontSize() == oldFontSize) if ( forceChange || plotAxis->valuesFontSize() == oldFontSize )
{ {
plotAxis->setValuesFontSize(fontSize); plotAxis->setValuesFontSize( fontSize );
anyChange = true; anyChange = true;
} }
} }
if (forceChange || legendFontSize() == oldFontSize) if ( forceChange || legendFontSize() == oldFontSize )
{ {
m_legendFontSize = fontSize; m_legendFontSize = fontSize;
anyChange = true; anyChange = true;
} }
if (anyChange) loadDataAndUpdate(); if ( anyChange ) loadDataAndUpdate();
return anyChange; return anyChange;
} }
@ -720,22 +722,22 @@ bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType
QString RimGridCrossPlot::xAxisParameterString() const QString RimGridCrossPlot::xAxisParameterString() const
{ {
QStringList xAxisParams; QStringList xAxisParams;
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
if (dataSet->isChecked() && dataSet->sampleCount() > 0u) if ( dataSet->isChecked() && dataSet->sampleCount() > 0u )
{ {
xAxisParams.push_back(dataSet->xAxisName()); xAxisParams.push_back( dataSet->xAxisName() );
} }
} }
xAxisParams.removeDuplicates(); xAxisParams.removeDuplicates();
if (xAxisParams.size() > 4) if ( xAxisParams.size() > 4 )
{ {
return QString("%1 parameters").arg(xAxisParams.size()); return QString( "%1 parameters" ).arg( xAxisParams.size() );
} }
return xAxisParams.join(", "); return xAxisParams.join( ", " );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -744,35 +746,35 @@ QString RimGridCrossPlot::xAxisParameterString() const
QString RimGridCrossPlot::yAxisParameterString() const QString RimGridCrossPlot::yAxisParameterString() const
{ {
QStringList yAxisParams; QStringList yAxisParams;
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
if (dataSet->isChecked() && dataSet->sampleCount() > 0u) if ( dataSet->isChecked() && dataSet->sampleCount() > 0u )
{ {
yAxisParams.push_back(dataSet->yAxisName()); yAxisParams.push_back( dataSet->yAxisName() );
} }
} }
yAxisParams.removeDuplicates(); yAxisParams.removeDuplicates();
if (yAxisParams.size() > 4) if ( yAxisParams.size() > 4 )
{ {
return QString("%1 parameters").arg(yAxisParams.size()); return QString( "%1 parameters" ).arg( yAxisParams.size() );
} }
return yAxisParams.join(", "); return yAxisParams.join( ", " );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType) void RimGridCrossPlot::updateAxisInQwt( RiaDefines::PlotAxis axisType )
{ {
if (!m_qwtPlot) return; if ( !m_qwtPlot ) return;
RimPlotAxisProperties* axisProperties = m_xAxisProperties(); RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QString axisParameterString = xAxisParameterString(); QString axisParameterString = xAxisParameterString();
if (axisType == RiaDefines::PLOT_AXIS_LEFT) if ( axisType == RiaDefines::PLOT_AXIS_LEFT )
{ {
axisProperties = m_yAxisProperties(); axisProperties = m_yAxisProperties();
axisParameterString = yAxisParameterString(); axisParameterString = yAxisParameterString();
@ -780,110 +782,110 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType)
QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType(); QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType();
if (axisProperties->isActive()) if ( axisProperties->isActive() )
{ {
m_qwtPlot->enableAxis(qwtAxisId, true); m_qwtPlot->enableAxis( qwtAxisId, true );
QwtText axisTitle(axisParameterString); QwtText axisTitle( axisParameterString );
QFont titleFont = m_qwtPlot->axisTitle(qwtAxisId).font(); QFont titleFont = m_qwtPlot->axisTitle( qwtAxisId ).font();
titleFont.setBold(true); titleFont.setBold( true );
titleFont.setPointSize(axisProperties->titleFontSize()); titleFont.setPointSize( axisProperties->titleFontSize() );
axisTitle.setFont(titleFont); axisTitle.setFont( titleFont );
QFont valuesFont = m_qwtPlot->axisFont(qwtAxisId); QFont valuesFont = m_qwtPlot->axisFont( qwtAxisId );
valuesFont.setPointSize(axisProperties->valuesFontSize()); valuesFont.setPointSize( axisProperties->valuesFontSize() );
m_qwtPlot->setAxisFont(qwtAxisId, valuesFont); m_qwtPlot->setAxisFont( qwtAxisId, valuesFont );
switch (axisProperties->titlePosition()) switch ( axisProperties->titlePosition() )
{ {
case RimPlotAxisProperties::AXIS_TITLE_CENTER: case RimPlotAxisProperties::AXIS_TITLE_CENTER:
axisTitle.setRenderFlags(Qt::AlignCenter); axisTitle.setRenderFlags( Qt::AlignCenter );
break; break;
case RimPlotAxisProperties::AXIS_TITLE_END: case RimPlotAxisProperties::AXIS_TITLE_END:
axisTitle.setRenderFlags(Qt::AlignRight); axisTitle.setRenderFlags( Qt::AlignRight );
break; break;
} }
m_qwtPlot->setAxisTitle(qwtAxisId, axisTitle); m_qwtPlot->setAxisTitle( qwtAxisId, axisTitle );
if (axisProperties->isLogarithmicScaleEnabled) if ( axisProperties->isLogarithmicScaleEnabled )
{ {
QwtLogScaleEngine* currentScaleEngine = QwtLogScaleEngine* currentScaleEngine = dynamic_cast<QwtLogScaleEngine*>(
dynamic_cast<QwtLogScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())); m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if (!currentScaleEngine) if ( !currentScaleEngine )
{ {
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine); m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine );
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5); m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 );
} }
if (axisProperties->isAutoZoom()) if ( axisProperties->isAutoZoom() )
{ {
std::vector<const QwtPlotCurve*> plotCurves = visibleQwtCurves(); std::vector<const QwtPlotCurve*> plotCurves = visibleQwtCurves();
double min, max; double min, max;
RimPlotAxisLogRangeCalculator logRangeCalculator(qwtAxisId, plotCurves); RimPlotAxisLogRangeCalculator logRangeCalculator( qwtAxisId, plotCurves );
logRangeCalculator.computeAxisRange(&min, &max); logRangeCalculator.computeAxisRange( &min, &max );
if (axisProperties->isAxisInverted()) if ( axisProperties->isAxisInverted() )
{ {
std::swap(min, max); std::swap( min, max );
} }
m_qwtPlot->setAxisScale(qwtAxisId, min, max); m_qwtPlot->setAxisScale( qwtAxisId, min, max );
} }
else else
{ {
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax); m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
} }
} }
else else
{ {
QwtLinearScaleEngine* currentScaleEngine = QwtLinearScaleEngine* currentScaleEngine = dynamic_cast<QwtLinearScaleEngine*>(
dynamic_cast<QwtLinearScaleEngine*>(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())); m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) );
if (!currentScaleEngine) if ( !currentScaleEngine )
{ {
m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine); m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine );
m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3); m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 );
} }
if (axisProperties->isAutoZoom()) if ( axisProperties->isAutoZoom() )
{ {
m_qwtPlot->setAxisAutoScale(qwtAxisId); m_qwtPlot->setAxisAutoScale( qwtAxisId );
} }
else else
{ {
m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax); m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax );
} }
} }
m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()) m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() )
->setAttribute(QwtScaleEngine::Inverted, axisProperties->isAxisInverted()); ->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() );
} }
else else
{ {
m_qwtPlot->enableAxis(qwtAxisId, false); m_qwtPlot->enableAxis( qwtAxisId, false );
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType) void RimGridCrossPlot::updateAxisFromQwt( RiaDefines::PlotAxis axisType )
{ {
CVF_ASSERT(m_qwtPlot); CVF_ASSERT( m_qwtPlot );
QwtInterval xAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::xBottom); QwtInterval xAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::xBottom );
QwtInterval yAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::yLeft); QwtInterval yAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::yLeft );
RimPlotAxisProperties* axisProperties = m_xAxisProperties(); RimPlotAxisProperties* axisProperties = m_xAxisProperties();
QwtInterval axisRange = xAxisRange; QwtInterval axisRange = xAxisRange;
if (axisType == RiaDefines::PLOT_AXIS_LEFT) if ( axisType == RiaDefines::PLOT_AXIS_LEFT )
{ {
axisProperties = m_yAxisProperties(); axisProperties = m_yAxisProperties();
axisRange = yAxisRange; axisRange = yAxisRange;
} }
axisProperties->visibleRangeMin = std::min(axisRange.minValue(), axisRange.maxValue()); axisProperties->visibleRangeMin = std::min( axisRange.minValue(), axisRange.maxValue() );
axisProperties->visibleRangeMax = std::max(axisRange.minValue(), axisRange.maxValue()); axisProperties->visibleRangeMax = std::max( axisRange.minValue(), axisRange.maxValue() );
axisProperties->updateConnectedEditors(); axisProperties->updateConnectedEditors();
} }
@ -894,15 +896,15 @@ void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType)
std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const std::vector<const QwtPlotCurve*> RimGridCrossPlot::visibleQwtCurves() const
{ {
std::vector<const QwtPlotCurve*> plotCurves; std::vector<const QwtPlotCurve*> plotCurves;
for (auto dataSet : m_crossPlotDataSets) for ( auto dataSet : m_crossPlotDataSets )
{ {
if (dataSet->isChecked()) if ( dataSet->isChecked() )
{ {
for (auto curve : dataSet->curves()) for ( auto curve : dataSet->curves() )
{ {
if (curve->isCurveVisible()) if ( curve->isCurveVisible() )
{ {
plotCurves.push_back(curve->qwtPlotCurve()); plotCurves.push_back( curve->qwtPlotCurve() );
} }
} }
} }
@ -937,7 +939,7 @@ RimGridCrossPlotNameConfig* RimGridCrossPlot::nameConfig()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlot::setShowInfoBox(bool enable) void RimGridCrossPlot::setShowInfoBox( bool enable )
{ {
m_showInfoBox = enable; m_showInfoBox = enable;
} }
@ -947,7 +949,7 @@ void RimGridCrossPlot::setShowInfoBox(bool enable)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
{ {
return { m_xAxisProperties, m_yAxisProperties }; return {m_xAxisProperties, m_yAxisProperties};
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -955,7 +957,7 @@ std::set<RimPlotAxisPropertiesInterface*> RimGridCrossPlot::allPlotAxes() const
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
CAF_PDM_SOURCE_INIT(RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig"); CAF_PDM_SOURCE_INIT( RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -963,18 +965,18 @@ CAF_PDM_SOURCE_INIT(RimGridCrossPlotNameConfig, "RimGridCrossPlotNameConfig");
RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig() RimGridCrossPlotNameConfig::RimGridCrossPlotNameConfig()
: RimNameConfig() : RimNameConfig()
{ {
CAF_PDM_InitObject("Cross Plot Name Generator", "", "", ""); CAF_PDM_InitObject( "Cross Plot Name Generator", "", "", "" );
CAF_PDM_InitField(&addDataSetNames, "AddDataSetNames", true, "Add Data Set Names", "", "", ""); CAF_PDM_InitField( &addDataSetNames, "AddDataSetNames", true, "Add Data Set Names", "", "", "" );
setCustomName("Cross Plot"); setCustomName( "Cross Plot" );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimGridCrossPlotNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimGridCrossPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering); RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add(&addDataSetNames); uiOrdering.add( &addDataSetNames );
} }

View File

@ -22,8 +22,8 @@
#include "cafPdmObject.h" #include "cafPdmObject.h"
#include "RiaDefines.h" #include "RiaDefines.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimNameConfig.h" #include "RimNameConfig.h"
#include "RimRiuQwtPlotOwnerInterface.h"
#include "RimViewWindow.h" #include "RimViewWindow.h"
#include <QPointer> #include <QPointer>
@ -38,14 +38,15 @@ class RiuGridCrossQwtPlot;
class RimGridCrossPlotNameConfig : public RimNameConfig class RimGridCrossPlotNameConfig : public RimNameConfig
{ {
CAF_PDM_HEADER_INIT; CAF_PDM_HEADER_INIT;
public: public:
RimGridCrossPlotNameConfig(); RimGridCrossPlotNameConfig();
public: public:
caf::PdmField<bool> addDataSetNames; caf::PdmField<bool> addDataSetNames;
protected: protected:
virtual void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; virtual void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
}; };
class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface class RimGridCrossPlot : public RimViewWindow, public RimRiuQwtPlotOwnerInterface, public RimNameConfigHolderInterface
@ -57,8 +58,8 @@ public:
~RimGridCrossPlot(); ~RimGridCrossPlot();
RimGridCrossPlotDataSet* createDataSet(); RimGridCrossPlotDataSet* createDataSet();
int indexOfDataSet(const RimGridCrossPlotDataSet* dataSet) const; int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const;
void addDataSet(RimGridCrossPlotDataSet* dataSet); void addDataSet( RimGridCrossPlotDataSet* dataSet );
std::vector<RimGridCrossPlotDataSet*> dataSets() const; std::vector<RimGridCrossPlotDataSet*> dataSets() const;
@ -75,67 +76,69 @@ public:
void performAutoNameUpdate() override; void performAutoNameUpdate() override;
void updateCurveNamesAndPlotTitle(); void updateCurveNamesAndPlotTitle();
void swapAxes(); void swapAxes();
QString asciiTitleForPlotExport(int dataSetIndex) const; QString asciiTitleForPlotExport( int dataSetIndex ) const;
QString asciiDataForPlotExport(int dataSetIndex) const; QString asciiDataForPlotExport( int dataSetIndex ) const;
RiuGridCrossQwtPlot* qwtPlot() const; RiuGridCrossQwtPlot* qwtPlot() const;
bool isXAxisLogarithmic() const; bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const; bool isYAxisLogarithmic() const;
void setYAxisInverted(bool inverted); void setYAxisInverted( bool inverted );
int legendFontSize() const; int legendFontSize() const;
bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override; bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override;
bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override; bool applyFontSize( RiaDefines::FontSettingType fontSettingType,
int oldFontSize,
int fontSize,
bool forceChange = false ) override;
public: public:
// Rim2dPlotInterface overrides // Rim2dPlotInterface overrides
void updateAxisScaling() override; void updateAxisScaling() override;
void updateAxisDisplay() override; void updateAxisDisplay() override;
void updateZoomWindowFromQwt() override; void updateZoomWindowFromQwt() override;
void selectAxisInPropertyEditor(int axis) override; void selectAxisInPropertyEditor( int axis ) override;
void setAutoZoomForAllAxes(bool enableAutoZoom) override; void setAutoZoomForAllAxes( bool enableAutoZoom ) override;
caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const override; caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override;
protected: protected:
QWidget* createViewWidget(QWidget* mainWindowParent) override; QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override; void deleteViewWidget() override;
void onLoadDataAndUpdate() override; void onLoadDataAndUpdate() override;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, const QVariant& oldValue,
bool* useOptionsOnly) override; const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void updatePlot(); void updatePlot();
virtual QString xAxisParameterString() const; virtual QString xAxisParameterString() const;
QString yAxisParameterString() const; QString yAxisParameterString() const;
void updateAxisInQwt(RiaDefines::PlotAxis axisType); void updateAxisInQwt( RiaDefines::PlotAxis axisType );
void updateAxisFromQwt(RiaDefines::PlotAxis axisType); void updateAxisFromQwt( RiaDefines::PlotAxis axisType );
std::vector<const QwtPlotCurve*> visibleQwtCurves() const; std::vector<const QwtPlotCurve*> visibleQwtCurves() const;
RimPlotAxisProperties* xAxisProperties(); RimPlotAxisProperties* xAxisProperties();
RimPlotAxisProperties* yAxisProperties(); RimPlotAxisProperties* yAxisProperties();
RimGridCrossPlotNameConfig* nameConfig(); RimGridCrossPlotNameConfig* nameConfig();
void setShowInfoBox(bool enable); void setShowInfoBox( bool enable );
std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const; std::set<RimPlotAxisPropertiesInterface*> allPlotAxes() const;
private: private:
caf::PdmField<bool> m_showInfoBox; caf::PdmField<bool> m_showInfoBox;
caf::PdmField<bool> m_showLegend; caf::PdmField<bool> m_showLegend;
caf::PdmField<int> m_legendFontSize; caf::PdmField<int> m_legendFontSize;
caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig; caf::PdmChildField<RimGridCrossPlotNameConfig*> m_nameConfig;
caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties; caf::PdmChildField<RimPlotAxisProperties*> m_yAxisProperties;
caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties; caf::PdmChildField<RimPlotAxisProperties*> m_xAxisProperties;
caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets; caf::PdmChildArrayField<RimGridCrossPlotDataSet*> m_crossPlotDataSets;
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
QPointer<RiuGridCrossQwtPlot> m_qwtPlot;
}; };

View File

@ -17,8 +17,8 @@
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#pragma once #pragma once
#include "RigGridCrossPlotCurveGrouping.h"
#include "RigEclipseCrossPlotDataExtractor.h" #include "RigEclipseCrossPlotDataExtractor.h"
#include "RigGridCrossPlotCurveGrouping.h"
#include "RimCheckableNamedObject.h" #include "RimCheckableNamedObject.h"
#include "RimNameConfig.h" #include "RimNameConfig.h"
@ -66,7 +66,7 @@ public:
caf::PdmField<bool> addGrouping; caf::PdmField<bool> addGrouping;
protected: protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
}; };
//================================================================================================== //==================================================================================================
@ -92,9 +92,9 @@ public:
RimGridCrossPlotDataSet(); RimGridCrossPlotDataSet();
~RimGridCrossPlotDataSet() = default; ~RimGridCrossPlotDataSet() = default;
void setCellFilterView(RimGridView* cellFilterView); void setCellFilterView( RimGridView* cellFilterView );
void loadDataAndUpdate(bool updateParentPlot); void loadDataAndUpdate( bool updateParentPlot );
void setParentQwtPlotNoReplot(QwtPlot* parent); void setParentQwtPlotNoReplot( QwtPlot* parent );
QString xAxisName() const; QString xAxisName() const;
QString yAxisName() const; QString yAxisName() const;
QString infoText() const; QString infoText() const;
@ -108,28 +108,28 @@ public:
RimRegularLegendConfig* legendConfig() const; RimRegularLegendConfig* legendConfig() const;
std::vector< RimGridCrossPlotCurve*> curves() const; std::vector<RimGridCrossPlotCurve*> curves() const;
QString caseNameString() const; QString caseNameString() const;
QString axisVariableString() const; QString axisVariableString() const;
QString timeStepString() const; QString timeStepString() const;
std::map<NameComponents, QString> nameComponents() const; std::map<NameComponents, QString> nameComponents() const;
void updateCurveNames(size_t dataSetIndex, size_t dataSetCount); void updateCurveNames( size_t dataSetIndex, size_t dataSetCount );
void updateLegendRange(); void updateLegendRange();
void updateLegendIcons(); void updateLegendIcons();
bool groupingByCategoryResult() const; bool groupingByCategoryResult() const;
bool groupingEnabled() const; bool groupingEnabled() const;
void swapAxisProperties(bool updatePlot); void swapAxisProperties( bool updatePlot );
void exportFormattedData(RifEclipseDataTableFormatter& formatter) const; void exportFormattedData( RifEclipseDataTableFormatter& formatter ) const;
bool isXAxisLogarithmic() const; bool isXAxisLogarithmic() const;
bool isYAxisLogarithmic() const; bool isYAxisLogarithmic() const;
void configureForPressureSaturationCurves(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName); void configureForPressureSaturationCurves( RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName );
void addCellFilter(RimPlotCellFilter* cellFilter); void addCellFilter( RimPlotCellFilter* cellFilter );
void setCustomColor(const cvf::Color3f color); void setCustomColor( const cvf::Color3f color );
void destroyCurves(); void destroyCurves();
size_t visibleCurveCount() const; size_t visibleCurveCount() const;
@ -137,34 +137,37 @@ public:
protected: protected:
void initAfterRead() override; void initAfterRead() override;
void onLoadDataAndUpdate(bool updateParentPlot); void onLoadDataAndUpdate( bool updateParentPlot );
void assignCurveDataGroups(const RigEclipseCrossPlotResult& result); void assignCurveDataGroups( const RigEclipseCrossPlotResult& result );
void createCurves(const RigEclipseCrossPlotResult& result); void createCurves( const RigEclipseCrossPlotResult& result );
void fillCurveDataInExistingCurves(const RigEclipseCrossPlotResult& result); void fillCurveDataInExistingCurves( const RigEclipseCrossPlotResult& result );
QString createGroupName(size_t curveIndex) const; QString createGroupName( size_t curveIndex ) const;
std::map<int, cvf::UByteArray> calculateCellVisibility(RimEclipseCase* eclipseCase) const; std::map<int, cvf::UByteArray> calculateCellVisibility( RimEclipseCase* eclipseCase ) const;
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void childFieldChangedByUi(const caf::PdmFieldHandle* changedChildField) override; const QVariant& oldValue,
const QVariant& newValue ) override;
void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly) override; bool* useOptionsOnly ) override;
void triggerPlotNameUpdateAndReplot(); void triggerPlotNameUpdateAndReplot();
void updateDataSetName(); void updateDataSetName();
void performAutoNameUpdate() override; void performAutoNameUpdate() override;
void setDefaults(); void setDefaults();
void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; void defineEditorAttribute( const caf::PdmFieldHandle* field,
QString uiConfigName,
caf::PdmUiEditorAttribute* attribute ) override;
void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override;
bool hasMultipleTimeSteps() const; bool hasMultipleTimeSteps() const;
void filterInvalidCurveValues(RigEclipseCrossPlotResult* result); void filterInvalidCurveValues( RigEclipseCrossPlotResult* result );
private: private:
caf::PdmPtrField<RimCase*> m_case; caf::PdmPtrField<RimCase*> m_case;
caf::PdmField<int> m_timeStep; caf::PdmField<int> m_timeStep;
caf::PdmPtrField<RimGridView*> m_cellFilterView; caf::PdmPtrField<RimGridView*> m_cellFilterView;
@ -177,10 +180,10 @@ private:
caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves; caf::PdmChildArrayField<RimGridCrossPlotCurve*> m_crossPlotCurves;
std::map<int, RigEclipseCrossPlotResult> m_groupedResults; std::map<int, RigEclipseCrossPlotResult> m_groupedResults;
caf::PdmField<bool> m_useCustomColor;
caf::PdmField<cvf::Color3f> m_customColor;
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;;
caf::PdmField<bool> m_useCustomColor;
caf::PdmField<cvf::Color3f> m_customColor;
caf::PdmChildField<RimPlotCellFilterCollection*> m_plotCellFilterCollection;
;
}; };

File diff suppressed because it is too large Load Diff

View File

@ -20,20 +20,17 @@
#include "RigWellLogFile.h" #include "RigWellLogFile.h"
#include "RiaExtractionTools.h"
#include "RiaCurveDataTools.h" #include "RiaCurveDataTools.h"
#include "RiaExtractionTools.h"
#include "RigCaseCellResultsData.h"
#include "RigEclipseCaseData.h" #include "RigEclipseCaseData.h"
#include "RigGeoMechCaseData.h"
#include "RigEclipseWellLogExtractor.h" #include "RigEclipseWellLogExtractor.h"
#include "RigFemPartResultsCollection.h"
#include "RigGeoMechCaseData.h"
#include "RigGeoMechWellLogExtractor.h" #include "RigGeoMechWellLogExtractor.h"
#include "RigResultAccessorFactory.h" #include "RigResultAccessorFactory.h"
#include "RigCaseCellResultsData.h"
#include "RigFemPartResultsCollection.h"
#include "RigWellPath.h" #include "RigWellPath.h"
#include "RimEclipseCase.h"
#include "RimGeoMechCase.h"
#include "Rim3dView.h" #include "Rim3dView.h"
#include "RimWellLogExtractionCurveNameConfig.h"
#include "RimCase.h" #include "RimCase.h"
#include "RimEclipseCase.h" #include "RimEclipseCase.h"
#include "RimEclipseCellColors.h" #include "RimEclipseCellColors.h"
@ -43,9 +40,10 @@
#include "RimGeoMechResultDefinition.h" #include "RimGeoMechResultDefinition.h"
#include "RimGeoMechView.h" #include "RimGeoMechView.h"
#include "RimTools.h" #include "RimTools.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellLogExtractionCurveNameConfig.h"
#include "RimWellLogFile.h" #include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h" #include "RimWellLogFileChannel.h"
#include "RimWellLogExtractionCurve.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include "cafUtils.h" #include "cafUtils.h"
@ -59,34 +57,34 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve"); CAF_PDM_SOURCE_INIT( Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve() Rim3dWellLogExtractionCurve::Rim3dWellLogExtractionCurve()
{ {
CAF_PDM_InitObject("3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", ""); CAF_PDM_InitObject( "3d Well Log Extraction Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" );
m_case.uiCapability()->setUiTreeChildrenHidden(true); m_case.uiCapability()->setUiTreeChildrenHidden( true );
m_case = nullptr; m_case = nullptr;
CAF_PDM_InitField(&m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", ""); CAF_PDM_InitField( &m_timeStep, "CurveTimeStep", -1, "Time Step", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" );
m_eclipseResultDefinition.uiCapability()->setUiHidden(true); m_eclipseResultDefinition.uiCapability()->setUiHidden( true );
m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_eclipseResultDefinition = new RimEclipseResultDefinition; m_eclipseResultDefinition = new RimEclipseResultDefinition;
m_eclipseResultDefinition->findField("MResultType")->uiCapability()->setUiName("Result Type"); m_eclipseResultDefinition->findField( "MResultType" )->uiCapability()->setUiName( "Result Type" );
CAF_PDM_InitFieldNoDefault(&m_geomResultDefinition, "CurveGeomechResult", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" );
m_geomResultDefinition.uiCapability()->setUiHidden(true); m_geomResultDefinition.uiCapability()->setUiHidden( true );
m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true );
m_geomResultDefinition = new RimGeoMechResultDefinition; m_geomResultDefinition = new RimGeoMechResultDefinition;
m_geomResultDefinition->setAddWellPathDerivedResults(true); m_geomResultDefinition->setAddWellPathDerivedResults( true );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogExtractionCurveNameConfig(); m_nameConfig = new RimWellLogExtractionCurveNameConfig();
} }
@ -103,27 +101,27 @@ Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view) void Rim3dWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view )
{ {
if (!view) return; if ( !view ) return;
m_case = view->ownerCase(); m_case = view->ownerCase();
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase(eclipseCase); m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase(geomCase); m_geomResultDefinition->setGeoMechCase( geomCase );
RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>(view); RimEclipseView* eclipseView = dynamic_cast<RimEclipseView*>( view );
if (eclipseView) if ( eclipseView )
{ {
m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult()); m_eclipseResultDefinition->simpleCopy( eclipseView->cellResult() );
} }
RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>(view); RimGeoMechView* geoMechView = dynamic_cast<RimGeoMechView*>( view );
if (geoMechView) if ( geoMechView )
{ {
m_geomResultDefinition->setResultAddress(geoMechView->cellResultResultDefinition()->resultAddress()); m_geomResultDefinition->setResultAddress( geoMechView->cellResultResultDefinition()->resultAddress() );
} }
} }
@ -132,18 +130,18 @@ void Rim3dWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::resultPropertyString() const QString Rim3dWellLogExtractionCurve::resultPropertyString() const
{ {
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QString name; QString name;
if (eclipseCase) if ( eclipseCase )
{ {
name = caf::Utils::makeValidFileBasename(m_eclipseResultDefinition->resultVariableUiShortName()); name = caf::Utils::makeValidFileBasename( m_eclipseResultDefinition->resultVariableUiShortName() );
} }
else if (geoMechCase) else if ( geoMechCase )
{ {
QString resCompName = m_geomResultDefinition->resultComponentUiName(); QString resCompName = m_geomResultDefinition->resultComponentUiName();
if (resCompName.isEmpty()) if ( resCompName.isEmpty() )
{ {
name = m_geomResultDefinition->resultFieldUiName(); name = m_geomResultDefinition->resultFieldUiName();
} }
@ -167,66 +165,70 @@ bool Rim3dWellLogExtractionCurve::followAnimationTimeStep() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const void Rim3dWellLogExtractionCurve::curveValuesAndMds( std::vector<double>* values,
std::vector<double>* measuredDepthValues ) const
{ {
CVF_ASSERT(m_timeStep() >= 0); CVF_ASSERT( m_timeStep() >= 0 );
return this->curveValuesAndMdsAtTimeStep(values, measuredDepthValues, m_timeStep()); return this->curveValuesAndMdsAtTimeStep( values, measuredDepthValues, m_timeStep() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep(std::vector<double>* values, std::vector<double>* measuredDepthValues, int timeStep) const void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector<double>* values,
std::vector<double>* measuredDepthValues,
int timeStep ) const
{ {
CAF_ASSERT(values != nullptr); CAF_ASSERT( values != nullptr );
CAF_ASSERT(measuredDepthValues != nullptr); CAF_ASSERT( measuredDepthValues != nullptr );
cvf::ref<RigEclipseWellLogExtractor> eclExtractor; cvf::ref<RigEclipseWellLogExtractor> eclExtractor;
cvf::ref<RigGeoMechWellLogExtractor> geomExtractor; cvf::ref<RigGeoMechWellLogExtractor> geomExtractor;
RimWellPath* wellPath; RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType( wellPath );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
if (eclipseCase) if ( eclipseCase )
{ {
eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase(wellPath, eclipseCase); eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase( wellPath, eclipseCase );
} }
else else
{ {
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if (geomCase) if ( geomCase )
{ {
geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase(wellPath, geomCase); geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, geomCase );
} }
} }
if (eclExtractor.notNull() && eclipseCase) if ( eclExtractor.notNull() && eclipseCase )
{ {
*measuredDepthValues = eclExtractor->cellIntersectionMDs(); *measuredDepthValues = eclExtractor->cellIntersectionMDs();
m_eclipseResultDefinition->loadResult(); m_eclipseResultDefinition->loadResult();
cvf::ref<RigResultAccessor> resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(), cvf::ref<RigResultAccessor> resAcc =
0, RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(),
timeStep, 0,
m_eclipseResultDefinition); timeStep,
if (resAcc.notNull()) m_eclipseResultDefinition );
if ( resAcc.notNull() )
{ {
eclExtractor->curveData(resAcc.p(), values); eclExtractor->curveData( resAcc.p(), values );
} }
} }
else if (geomExtractor.notNull()) else if ( geomExtractor.notNull() )
{ {
*measuredDepthValues = geomExtractor->cellIntersectionMDs(); *measuredDepthValues = geomExtractor->cellIntersectionMDs();
RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles(wellPath, geomExtractor.p()); RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geomExtractor.p() );
m_geomResultDefinition->loadResult(); m_geomResultDefinition->loadResult();
geomExtractor->setRkbDiff(rkbDiff()); geomExtractor->setRkbDiff( rkbDiff() );
geomExtractor->curveData(m_geomResultDefinition->resultAddress(), timeStep, values); geomExtractor->curveData( m_geomResultDefinition->resultAddress(), timeStep, values );
} }
} }
@ -237,39 +239,39 @@ std::pair<double, double> Rim3dWellLogExtractionCurve::findCurveValueRange()
{ {
double foundMinValue = std::numeric_limits<float>::infinity(); double foundMinValue = std::numeric_limits<float>::infinity();
double foundMaxValue = -std::numeric_limits<float>::infinity(); double foundMaxValue = -std::numeric_limits<float>::infinity();
if (m_case()) if ( m_case() )
{ {
std::set<int> timeStepsToCheck; std::set<int> timeStepsToCheck;
if (followAnimationTimeStep()) if ( followAnimationTimeStep() )
{ {
// Check all time steps to avoid range changing during animation. // Check all time steps to avoid range changing during animation.
for (int i = 0; i < m_case->timeStepStrings().size(); ++i) for ( int i = 0; i < m_case->timeStepStrings().size(); ++i )
{ {
timeStepsToCheck.insert(i); timeStepsToCheck.insert( i );
} }
} }
else else
{ {
timeStepsToCheck.insert(m_timeStep()); timeStepsToCheck.insert( m_timeStep() );
} }
for (int timeStep : timeStepsToCheck) for ( int timeStep : timeStepsToCheck )
{ {
std::vector<double> values; std::vector<double> values;
std::vector<double> measuredDepths; std::vector<double> measuredDepths;
this->curveValuesAndMdsAtTimeStep(&values, &measuredDepths, timeStep); this->curveValuesAndMdsAtTimeStep( &values, &measuredDepths, timeStep );
for (double value : values) for ( double value : values )
{ {
if (RiaCurveDataTools::isValidValue(value, false)) if ( RiaCurveDataTools::isValidValue( value, false ) )
{ {
foundMinValue = std::min(foundMinValue, value); foundMinValue = std::min( foundMinValue, value );
foundMaxValue = std::max(foundMaxValue, value); foundMaxValue = std::max( foundMaxValue, value );
} }
} }
} }
} }
return std::make_pair(foundMinValue, foundMaxValue); return std::make_pair( foundMinValue, foundMaxValue );
} }
QString Rim3dWellLogExtractionCurve::name() const QString Rim3dWellLogExtractionCurve::name() const
@ -282,80 +284,80 @@ QString Rim3dWellLogExtractionCurve::name() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::createAutoName() const QString Rim3dWellLogExtractionCurve::createAutoName() const
{ {
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList autoName; QStringList autoName;
if (!m_nameConfig->customName().isEmpty()) if ( !m_nameConfig->customName().isEmpty() )
{ {
autoName.push_back(m_nameConfig->customName()); autoName.push_back( m_nameConfig->customName() );
} }
QStringList generatedAutoTags; QStringList generatedAutoTags;
if (m_nameConfig->addWellName()) if ( m_nameConfig->addWellName() )
{ {
RimWellPath* wellPath; RimWellPath* wellPath;
this->firstAncestorOrThisOfTypeAsserted(wellPath); this->firstAncestorOrThisOfTypeAsserted( wellPath );
if (!wellPath->name().isEmpty()) if ( !wellPath->name().isEmpty() )
{ {
generatedAutoTags += wellPath->name(); generatedAutoTags += wellPath->name();
} }
} }
if (m_nameConfig->addCaseName() && m_case()) if ( m_nameConfig->addCaseName() && m_case() )
{ {
generatedAutoTags.push_back(m_case->caseUserDescription()); generatedAutoTags.push_back( m_case->caseUserDescription() );
} }
if (m_nameConfig->addProperty() && !resultPropertyString().isEmpty()) if ( m_nameConfig->addProperty() && !resultPropertyString().isEmpty() )
{ {
generatedAutoTags.push_back(resultPropertyString()); generatedAutoTags.push_back( resultPropertyString() );
} }
if (m_nameConfig->addTimeStep() || m_nameConfig->addDate()) if ( m_nameConfig->addTimeStep() || m_nameConfig->addDate() )
{ {
bool addTimeStep = m_nameConfig->addTimeStep() && m_timeStep() != -1; bool addTimeStep = m_nameConfig->addTimeStep() && m_timeStep() != -1;
size_t maxTimeStep = 0; size_t maxTimeStep = 0;
if (eclipseCase) if ( eclipseCase )
{ {
addTimeStep = addTimeStep && m_eclipseResultDefinition->resultType() != RiaDefines::STATIC_NATIVE; addTimeStep = addTimeStep && m_eclipseResultDefinition->resultType() != RiaDefines::STATIC_NATIVE;
RigEclipseCaseData* data = eclipseCase->eclipseCaseData(); RigEclipseCaseData* data = eclipseCase->eclipseCaseData();
if (data) if ( data )
{ {
maxTimeStep = data->results(m_eclipseResultDefinition->porosityModel())->maxTimeStepCount(); maxTimeStep = data->results( m_eclipseResultDefinition->porosityModel() )->maxTimeStepCount();
} }
} }
else if (geomCase) else if ( geomCase )
{ {
RigGeoMechCaseData* data = geomCase->geoMechData(); RigGeoMechCaseData* data = geomCase->geoMechData();
if (data) if ( data )
{ {
maxTimeStep = data->femPartResults()->frameCount(); maxTimeStep = data->femPartResults()->frameCount();
} }
} }
if (m_nameConfig->addDate()) if ( m_nameConfig->addDate() )
{ {
QString dateString = wellDate(); QString dateString = wellDate();
if (!dateString.isEmpty()) if ( !dateString.isEmpty() )
{ {
generatedAutoTags.push_back(dateString); generatedAutoTags.push_back( dateString );
} }
} }
if (addTimeStep) if ( addTimeStep )
{ {
generatedAutoTags.push_back(QString("[%1/%2]").arg(m_timeStep() + 1).arg(maxTimeStep)); generatedAutoTags.push_back( QString( "[%1/%2]" ).arg( m_timeStep() + 1 ).arg( maxTimeStep ) );
} }
} }
if (!generatedAutoTags.empty()) if ( !generatedAutoTags.empty() )
{ {
autoName.push_back(generatedAutoTags.join(", ")); autoName.push_back( generatedAutoTags.join( ", " ) );
} }
return autoName.join(": "); return autoName.join( ": " );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -364,9 +366,9 @@ QString Rim3dWellLogExtractionCurve::createAutoName() const
double Rim3dWellLogExtractionCurve::rkbDiff() const double Rim3dWellLogExtractionCurve::rkbDiff() const
{ {
RimWellPath* wellPath; RimWellPath* wellPath;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType( wellPath );
if (wellPath && wellPath->wellPathGeometry()) if ( wellPath && wellPath->wellPathGeometry() )
{ {
return wellPath->wellPathGeometry()->rkbDiff(); return wellPath->wellPathGeometry()->rkbDiff();
} }
@ -374,17 +376,16 @@ double Rim3dWellLogExtractionCurve::rkbDiff() const
return HUGE_VAL; return HUGE_VAL;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const
{ {
if (dynamic_cast<const RimEclipseCase*>(m_case())) if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{ {
return m_eclipseResultDefinition->hasDynamicResult(); return m_eclipseResultDefinition->hasDynamicResult();
} }
else if (dynamic_cast<const RimGeoMechCase*>(m_case())) else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{ {
return m_geomResultDefinition->hasResult(); return m_geomResultDefinition->hasResult();
} }
@ -394,17 +395,17 @@ bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool Rim3dWellLogExtractionCurve::showInView(const Rim3dView* gridView) const bool Rim3dWellLogExtractionCurve::showInView( const Rim3dView* gridView ) const
{ {
if (isShowingCurve()) if ( isShowingCurve() )
{ {
if (dynamic_cast<const RimEclipseCase*>(m_case())) if ( dynamic_cast<const RimEclipseCase*>( m_case() ) )
{ {
return dynamic_cast<const RimEclipseView*>(gridView) != nullptr; return dynamic_cast<const RimEclipseView*>( gridView ) != nullptr;
} }
else if (dynamic_cast<const RimGeoMechCase*>(m_case())) else if ( dynamic_cast<const RimGeoMechCase*>( m_case() ) )
{ {
return dynamic_cast<const RimGeoMechView*>(gridView) != nullptr; return dynamic_cast<const RimGeoMechView*>( gridView ) != nullptr;
} }
} }
return false; return false;
@ -421,58 +422,61 @@ caf::PdmFieldHandle* Rim3dWellLogExtractionCurve::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void Rim3dWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{ {
if (changedField == &m_case) if ( changedField == &m_case )
{ {
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case() );
RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>(m_case()); RimGeoMechCase* geoMechCase = dynamic_cast<RimGeoMechCase*>( m_case() );
if (eclipseCase) if ( eclipseCase )
{ {
m_eclipseResultDefinition->setEclipseCase(eclipseCase); m_eclipseResultDefinition->setEclipseCase( eclipseCase );
} }
else if (geoMechCase) else if ( geoMechCase )
{ {
m_geomResultDefinition->setGeoMechCase(geoMechCase); m_geomResultDefinition->setGeoMechCase( geoMechCase );
} }
this->resetMinMaxValuesAndUpdateUI(); this->resetMinMaxValuesAndUpdateUI();
} }
else if (changedField == &m_timeStep) else if ( changedField == &m_timeStep )
{ {
this->resetMinMaxValuesAndUpdateUI(); this->resetMinMaxValuesAndUpdateUI();
} }
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo>
bool* useOptionsOnly) Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if (fieldNeedingOptions == &m_case) if ( fieldNeedingOptions == &m_case )
{ {
RimTools::caseOptionItems(&options); RimTools::caseOptionItems( &options );
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if (fieldNeedingOptions == &m_timeStep) else if ( fieldNeedingOptions == &m_timeStep )
{ {
QStringList timeStepNames; QStringList timeStepNames;
if (m_case) if ( m_case )
{ {
timeStepNames = m_case->timeStepStrings(); timeStepNames = m_case->timeStepStrings();
} }
options.push_back(caf::PdmOptionItemInfo(QString("Follow Animation Time Step"), -1)); options.push_back( caf::PdmOptionItemInfo( QString( "Follow Animation Time Step" ), -1 ) );
for (int i = 0; i < timeStepNames.size(); i++) for ( int i = 0; i < timeStepNames.size(); i++ )
{ {
options.push_back(caf::PdmOptionItemInfo(timeStepNames[i], i)); options.push_back( caf::PdmOptionItemInfo( timeStepNames[i], i ) );
} }
} }
@ -482,36 +486,35 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogExtractionCurve::calculateValueOptions
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void Rim3dWellLogExtractionCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add(&m_case); curveDataGroup->add( &m_case );
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
if (eclipseCase) if ( eclipseCase )
{ {
m_eclipseResultDefinition->uiOrdering(uiConfigName, *curveDataGroup); m_eclipseResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
} }
else if (geomCase) else if ( geomCase )
{ {
m_geomResultDefinition->uiOrdering(uiConfigName, *curveDataGroup); m_geomResultDefinition->uiOrdering( uiConfigName, *curveDataGroup );
} }
if ((eclipseCase && m_eclipseResultDefinition->hasDynamicResult()) if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase )
|| geomCase)
{ {
curveDataGroup->add(&m_timeStep); curveDataGroup->add( &m_timeStep );
} }
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering(uiConfigName, *nameGroup); m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -519,11 +522,11 @@ void Rim3dWellLogExtractionCurve::defineUiOrdering(QString uiConfigName, caf::Pd
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogExtractionCurve::initAfterRead() void Rim3dWellLogExtractionCurve::initAfterRead()
{ {
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
m_eclipseResultDefinition->setEclipseCase(eclipseCase); m_eclipseResultDefinition->setEclipseCase( eclipseCase );
m_geomResultDefinition->setGeoMechCase(geomCase); m_geomResultDefinition->setGeoMechCase( geomCase );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -531,32 +534,32 @@ void Rim3dWellLogExtractionCurve::initAfterRead()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString Rim3dWellLogExtractionCurve::wellDate() const QString Rim3dWellLogExtractionCurve::wellDate() const
{ {
RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>(m_case.value()); RimGeoMechCase* geomCase = dynamic_cast<RimGeoMechCase*>( m_case.value() );
RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>(m_case.value()); RimEclipseCase* eclipseCase = dynamic_cast<RimEclipseCase*>( m_case.value() );
QStringList timeStepNames; QStringList timeStepNames;
if (eclipseCase) if ( eclipseCase )
{ {
if (m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE) if ( m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE )
{ {
return QString(); return QString();
} }
if (eclipseCase->eclipseCaseData()) if ( eclipseCase->eclipseCaseData() )
{ {
timeStepNames = eclipseCase->timeStepStrings(); timeStepNames = eclipseCase->timeStepStrings();
} }
} }
else if (geomCase) else if ( geomCase )
{ {
if (geomCase->geoMechData()) if ( geomCase->geoMechData() )
{ {
timeStepNames = geomCase->timeStepStrings(); timeStepNames = geomCase->timeStepStrings();
} }
} }
if (m_timeStep == -1) if ( m_timeStep == -1 )
{ {
return QString("Animation Time Step"); return QString( "Animation Time Step" );
} }
return (m_timeStep >= 0 && m_timeStep < timeStepNames.size()) ? timeStepNames[m_timeStep] : ""; return ( m_timeStep >= 0 && m_timeStep < timeStepNames.size() ) ? timeStepNames[m_timeStep] : "";
} }

View File

@ -20,9 +20,9 @@
#include "RigWellLogFile.h" #include "RigWellLogFile.h"
#include "RimWellLogFileCurveNameConfig.h"
#include "RimWellLogFile.h" #include "RimWellLogFile.h"
#include "RimWellLogFileChannel.h" #include "RimWellLogFileChannel.h"
#include "RimWellLogFileCurveNameConfig.h"
#include "RimWellPath.h" #include "RimWellPath.h"
#include <QFileInfo> #include <QFileInfo>
@ -32,29 +32,27 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve"); CAF_PDM_SOURCE_INIT( Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::Rim3dWellLogFileCurve() Rim3dWellLogFileCurve::Rim3dWellLogFileCurve()
{ {
CAF_PDM_InitObject("3d Well Log File Curve", ":/WellLogCurve16x16.png", "", ""); CAF_PDM_InitObject( "3d Well Log File Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "CurveWellLogChannel", "Well Log Channel", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogFile, "WellLogFile", "Well Log File", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_wellLogFile, "WellLogFile", "Well Log File", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogFileCurveNameConfig(); m_nameConfig = new RimWellLogFileCurveNameConfig();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -62,18 +60,18 @@ Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve()
void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo() void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo()
{ {
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType( wellPath );
if (wellPath && !wellPath->wellLogFiles().empty()) if ( wellPath && !wellPath->wellLogFiles().empty() )
{ {
m_wellLogFile = wellPath->wellLogFiles()[0]; m_wellLogFile = wellPath->wellLogFiles()[0];
} }
if (m_wellLogFile) if ( m_wellLogFile )
{ {
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels(); std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
if (!fileLogs.empty()) if ( !fileLogs.empty() )
{ {
m_wellLogChannelName = fileLogs[0]->name(); m_wellLogChannelName = fileLogs[0]->name();
} }
@ -83,17 +81,17 @@ void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const void Rim3dWellLogFileCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{ {
CAF_ASSERT(values != nullptr); CAF_ASSERT( values != nullptr );
CAF_ASSERT(measuredDepthValues != nullptr); CAF_ASSERT( measuredDepthValues != nullptr );
if (m_wellLogFile) if ( m_wellLogFile )
{ {
RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData(); RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData();
if (wellLogFile) if ( wellLogFile )
{ {
*values = wellLogFile->values(m_wellLogChannelName); *values = wellLogFile->values( m_wellLogChannelName );
*measuredDepthValues = wellLogFile->depthValues(); *measuredDepthValues = wellLogFile->depthValues();
} }
} }
@ -121,49 +119,48 @@ QString Rim3dWellLogFileCurve::name() const
QString Rim3dWellLogFileCurve::createAutoName() const QString Rim3dWellLogFileCurve::createAutoName() const
{ {
QStringList name; QStringList name;
QString unit; QString unit;
bool channelNameAvailable = false; bool channelNameAvailable = false;
RimWellPath* wellPath; RimWellPath* wellPath;
this->firstAncestorOrThisOfType(wellPath); this->firstAncestorOrThisOfType( wellPath );
if (wellPath) if ( wellPath )
{ {
name.push_back(wellPath->name()); name.push_back( wellPath->name() );
name.push_back("LAS"); name.push_back( "LAS" );
if (!m_wellLogChannelName().isEmpty()) if ( !m_wellLogChannelName().isEmpty() )
{ {
name.push_back(m_wellLogChannelName); name.push_back( m_wellLogChannelName );
channelNameAvailable = true; channelNameAvailable = true;
} }
RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr; RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr;
if (wellLogFile) if ( wellLogFile )
{ {
if (channelNameAvailable) if ( channelNameAvailable )
{ {
/* RimWellLogPlot* wellLogPlot; /* RimWellLogPlot* wellLogPlot;
firstAncestorOrThisOfType(wellLogPlot); firstAncestorOrThisOfType(wellLogPlot);
CVF_ASSERT(wellLogPlot); CVF_ASSERT(wellLogPlot);
QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit()); QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit());
if (!unitName.isEmpty()) if (!unitName.isEmpty())
{ {
name.back() += QString(" [%1]").arg(unitName); name.back() += QString(" [%1]").arg(unitName);
} */ } */
} }
QString date = wellLogFile->date(); QString date = wellLogFile->date();
if (!date.isEmpty()) if ( !date.isEmpty() )
{ {
name.push_back(wellLogFile->date()); name.push_back( wellLogFile->date() );
} }
} }
return name.join(", "); return name.join( ", " );
} }
return "Empty curve"; return "Empty curve";
@ -180,59 +177,59 @@ caf::PdmFieldHandle* Rim3dWellLogFileCurve::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, void Rim3dWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue )
{ {
if (changedField == &m_wellLogFile || changedField == &m_wellLogChannelName) if ( changedField == &m_wellLogFile || changedField == &m_wellLogChannelName )
{ {
this->resetMinMaxValuesAndUpdateUI(); this->resetMinMaxValuesAndUpdateUI();
} }
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, QList<caf::PdmOptionItemInfo>
bool* useOptionsOnly) Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
options = Rim3dWellLogCurve::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); options = Rim3dWellLogCurve::calculateValueOptions( fieldNeedingOptions, useOptionsOnly );
if (!options.empty()) return options; if ( !options.empty() ) return options;
if (fieldNeedingOptions == &m_wellLogChannelName) if ( fieldNeedingOptions == &m_wellLogChannelName )
{ {
if (m_wellLogFile) if ( m_wellLogFile )
{ {
std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels(); std::vector<RimWellLogFileChannel*> fileLogs = m_wellLogFile->wellLogChannels();
for (size_t i = 0; i < fileLogs.size(); i++) for ( size_t i = 0; i < fileLogs.size(); i++ )
{ {
QString wellLogChannelName = fileLogs[i]->name(); QString wellLogChannelName = fileLogs[i]->name();
options.push_back(caf::PdmOptionItemInfo(wellLogChannelName, wellLogChannelName)); options.push_back( caf::PdmOptionItemInfo( wellLogChannelName, wellLogChannelName ) );
} }
} }
if (options.size() == 0) if ( options.size() == 0 )
{ {
options.push_back(caf::PdmOptionItemInfo("None", "None")); options.push_back( caf::PdmOptionItemInfo( "None", "None" ) );
} }
} }
if (fieldNeedingOptions == &m_wellLogFile) if ( fieldNeedingOptions == &m_wellLogFile )
{ {
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType( wellPath );
if (wellPath && !wellPath->wellLogFiles().empty()) if ( wellPath && !wellPath->wellLogFiles().empty() )
{ {
for (RimWellLogFile* const wellLogFile : wellPath->wellLogFiles()) for ( RimWellLogFile* const wellLogFile : wellPath->wellLogFiles() )
{ {
QFileInfo fileInfo(wellLogFile->fileName()); QFileInfo fileInfo( wellLogFile->fileName() );
options.push_back(caf::PdmOptionItemInfo(fileInfo.baseName(), wellLogFile)); options.push_back( caf::PdmOptionItemInfo( fileInfo.baseName(), wellLogFile ) );
} }
} }
} }
@ -243,16 +240,16 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogFileCurve::calculateValueOptions(const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogFileCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void Rim3dWellLogFileCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add(&m_wellLogFile); curveDataGroup->add( &m_wellLogFile );
curveDataGroup->add(&m_wellLogChannelName); curveDataGroup->add( &m_wellLogChannelName );
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering(uiConfigName, *nameGroup); m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields( true );
} }

View File

@ -24,37 +24,37 @@
#include "RigWellLogCurveData.h" #include "RigWellLogCurveData.h"
#include "RimWellLogRftCurveNameConfig.h"
#include "RimEclipseResultCase.h" #include "RimEclipseResultCase.h"
#include "RimTools.h" #include "RimTools.h"
#include "RimWellPath.h"
#include "RimWellLogCurve.h" #include "RimWellLogCurve.h"
#include "RimWellLogRftCurveNameConfig.h"
#include "RimWellPath.h"
//================================================================================================== //==================================================================================================
/// ///
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve"); CAF_PDM_SOURCE_INIT( Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
Rim3dWellLogRftCurve::Rim3dWellLogRftCurve() Rim3dWellLogRftCurve::Rim3dWellLogRftCurve()
{ {
CAF_PDM_InitObject("3d Well Log RFT Curve", ":/WellLogCurve16x16.png", "", ""); CAF_PDM_InitObject( "3d Well Log RFT Curve", ":/WellLogCurve16x16.png", "", "" );
CAF_PDM_InitFieldNoDefault(&m_eclipseResultCase, "eclipseResultCase", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "eclipseResultCase", "", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_timeStep, "timeStep", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_timeStep, "timeStep", "", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_wellLogChannelName, "wellLogChannelName", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_wellLogChannelName, "wellLogChannelName", "", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_2dWellLogRftCurve, "my2dWellLogRftCurve", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_2dWellLogRftCurve, "my2dWellLogRftCurve", "", "", "", "" );
m_2dWellLogRftCurve = new RimWellLogRftCurve(); m_2dWellLogRftCurve = new RimWellLogRftCurve();
m_2dWellLogRftCurve.xmlCapability()->disableIO(); m_2dWellLogRftCurve.xmlCapability()->disableIO();
CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" );
m_nameConfig = new RimWellLogRftCurveNameConfig(); m_nameConfig = new RimWellLogRftCurveNameConfig();
} }
@ -69,17 +69,17 @@ Rim3dWellLogRftCurve::~Rim3dWellLogRftCurve()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector<double>* values, std::vector<double>* measuredDepthValues) const void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector<double>* values, std::vector<double>* measuredDepthValues ) const
{ {
if (m_2dWellLogRftCurve->wellName() == QString()) if ( m_2dWellLogRftCurve->wellName() == QString() )
{ {
m_2dWellLogRftCurve->setDefaultAddress(wellName()); m_2dWellLogRftCurve->setDefaultAddress( wellName() );
} }
const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData(); const RigWellLogCurveData* curveData = m_2dWellLogRftCurve->curveData();
//These values are for a simulation well // These values are for a simulation well
*values = curveData->xValues(); *values = curveData->xValues();
*measuredDepthValues = curveData->measuredDepths(); *measuredDepthValues = curveData->measuredDepths();
} }
@ -88,7 +88,7 @@ void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector<double>* values, std::v
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QString Rim3dWellLogRftCurve::resultPropertyString() const QString Rim3dWellLogRftCurve::resultPropertyString() const
{ {
return caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(m_wellLogChannelName()); return caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( m_wellLogChannelName() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -106,28 +106,29 @@ QString Rim3dWellLogRftCurve::createAutoName() const
{ {
QStringList name; QStringList name;
if (!wellName().isEmpty()) if ( !wellName().isEmpty() )
{ {
name.push_back(wellName()); name.push_back( wellName() );
} }
name.push_back("RFT"); name.push_back( "RFT" );
if (m_eclipseResultCase) if ( m_eclipseResultCase )
{ {
name.push_back(m_eclipseResultCase->caseUserDescription()); name.push_back( m_eclipseResultCase->caseUserDescription() );
} }
if (m_wellLogChannelName().text() != caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text(RifEclipseRftAddress::NONE)) if ( m_wellLogChannelName().text() !=
caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::text( RifEclipseRftAddress::NONE ) )
{ {
RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName(); RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName();
name.push_back(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelNameEnum)); name.push_back( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText( channelNameEnum ) );
} }
if (!m_timeStep().isNull()) if ( !m_timeStep().isNull() )
{ {
name.push_back(m_timeStep().toString(RiaQDateTimeTools::dateFormatString())); name.push_back( m_timeStep().toString( RiaQDateTimeTools::dateFormatString() ) );
} }
return name.join(", "); return name.join( ", " );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -141,66 +142,74 @@ caf::PdmFieldHandle* Rim3dWellLogRftCurve::userDescriptionField()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, void Rim3dWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue, const QVariant& oldValue,
const QVariant& newValue) const QVariant& newValue )
{ {
if (changedField == &m_wellLogChannelName || changedField == &m_timeStep) if ( changedField == &m_wellLogChannelName || changedField == &m_timeStep )
{ {
this->resetMinMaxValuesAndUpdateUI(); this->resetMinMaxValuesAndUpdateUI();
} }
Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QList<caf::PdmOptionItemInfo> Rim3dWellLogRftCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) QList<caf::PdmOptionItemInfo> Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly )
{ {
QList<caf::PdmOptionItemInfo> options; QList<caf::PdmOptionItemInfo> options;
if (fieldNeedingOptions == &m_eclipseResultCase) if ( fieldNeedingOptions == &m_eclipseResultCase )
{ {
RimTools::caseOptionItems(&options); RimTools::caseOptionItems( &options );
options.push_front(caf::PdmOptionItemInfo("None", nullptr)); options.push_front( caf::PdmOptionItemInfo( "None", nullptr ) );
} }
else if (fieldNeedingOptions == &m_wellLogChannelName) else if ( fieldNeedingOptions == &m_wellLogChannelName )
{ {
if (m_eclipseResultCase) if ( m_eclipseResultCase )
{ {
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader(); RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if (reader) if ( reader )
{ {
for (const RifEclipseRftAddress::RftWellLogChannelType& channelName : reader->availableWellLogChannels(wellName())) for ( const RifEclipseRftAddress::RftWellLogChannelType& channelName :
reader->availableWellLogChannels( wellName() ) )
{ {
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(channelName), channelName)); options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
channelName ),
channelName ) );
} }
} }
if (options.empty()) if ( options.empty() )
{ {
options.push_back(caf::PdmOptionItemInfo(caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE)); options.push_back(
caf::PdmOptionItemInfo( caf::AppEnum<RifEclipseRftAddress::RftWellLogChannelType>::uiText(
RifEclipseRftAddress::NONE ),
RifEclipseRftAddress::NONE ) );
} }
} }
} }
else if (fieldNeedingOptions == &m_timeStep) else if ( fieldNeedingOptions == &m_timeStep )
{ {
if (m_eclipseResultCase) if ( m_eclipseResultCase )
{ {
RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader(); RifReaderEclipseRft* reader = m_eclipseResultCase()->rftReader();
if (reader) if ( reader )
{ {
QString dateFormat = "dd MMM yyyy"; QString dateFormat = "dd MMM yyyy";
std::set<QDateTime> timeStamps = reader->availableTimeSteps(wellName(), m_wellLogChannelName()); std::set<QDateTime> timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() );
for (const QDateTime& dt : timeStamps) for ( const QDateTime& dt : timeStamps )
{ {
QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale(dt, dateFormat); QString dateString = RiaQDateTimeTools::toStringUsingApplicationLocale( dt, dateFormat );
options.push_back(caf::PdmOptionItemInfo(dateString, dt)); options.push_back( caf::PdmOptionItemInfo( dateString, dt ) );
} }
} }
options.push_back(caf::PdmOptionItemInfo("None", QDateTime())); options.push_back( caf::PdmOptionItemInfo( "None", QDateTime() ) );
} }
} }
return options; return options;
@ -209,19 +218,19 @@ QList<caf::PdmOptionItemInfo> Rim3dWellLogRftCurve::calculateValueOptions(const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void Rim3dWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" );
curveDataGroup->add(&m_eclipseResultCase); curveDataGroup->add( &m_eclipseResultCase );
curveDataGroup->add(&m_wellLogChannelName); curveDataGroup->add( &m_wellLogChannelName );
curveDataGroup->add(&m_timeStep); curveDataGroup->add( &m_timeStep );
Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); Rim3dWellLogCurve::configurationUiOrdering( uiOrdering );
caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" );
m_nameConfig->uiOrdering(uiConfigName, *nameGroup); m_nameConfig->uiOrdering( uiConfigName, *nameGroup );
uiOrdering.skipRemainingFields(true); uiOrdering.skipRemainingFields( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -230,7 +239,7 @@ void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrde
QString Rim3dWellLogRftCurve::wellName() const QString Rim3dWellLogRftCurve::wellName() const
{ {
RimWellPath* wellPath = nullptr; RimWellPath* wellPath = nullptr;
firstAncestorOrThisOfType(wellPath); firstAncestorOrThisOfType( wellPath );
return wellPath->name(); return wellPath->name();
} }

View File

@ -17,39 +17,37 @@
// //
///////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////
#include "RimProject.h"
#include "RimNameConfig.h" #include "RimNameConfig.h"
#include "Rim3dWellLogCurve.h" #include "Rim3dWellLogCurve.h"
#include "RimProject.h"
//================================================================================================== //==================================================================================================
/// ///
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimNameConfig, "RimCurveNameConfig"); CAF_PDM_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimNameConfig::RimNameConfig() RimNameConfig::RimNameConfig()
{ {
CAF_PDM_InitObject("Curve Name Generator", "", "", ""); CAF_PDM_InitObject( "Curve Name Generator", "", "", "" );
CAF_PDM_InitField(&m_isUsingAutoName_OBSOLETE, "IsUsingAutoName", true, "Add Automatic Name Tags", "", "", ""); CAF_PDM_InitField( &m_isUsingAutoName_OBSOLETE, "IsUsingAutoName", true, "Add Automatic Name Tags", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_customName, "CustomCurveName", "Custom Name Part", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_customName, "CustomCurveName", "Custom Name Part", "", "", "" );
CAF_PDM_InitFieldNoDefault(&m_autoName, "AutoCurveName", "Full Name", "", "", ""); CAF_PDM_InitFieldNoDefault( &m_autoName, "AutoCurveName", "Full Name", "", "", "" );
m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable(false); m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable( false );
m_autoName.registerGetMethod(this, &RimNameConfig::autoName); m_autoName.registerGetMethod( this, &RimNameConfig::autoName );
m_autoName.xmlCapability()->disableIO(); m_autoName.xmlCapability()->disableIO();
m_autoName.uiCapability()->setUiReadOnly(true); m_autoName.uiCapability()->setUiReadOnly( true );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimNameConfig::~RimNameConfig() RimNameConfig::~RimNameConfig() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -78,24 +76,26 @@ QString RimNameConfig::name() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimNameConfig::uiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimNameConfig::uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
defineUiOrdering(uiConfigName, uiOrdering); defineUiOrdering( uiConfigName, uiOrdering );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
uiOrdering.add(&m_customName); uiOrdering.add( &m_customName );
uiOrdering.add(&m_autoName); uiOrdering.add( &m_autoName );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) void RimNameConfig::fieldChangedByUi( const caf::PdmFieldHandle* changedField,
const QVariant& oldValue,
const QVariant& newValue )
{ {
updateAllSettings(); updateAllSettings();
} }
@ -106,14 +106,14 @@ void RimNameConfig::fieldChangedByUi(const caf::PdmFieldHandle* changedField, co
QString RimNameConfig::autoName() const QString RimNameConfig::autoName() const
{ {
RimNameConfigHolderInterface* plotHolder; RimNameConfigHolderInterface* plotHolder;
this->firstAncestorOrThisOfTypeAsserted(plotHolder); this->firstAncestorOrThisOfTypeAsserted( plotHolder );
return plotHolder->createAutoName(); return plotHolder->createAutoName();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimNameConfig::setCustomName(const QString& name) void RimNameConfig::setCustomName( const QString& name )
{ {
m_customName = name; m_customName = name;
} }
@ -127,10 +127,10 @@ void RimNameConfig::updateAllSettings()
m_customName.uiCapability()->updateConnectedEditors(); m_customName.uiCapability()->updateConnectedEditors();
RimNameConfigHolderInterface* holder; RimNameConfigHolderInterface* holder;
this->firstAncestorOrThisOfTypeAsserted(holder); this->firstAncestorOrThisOfTypeAsserted( holder );
holder->updateHolder(); holder->updateHolder();
caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>(holder); caf::PdmObject* pdmObject = dynamic_cast<caf::PdmObject*>( holder );
if (pdmObject) if ( pdmObject )
{ {
pdmObject->updateConnectedEditors(); pdmObject->updateConnectedEditors();
} }
@ -142,8 +142,8 @@ void RimNameConfig::updateAllSettings()
void RimNameConfig::initAfterRead() void RimNameConfig::initAfterRead()
{ {
// Now we just switch them all individually. // Now we just switch them all individually.
if (!m_isUsingAutoName_OBSOLETE()) if ( !m_isUsingAutoName_OBSOLETE() )
{ {
enableAllAutoNameTags(false); enableAllAutoNameTags( false );
} }
} }

View File

@ -30,7 +30,11 @@ class RimNameConfigHolderInterface
{ {
public: public:
virtual QString createAutoName() const = 0; virtual QString createAutoName() const = 0;
void updateHolder() { performAutoNameUpdate(); } void updateHolder()
{
performAutoNameUpdate();
}
protected: protected:
virtual void performAutoNameUpdate() {} virtual void performAutoNameUpdate() {}
}; };
@ -47,26 +51,25 @@ public:
RimNameConfig(); RimNameConfig();
~RimNameConfig() override; ~RimNameConfig() override;
QString customName() const; QString customName() const;
void setCustomName(const QString& name); void setCustomName( const QString& name );
virtual void enableAllAutoNameTags(bool enable) {} virtual void enableAllAutoNameTags( bool enable ) {}
caf::PdmFieldHandle* nameField(); caf::PdmFieldHandle* nameField();
QString name() const; QString name() const;
void uiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); void uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering );
protected: protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
QString autoName() const; const QVariant& oldValue,
virtual void updateAllSettings(); const QVariant& newValue ) override;
void initAfterRead() override; QString autoName() const;
virtual void updateAllSettings();
void initAfterRead() override;
protected: protected:
caf::PdmField<bool> m_isUsingAutoName_OBSOLETE; caf::PdmField<bool> m_isUsingAutoName_OBSOLETE;
caf::PdmField<QString> m_customName; caf::PdmField<QString> m_customName;
caf::PdmProxyValueField<QString> m_autoName; caf::PdmProxyValueField<QString> m_autoName;
}; };

View File

@ -23,24 +23,24 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimViewNameConfig, "RimViewNameConfig"); CAF_PDM_SOURCE_INIT( RimViewNameConfig, "RimViewNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RimViewNameConfig::RimViewNameConfig() RimViewNameConfig::RimViewNameConfig()
: RimNameConfig() : RimNameConfig()
, m_hideCaseNameField(false) , m_hideCaseNameField( false )
, m_hideAggregationTypeField(false) , m_hideAggregationTypeField( false )
, m_hidePropertyField(false) , m_hidePropertyField( false )
, m_hideSampleSpacingField(false) , m_hideSampleSpacingField( false )
{ {
CAF_PDM_InitObject("View Name Generator", "", "", ""); CAF_PDM_InitObject( "View Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", ""); CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "" );
CAF_PDM_InitField(&m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", ""); CAF_PDM_InitField( &m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", "" );
CAF_PDM_InitField(&m_addProperty, "AddProperty", true, "Add Property Type", "", "", ""); CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField(&m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", ""); CAF_PDM_InitField( &m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", "" );
m_customName = ""; m_customName = "";
} }
@ -48,7 +48,7 @@ RimViewNameConfig::RimViewNameConfig()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddCaseName(bool add) void RimViewNameConfig::setAddCaseName( bool add )
{ {
m_addCaseName = add; m_addCaseName = add;
} }
@ -64,7 +64,7 @@ bool RimViewNameConfig::addCaseName() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddAggregationType(bool add) void RimViewNameConfig::setAddAggregationType( bool add )
{ {
m_addAggregationType = add; m_addAggregationType = add;
} }
@ -80,7 +80,7 @@ bool RimViewNameConfig::addAggregationType() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddProperty(bool add) void RimViewNameConfig::setAddProperty( bool add )
{ {
m_addProperty = add; m_addProperty = add;
} }
@ -96,7 +96,7 @@ bool RimViewNameConfig::addProperty() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::setAddSampleSpacing(bool add) void RimViewNameConfig::setAddSampleSpacing( bool add )
{ {
m_addSampleSpacing = add; m_addSampleSpacing = add;
} }
@ -112,7 +112,7 @@ bool RimViewNameConfig::addSampleSpacing() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::enableAllAutoNameTags(bool enable) void RimViewNameConfig::enableAllAutoNameTags( bool enable )
{ {
m_addCaseName = enable; m_addCaseName = enable;
m_addAggregationType = enable; m_addAggregationType = enable;
@ -123,7 +123,7 @@ void RimViewNameConfig::enableAllAutoNameTags(bool enable)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideCaseNameField(bool hide) void RimViewNameConfig::hideCaseNameField( bool hide )
{ {
m_hideCaseNameField = hide; m_hideCaseNameField = hide;
} }
@ -131,7 +131,7 @@ void RimViewNameConfig::hideCaseNameField(bool hide)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideAggregationTypeField(bool hide) void RimViewNameConfig::hideAggregationTypeField( bool hide )
{ {
m_hideAggregationTypeField = hide; m_hideAggregationTypeField = hide;
} }
@ -139,7 +139,7 @@ void RimViewNameConfig::hideAggregationTypeField(bool hide)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hidePropertyField(bool hide) void RimViewNameConfig::hidePropertyField( bool hide )
{ {
m_hidePropertyField = hide; m_hidePropertyField = hide;
} }
@ -147,7 +147,7 @@ void RimViewNameConfig::hidePropertyField(bool hide)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::hideSampleSpacingField(bool hide) void RimViewNameConfig::hideSampleSpacingField( bool hide )
{ {
m_hideSampleSpacingField = hide; m_hideSampleSpacingField = hide;
} }
@ -155,11 +155,11 @@ void RimViewNameConfig::hideSampleSpacingField(bool hide)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimViewNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimViewNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering); RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
if (!m_hideCaseNameField) uiOrdering.add(&m_addCaseName); if ( !m_hideCaseNameField ) uiOrdering.add( &m_addCaseName );
if (!m_hideAggregationTypeField) uiOrdering.add(&m_addAggregationType); if ( !m_hideAggregationTypeField ) uiOrdering.add( &m_addAggregationType );
if (!m_hidePropertyField) uiOrdering.add(&m_addProperty); if ( !m_hidePropertyField ) uiOrdering.add( &m_addProperty );
if (!m_hideSampleSpacingField) uiOrdering.add(&m_addSampleSpacing); if ( !m_hideSampleSpacingField ) uiOrdering.add( &m_addSampleSpacing );
} }

View File

@ -31,35 +31,33 @@ class RimViewNameConfig : public RimNameConfig
public: public:
explicit RimViewNameConfig(); explicit RimViewNameConfig();
void setAddCaseName(bool add); void setAddCaseName( bool add );
bool addCaseName() const; bool addCaseName() const;
void setAddAggregationType(bool add); void setAddAggregationType( bool add );
bool addAggregationType() const; bool addAggregationType() const;
void setAddProperty(bool add); void setAddProperty( bool add );
bool addProperty() const; bool addProperty() const;
void setAddSampleSpacing(bool add); void setAddSampleSpacing( bool add );
bool addSampleSpacing() const; bool addSampleSpacing() const;
void enableAllAutoNameTags(bool enable) override; void enableAllAutoNameTags( bool enable ) override;
void hideCaseNameField(bool hide); void hideCaseNameField( bool hide );
void hideAggregationTypeField(bool hide); void hideAggregationTypeField( bool hide );
void hidePropertyField(bool hide); void hidePropertyField( bool hide );
void hideSampleSpacingField(bool hide); void hideSampleSpacingField( bool hide );
protected: protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private: private:
caf::PdmField<bool> m_addCaseName; caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addAggregationType; caf::PdmField<bool> m_addAggregationType;
caf::PdmField<bool> m_addProperty; caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addSampleSpacing; caf::PdmField<bool> m_addSampleSpacing;
bool m_hideCaseNameField; bool m_hideCaseNameField;
bool m_hideAggregationTypeField; bool m_hideAggregationTypeField;
bool m_hidePropertyField; bool m_hidePropertyField;
bool m_hideSampleSpacingField; bool m_hideSampleSpacingField;
}; };

View File

@ -23,7 +23,7 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig"); CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -31,13 +31,13 @@ CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCu
RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig() RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig()
: RimNameConfig() : RimNameConfig()
{ {
CAF_PDM_InitObject("Well Log Extraction Curve Name Generator", "", "", ""); CAF_PDM_InitObject( "Well Log Extraction Curve Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", ""); CAF_PDM_InitField( &m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", "" );
CAF_PDM_InitField(&m_addProperty, "AddProperty", true, "Add Property Type", "", "", ""); CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" );
CAF_PDM_InitField(&m_addWellName, "AddWellName", true, "Add Well Name", "", "", ""); CAF_PDM_InitField( &m_addWellName, "AddWellName", true, "Add Well Name", "", "", "" );
CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", ""); CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" );
CAF_PDM_InitField(&m_addDate, "AddDate", true, "Add Date", "", "", ""); CAF_PDM_InitField( &m_addDate, "AddDate", true, "Add Date", "", "", "" );
m_customName = "Log Extraction"; m_customName = "Log Extraction";
} }
@ -85,7 +85,7 @@ bool RimWellLogExtractionCurveNameConfig::addDate() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags(bool enable) void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags( bool enable )
{ {
m_addCaseName = enable; m_addCaseName = enable;
m_addProperty = enable; m_addProperty = enable;
@ -97,12 +97,12 @@ void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags(bool enable)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogExtractionCurveNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimWellLogExtractionCurveNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering); RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add(&m_addCaseName); uiOrdering.add( &m_addCaseName );
uiOrdering.add(&m_addProperty); uiOrdering.add( &m_addProperty );
uiOrdering.add(&m_addWellName); uiOrdering.add( &m_addWellName );
uiOrdering.add(&m_addTimestep); uiOrdering.add( &m_addTimestep );
uiOrdering.add(&m_addDate); uiOrdering.add( &m_addDate );
} }

View File

@ -31,23 +31,21 @@ class RimWellLogExtractionCurveNameConfig : public RimNameConfig
public: public:
RimWellLogExtractionCurveNameConfig(); RimWellLogExtractionCurveNameConfig();
bool addCaseName() const; bool addCaseName() const;
bool addProperty() const; bool addProperty() const;
bool addWellName() const; bool addWellName() const;
bool addTimeStep() const; bool addTimeStep() const;
bool addDate() const; bool addDate() const;
void enableAllAutoNameTags(bool enable) override; void enableAllAutoNameTags( bool enable ) override;
protected: protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private: private:
caf::PdmField<bool> m_addCaseName; caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addProperty; caf::PdmField<bool> m_addProperty;
caf::PdmField<bool> m_addWellName; caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep; caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addDate; caf::PdmField<bool> m_addDate;
}; };

View File

@ -23,7 +23,7 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig"); CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -31,7 +31,6 @@ CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfi
RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig() RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig()
: RimNameConfig() : RimNameConfig()
{ {
CAF_PDM_InitObject("Well Log File Curve Name Generator", "", "", ""); CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" );
m_customName = "Las Curve"; m_customName = "Las Curve";
} }

View File

@ -31,4 +31,3 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig
public: public:
RimWellLogFileCurveNameConfig(); RimWellLogFileCurveNameConfig();
}; };

File diff suppressed because it is too large Load Diff

View File

@ -55,7 +55,12 @@ public:
CONNECTION_NUMBER CONNECTION_NUMBER
}; };
enum AxisGridVisibility { AXIS_GRID_NONE, AXIS_GRID_MAJOR, AXIS_GRID_MAJOR_AND_MINOR }; enum AxisGridVisibility
{
AXIS_GRID_NONE,
AXIS_GRID_MAJOR,
AXIS_GRID_MAJOR_AND_MINOR
};
typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum; typedef caf::AppEnum<AxisGridVisibility> AxisGridEnum;
@ -63,88 +68,95 @@ public:
RimWellLogPlot(); RimWellLogPlot();
~RimWellLogPlot() override; ~RimWellLogPlot() override;
RimWellLogPlot& operator=(RimWellLogPlot&& rhs); RimWellLogPlot& operator=( RimWellLogPlot&& rhs );
QWidget* createPlotWidget(); QWidget* createPlotWidget();
QWidget* viewWidget() override; QWidget* viewWidget() override;
void setDescription(const QString& description); void setDescription( const QString& description );
QString description() const; QString description() const;
DepthTypeEnum depthType() const; DepthTypeEnum depthType() const;
void setDepthType(DepthTypeEnum depthType); void setDepthType( DepthTypeEnum depthType );
RiaDefines::DepthUnitType depthUnit() const; RiaDefines::DepthUnitType depthUnit() const;
void setDepthUnit(RiaDefines::DepthUnitType depthUnit); void setDepthUnit( RiaDefines::DepthUnitType depthUnit );
QString depthPlotTitle() const; QString depthPlotTitle() const;
void enableDepthGridLines(AxisGridVisibility gridVisibility); void enableDepthGridLines( AxisGridVisibility gridVisibility );
AxisGridVisibility depthGridLinesVisibility() const; AxisGridVisibility depthGridLinesVisibility() const;
bool isPlotTitleVisible() const; bool isPlotTitleVisible() const;
void setPlotTitleVisible(bool visible); void setPlotTitleVisible( bool visible );
bool areTrackLegendsVisible() const; bool areTrackLegendsVisible() const;
void setTrackLegendsVisible(bool doShow); void setTrackLegendsVisible( bool doShow );
bool areTrackLegendsHorizontal() const; bool areTrackLegendsHorizontal() const;
void setTrackLegendsHorizontal(bool horizontal); void setTrackLegendsHorizontal( bool horizontal );
void addTrack(RimWellLogTrack* track); void addTrack( RimWellLogTrack* track );
void insertTrack(RimWellLogTrack* track, size_t index); void insertTrack( RimWellLogTrack* track, size_t index );
size_t trackCount() const { return m_tracks.size();} size_t trackCount() const
{
return m_tracks.size();
}
void removeTrack(RimWellLogTrack* track); void removeTrack( RimWellLogTrack* track );
size_t trackIndex(const RimWellLogTrack* track) const; size_t trackIndex( const RimWellLogTrack* track ) const;
RimWellLogTrack* trackByIndex(size_t index) const; RimWellLogTrack* trackByIndex( size_t index ) const;
size_t firstVisibleTrackIndex() const; size_t firstVisibleTrackIndex() const;
std::vector<RimWellLogTrack*> tracks() const; std::vector<RimWellLogTrack*> tracks() const;
void updateTracks(bool autoScaleXAxis = false); void updateTracks( bool autoScaleXAxis = false );
void updateTrackNames(); void updateTrackNames();
void updateDepthZoom(); void updateDepthZoom();
void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter); void setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter );
void panDepth(double panFactor); void panDepth( double panFactor );
void setDepthZoomMinMax(double minimumDepth, double maximumDepth); void setDepthZoomMinMax( double minimumDepth, double maximumDepth );
void depthZoomMinMax(double* minimumDepth, double* maximumDepth) const; void depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const;
void calculateAvailableDepthRange(); void calculateAvailableDepthRange();
void availableDepthRange(double* minimumDepth, double* maximumDepth) const; void availableDepthRange( double* minimumDepth, double* maximumDepth ) const;
bool hasAvailableDepthRange() const; bool hasAvailableDepthRange() const;
void zoomAll() override; void zoomAll() override;
void setDepthAutoZoom(bool on); void setDepthAutoZoom( bool on );
void enableAllAutoNameTags(bool enable); void enableAllAutoNameTags( bool enable );
QString asciiDataForPlotExport() const; QString asciiDataForPlotExport() const;
void uiOrderingForDepthAxis(caf::PdmUiOrdering& uiOrdering); void uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering );
void uiOrderingForPlotSettings(caf::PdmUiOrdering& uiOrdering); void uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering );
QString createAutoName() const override; QString createAutoName() const override;
void handleKeyPressEvent( QKeyEvent* keyEvent );
RimWellLogCurveCommonDataSource* commonDataSource() const;
void handleKeyPressEvent(QKeyEvent* keyEvent);
RimWellLogCurveCommonDataSource* commonDataSource() const;
protected: protected:
void performAutoNameUpdate() override; void performAutoNameUpdate() override;
// Overridden PDM methods // Overridden PDM methods
void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; void fieldChangedByUi( const caf::PdmFieldHandle* changedField,
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; const QVariant& oldValue,
caf::PdmFieldHandle* userDescriptionField() override; const QVariant& newValue ) override;
QList<caf::PdmOptionItemInfo> calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
void onLoadDataAndUpdate() override; caf::PdmFieldHandle* userDescriptionField() override;
QList<caf::PdmOptionItemInfo> calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions,
bool* useOptionsOnly ) override;
void onLoadDataAndUpdate() override;
QImage snapshotWindowContent() override; QImage snapshotWindowContent() override;
QWidget* createViewWidget(QWidget* mainWindowParent) override; QWidget* createViewWidget( QWidget* mainWindowParent ) override;
void deleteViewWidget() override; void deleteViewWidget() override;
void initAfterRead() override; void initAfterRead() override;
private: private:
void applyZoomAllDepths(); void applyZoomAllDepths();
void applyDepthZoomFromVisibleDepth(); void applyDepthZoomFromVisibleDepth();
void recreateTrackPlots(); void recreateTrackPlots();
void detachAllCurves(); void detachAllCurves();
virtual std::set<RiaDefines::DepthUnitType> availableDepthUnits() const; virtual std::set<RiaDefines::DepthUnitType> availableDepthUnits() const;
virtual std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const; virtual std::set<RimWellLogPlot::DepthTypeEnum> availableDepthTypes() const;
@ -152,22 +164,22 @@ private:
virtual void onDepthTypeChanged(); virtual void onDepthTypeChanged();
protected: protected:
caf::PdmField<QString> m_userName_OBSOLETE; caf::PdmField<QString> m_userName_OBSOLETE;
caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource; caf::PdmChildField<RimWellLogCurveCommonDataSource*> m_commonDataSource;
caf::PdmChildArrayField<RimWellLogTrack*> m_tracks; caf::PdmChildArrayField<RimWellLogTrack*> m_tracks;
caf::PdmField< caf::AppEnum<DepthTypeEnum>> m_depthType; caf::PdmField<caf::AppEnum<DepthTypeEnum>> m_depthType;
caf::PdmField< caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit; caf::PdmField<caf::AppEnum<RiaDefines::DepthUnitType>> m_depthUnit;
caf::PdmField<double> m_minVisibleDepth; caf::PdmField<double> m_minVisibleDepth;
caf::PdmField<double> m_maxVisibleDepth; caf::PdmField<double> m_maxVisibleDepth;
caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility; caf::PdmField<AxisGridEnum> m_depthAxisGridVisibility;
caf::PdmField<bool> m_isAutoScaleDepthEnabled; caf::PdmField<bool> m_isAutoScaleDepthEnabled;
caf::PdmField<bool> m_showTitleInPlot; caf::PdmField<bool> m_showTitleInPlot;
caf::PdmField<bool> m_showTrackLegends; caf::PdmField<bool> m_showTrackLegends;
caf::PdmField<bool> m_trackLegendsHorizontal; caf::PdmField<bool> m_trackLegendsHorizontal;
caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig; caf::PdmChildField<RimWellLogPlotNameConfig*> m_nameConfig;
double m_minAvailableDepth; double m_minAvailableDepth;
double m_maxAvailableDepth; double m_maxAvailableDepth;

View File

@ -23,7 +23,7 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig"); CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -31,13 +31,13 @@ CAF_PDM_SOURCE_INIT(RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig");
RimWellLogPlotNameConfig::RimWellLogPlotNameConfig() RimWellLogPlotNameConfig::RimWellLogPlotNameConfig()
: RimNameConfig() : RimNameConfig()
{ {
CAF_PDM_InitObject("Well Log Plot Name Generator", "", "", ""); CAF_PDM_InitObject( "Well Log Plot Name Generator", "", "", "" );
CAF_PDM_InitField(&m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", ""); CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "" );
CAF_PDM_InitField(&m_addWellName, "AddWellName", false, "Add Well Name", "", "", ""); CAF_PDM_InitField( &m_addWellName, "AddWellName", false, "Add Well Name", "", "", "" );
CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", false, "Add Time Step", "", "", ""); CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", false, "Add Time Step", "", "", "" );
CAF_PDM_InitField(&m_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", ""); CAF_PDM_InitField( &m_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", "" );
CAF_PDM_InitField(&m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", ""); CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", "" );
m_customName = "Well Log Plot"; m_customName = "Well Log Plot";
} }
@ -85,7 +85,7 @@ bool RimWellLogPlotNameConfig::addWaterDepth() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::enableAllAutoNameTags(bool enable) void RimWellLogPlotNameConfig::enableAllAutoNameTags( bool enable )
{ {
m_addCaseName = enable; m_addCaseName = enable;
m_addWellName = enable; m_addWellName = enable;
@ -97,13 +97,12 @@ void RimWellLogPlotNameConfig::enableAllAutoNameTags(bool enable)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RimWellLogPlotNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) void RimWellLogPlotNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering )
{ {
RimNameConfig::defineUiOrdering(uiConfigName, uiOrdering); RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering );
uiOrdering.add(&m_addCaseName); uiOrdering.add( &m_addCaseName );
uiOrdering.add(&m_addWellName); uiOrdering.add( &m_addWellName );
uiOrdering.add(&m_addTimestep); uiOrdering.add( &m_addTimestep );
uiOrdering.add(&m_addAirGap); uiOrdering.add( &m_addAirGap );
uiOrdering.add(&m_addWaterDepth); uiOrdering.add( &m_addWaterDepth );
} }

View File

@ -36,17 +36,15 @@ public:
bool addTimeStep() const; bool addTimeStep() const;
bool addAirGap() const; bool addAirGap() const;
bool addWaterDepth() const; bool addWaterDepth() const;
void enableAllAutoNameTags(bool enable) override; void enableAllAutoNameTags( bool enable ) override;
protected: protected:
void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override;
private: private:
caf::PdmField<bool> m_addCaseName; caf::PdmField<bool> m_addCaseName;
caf::PdmField<bool> m_addWellName; caf::PdmField<bool> m_addWellName;
caf::PdmField<bool> m_addTimestep; caf::PdmField<bool> m_addTimestep;
caf::PdmField<bool> m_addAirGap; caf::PdmField<bool> m_addAirGap;
caf::PdmField<bool> m_addWaterDepth; caf::PdmField<bool> m_addWaterDepth;
}; };

View File

@ -23,7 +23,7 @@
/// ///
//================================================================================================== //==================================================================================================
CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig"); CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig" );
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
@ -31,7 +31,6 @@ CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig"
RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig() RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig()
: RimNameConfig() : RimNameConfig()
{ {
CAF_PDM_InitObject("Well Log Rft Curve Name Generator", "", "", ""); CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" );
m_customName = "Rft Curve"; m_customName = "Rft Curve";
} }

View File

@ -31,4 +31,3 @@ class RimWellLogRftCurveNameConfig : public RimNameConfig
public: public:
RimWellLogRftCurveNameConfig(); RimWellLogRftCurveNameConfig();
}; };

View File

@ -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,87 +38,82 @@
#include <QLabel> #include <QLabel>
#include <QMenu> #include <QMenu>
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent) RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent )
: RiuWellLogPlot(plotDefinition, parent) : RiuWellLogPlot( plotDefinition, parent )
{ {
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 );
new RiuPlotObjectPicker(m_plotTitle, m_plotDefinition); new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
mainLayout->addWidget(m_plotTitle, 0, Qt::AlignCenter); mainLayout->addWidget( m_plotTitle, 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 );
RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>(m_plotDefinition.p()); RimWellAllocationPlot* wellAllocationPlot = dynamic_cast<RimWellAllocationPlot*>( m_plotDefinition.p() );
new RiuPlotObjectPicker(m_legendWidget, wellAllocationPlot->plotLegend()); new RiuPlotObjectPicker( m_legendWidget, wellAllocationPlot->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 = wellAllocationPlot->totalWellFlowPlot()->createViewWidget(this); QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget( this );
new RiuPlotObjectPicker(totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot()); new RiuPlotObjectPicker( totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot() );
new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder); new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder );
rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop); rightColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop );
rightColumnLayout->addWidget(wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop); rightColumnLayout->addWidget( wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ),
Qt::AlignTop );
rightColumnLayout->addStretch(); rightColumnLayout->addStretch();
QWidget* wellFlowWidget = m_plotDefinition->createPlotWidget(); QWidget* wellFlowWidget = m_plotDefinition->createPlotWidget();
plotWidgetsLayout->addWidget(wellFlowWidget); plotWidgetsLayout->addWidget( wellFlowWidget );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellAllocationPlot::~RiuWellAllocationPlot() RiuWellAllocationPlot::~RiuWellAllocationPlot() {}
{
}
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
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();
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -127,30 +122,29 @@ 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() );
} }
} }
@ -159,5 +153,5 @@ void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QSize RiuWellAllocationPlot::sizeHint() const QSize RiuWellAllocationPlot::sizeHint() const
{ {
return QSize(0, 0); return QSize( 0, 0 );
} }

View File

@ -24,16 +24,17 @@
#include "qwt_plot.h" #include "qwt_plot.h"
#include <QPointer>
#include <QFrame> #include <QFrame>
#include <QPointer>
class RimWellAllocationPlot; class RimWellAllocationPlot;
class RiuNightchartsWidget; class RiuNightchartsWidget;
class QLabel; class QLabel;
namespace cvf { namespace cvf
class Color3f; {
class Color3f;
} }
//================================================================================================== //==================================================================================================
@ -44,19 +45,20 @@ namespace cvf {
class RiuWellAllocationPlot : public RiuWellLogPlot class RiuWellAllocationPlot : public RiuWellLogPlot
{ {
Q_OBJECT; Q_OBJECT;
public: public:
RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr); RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellAllocationPlot() override; ~RiuWellAllocationPlot() override;
void showLegend(bool doShow); void showLegend( bool doShow );
void addLegendItem(const QString& name, const cvf::Color3f& color, float value); void addLegendItem( const QString& name, const cvf::Color3f& color, float value );
void clearLegend(); 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:
QPointer<RiuNightchartsWidget> m_legendWidget; QPointer<RiuNightchartsWidget> m_legendWidget;

View File

@ -30,8 +30,8 @@
#include "RiuPlotObjectPicker.h" #include "RiuPlotObjectPicker.h"
#include "RiuWellLogTrack.h" #include "RiuWellLogTrack.h"
#include "cafSelectionManager.h"
#include "cafCmdFeatureMenuBuilder.h" #include "cafCmdFeatureMenuBuilder.h"
#include "cafSelectionManager.h"
#include "cvfAssert.h" #include "cvfAssert.h"
@ -50,34 +50,35 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent) RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent )
: QWidget(parent), m_scheduleUpdateChildrenLayoutTimer(nullptr) : QWidget( parent )
, m_scheduleUpdateChildrenLayoutTimer( nullptr )
{ {
Q_ASSERT(plotDefinition); Q_ASSERT( plotDefinition );
m_plotDefinition = plotDefinition; m_plotDefinition = plotDefinition;
QPalette newPalette(palette()); QPalette newPalette( palette() );
newPalette.setColor(QPalette::Background, Qt::white); newPalette.setColor( QPalette::Background, Qt::white );
setPalette(newPalette); setPalette( newPalette );
setAutoFillBackground(true); setAutoFillBackground( true );
m_plotTitle = new QLabel("PLOT TITLE HERE", this); m_plotTitle = new QLabel( "PLOT TITLE HERE", this );
QFont font = m_plotTitle->font(); QFont font = m_plotTitle->font();
font.setPointSize(14); font.setPointSize( 14 );
font.setBold(true); font.setBold( true );
m_plotTitle->setFont(font); m_plotTitle->setFont( font );
m_plotTitle->hide(); m_plotTitle->hide();
m_scrollBar = new QScrollBar(this); m_scrollBar = new QScrollBar( this );
m_scrollBar->setOrientation(Qt::Vertical); m_scrollBar->setOrientation( Qt::Vertical );
m_scrollBar->setVisible(true); m_scrollBar->setVisible( true );
new RiuPlotObjectPicker(m_plotTitle, m_plotDefinition); new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition );
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding );
setFocusPolicy(Qt::StrongFocus); setFocusPolicy( Qt::StrongFocus );
connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int))); connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -85,7 +86,7 @@ RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
RiuWellLogPlot::~RiuWellLogPlot() RiuWellLogPlot::~RiuWellLogPlot()
{ {
if (m_plotDefinition) if ( m_plotDefinition )
{ {
m_plotDefinition->detachAllCurves(); m_plotDefinition->detachAllCurves();
} }
@ -94,46 +95,50 @@ RiuWellLogPlot::~RiuWellLogPlot()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::addTrackPlot(RiuWellLogTrack* trackPlot) void RiuWellLogPlot::addTrackPlot( RiuWellLogTrack* trackPlot )
{ {
// Insert the plot to the left of the scroll bar // Insert the plot to the left of the scroll bar
insertTrackPlot(trackPlot, m_trackPlots.size()); insertTrackPlot( trackPlot, m_trackPlots.size() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index) void RiuWellLogPlot::insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index )
{ {
trackPlot->setParent(this); trackPlot->setParent( this );
m_trackPlots.insert(static_cast<int>(index), trackPlot); m_trackPlots.insert( static_cast<int>( index ), trackPlot );
QwtLegend* legend = new QwtLegend(this); QwtLegend* legend = new QwtLegend( this );
int legendColumns = 1; int legendColumns = 1;
if (m_plotDefinition->areTrackLegendsHorizontal()) if ( m_plotDefinition->areTrackLegendsHorizontal() )
{ {
legendColumns = 0; // unlimited legendColumns = 0; // unlimited
} }
legend->setMaxColumns(legendColumns); legend->setMaxColumns( legendColumns );
legend->horizontalScrollBar()->setVisible(false); legend->horizontalScrollBar()->setVisible( false );
legend->verticalScrollBar()->setVisible(false); legend->verticalScrollBar()->setVisible( false );
legend->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(updateLegend(const QVariant &, const QList< QwtLegendData > &))); legend->connect( trackPlot,
legend->contentsWidget()->layout()->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); SIGNAL( legendDataChanged( const QVariant&, const QList<QwtLegendData>& ) ),
m_legends.insert(static_cast<int>(index), legend); SLOT( updateLegend( const QVariant&, const QList<QwtLegendData>& ) ) );
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())); this->connect( trackPlot,
SIGNAL( legendDataChanged( const QVariant&, const QList<QwtLegendData>& ) ),
SLOT( scheduleUpdateChildrenLayout() ) );
if (!m_plotDefinition->areTrackLegendsVisible()) if ( !m_plotDefinition->areTrackLegendsVisible() )
{ {
legend->hide(); legend->hide();
} }
trackPlot->updateLegend(); trackPlot->updateLegend();
if (trackPlot->isRimTrackVisible()) if ( trackPlot->isRimTrackVisible() )
{ {
trackPlot->show(); trackPlot->show();
} }
@ -146,41 +151,41 @@ void RiuWellLogPlot::insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::removeTrackPlot(RiuWellLogTrack* trackPlot) void RiuWellLogPlot::removeTrackPlot( RiuWellLogTrack* trackPlot )
{ {
if (!trackPlot) return; if ( !trackPlot ) return;
int trackIdx = m_trackPlots.indexOf(trackPlot); int trackIdx = m_trackPlots.indexOf( trackPlot );
CVF_ASSERT(trackIdx >= 0); CVF_ASSERT( trackIdx >= 0 );
m_trackPlots.removeAt(trackIdx); m_trackPlots.removeAt( trackIdx );
trackPlot->setParent(nullptr); trackPlot->setParent( nullptr );
QwtLegend* legend = m_legends[trackIdx]; QwtLegend* legend = m_legends[trackIdx];
m_legends.removeAt(trackIdx); m_legends.removeAt( trackIdx );
delete legend; delete legend;
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setDepthZoomAndReplot(double minDepth, double maxDepth) void RiuWellLogPlot::setDepthZoomAndReplot( double minDepth, double maxDepth )
{ {
for (int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++) for ( int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++ )
{ {
m_trackPlots[tpIdx]->setDepthZoom(minDepth, maxDepth); m_trackPlots[tpIdx]->setDepthZoom( minDepth, maxDepth );
m_trackPlots[tpIdx]->replot(); m_trackPlots[tpIdx]->replot();
} }
updateScrollBar(minDepth, maxDepth); updateScrollBar( minDepth, maxDepth );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::setPlotTitle(const QString& plotTitle) void RiuWellLogPlot::setPlotTitle( const QString& plotTitle )
{ {
m_plotTitle->setText(plotTitle); m_plotTitle->setText( plotTitle );
this->updateChildrenLayout(); this->updateChildrenLayout();
} }
@ -191,20 +196,20 @@ QSize RiuWellLogPlot::preferredSize() const
{ {
int titleWidth = 0; int titleWidth = 0;
int titleHeight = 0; int titleHeight = 0;
if (m_plotTitle && m_plotTitle->isVisible()) if ( m_plotTitle && m_plotTitle->isVisible() )
{ {
titleWidth = m_plotTitle->width(); titleWidth = m_plotTitle->width();
titleHeight = m_plotTitle->height() + 10; titleHeight = m_plotTitle->height() + 10;
} }
int sumTrackWidth = 0; int sumTrackWidth = 0;
int maxTrackHeight = 0; int maxTrackHeight = 0;
for (QPointer<RiuWellLogTrack> track : m_trackPlots) for ( QPointer<RiuWellLogTrack> track : m_trackPlots )
{ {
sumTrackWidth += track->width(); sumTrackWidth += track->width();
maxTrackHeight = std::max(maxTrackHeight, track->height()); maxTrackHeight = std::max( maxTrackHeight, track->height() );
} }
return QSize(std::max(titleWidth, sumTrackWidth), titleHeight + maxTrackHeight); return QSize( std::max( titleWidth, sumTrackWidth ), titleHeight + maxTrackHeight );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -226,21 +231,21 @@ void RiuWellLogPlot::hideTitle()
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event) void RiuWellLogPlot::contextMenuEvent( QContextMenuEvent* event )
{ {
QMenu menu; QMenu menu;
caf::CmdFeatureMenuBuilder menuBuilder; caf::CmdFeatureMenuBuilder menuBuilder;
caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition()); caf::SelectionManager::instance()->setSelectedItem( ownerPlotDefinition() );
menuBuilder << "RicShowPlotDataFeature"; menuBuilder << "RicShowPlotDataFeature";
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() );
} }
} }
@ -249,52 +254,52 @@ void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
QSize RiuWellLogPlot::sizeHint() const QSize RiuWellLogPlot::sizeHint() const
{ {
return QSize(1, 1); return QSize( 1, 1 );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::keyPressEvent(QKeyEvent* keyEvent) void RiuWellLogPlot::keyPressEvent( QKeyEvent* keyEvent )
{ {
m_plotDefinition->handleKeyPressEvent(keyEvent); m_plotDefinition->handleKeyPressEvent( keyEvent );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateScrollBar(double minDepth, double maxDepth) void RiuWellLogPlot::updateScrollBar( double minDepth, double maxDepth )
{ {
double availableMinDepth; double availableMinDepth;
double availableMaxDepth; double availableMaxDepth;
m_plotDefinition->availableDepthRange(&availableMinDepth, &availableMaxDepth); m_plotDefinition->availableDepthRange( &availableMinDepth, &availableMaxDepth );
availableMaxDepth += 0.01*(availableMaxDepth-availableMinDepth); availableMaxDepth += 0.01 * ( availableMaxDepth - availableMinDepth );
double visibleDepth = maxDepth - minDepth; double visibleDepth = maxDepth - minDepth;
m_scrollBar->blockSignals(true); m_scrollBar->blockSignals( true );
{ {
m_scrollBar->setRange((int) availableMinDepth, (int) ((availableMaxDepth - visibleDepth))); m_scrollBar->setRange( (int)availableMinDepth, (int)( ( availableMaxDepth - visibleDepth ) ) );
m_scrollBar->setPageStep((int) visibleDepth); m_scrollBar->setPageStep( (int)visibleDepth );
m_scrollBar->setValue((int) minDepth); m_scrollBar->setValue( (int)minDepth );
m_scrollBar->setVisible(true); m_scrollBar->setVisible( true );
} }
m_scrollBar->blockSignals(false); m_scrollBar->blockSignals( false );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::slotSetMinDepth(int value) void RiuWellLogPlot::slotSetMinDepth( int value )
{ {
double minimumDepth; double minimumDepth;
double maximumDepth; double maximumDepth;
m_plotDefinition->depthZoomMinMax(&minimumDepth, &maximumDepth); m_plotDefinition->depthZoomMinMax( &minimumDepth, &maximumDepth );
double delta = value - minimumDepth; double delta = value - minimumDepth;
m_plotDefinition->setDepthZoomMinMax(minimumDepth + delta, maximumDepth + delta); m_plotDefinition->setDepthZoomMinMax( minimumDepth + delta, maximumDepth + delta );
m_plotDefinition->setDepthAutoZoom(false); m_plotDefinition->setDepthAutoZoom( false );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
@ -316,36 +321,36 @@ RimViewWindow* RiuWellLogPlot::ownerViewWindow() const
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::resizeEvent(QResizeEvent *event) void RiuWellLogPlot::resizeEvent( QResizeEvent* event )
{ {
int height = event->size().height(); int height = event->size().height();
int width = event->size().width(); int width = event->size().width();
placeChildWidgets(height, width); placeChildWidgets( height, width );
QWidget::resizeEvent(event); QWidget::resizeEvent( event );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWidth) const std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame( int frameWidth ) const
{ {
int trackCount = m_trackPlots.size(); int trackCount = m_trackPlots.size();
int visibleTrackCount = 0; int visibleTrackCount = 0;
int firstTrackAxisOffset = 0; // Account for first track having the y-axis labels and markers int firstTrackAxisOffset = 0; // Account for first track having the y-axis labels and markers
for (int tIdx = 0; tIdx < trackCount; ++tIdx) for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
if (visibleTrackCount == 0) if ( visibleTrackCount == 0 )
{ {
firstTrackAxisOffset = static_cast<int>(m_trackPlots[tIdx]->plotLayout()->canvasRect().left()); firstTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
} }
else if (visibleTrackCount == 1) 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 // 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()); int otherTrackAxisOffset = static_cast<int>( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() );
firstTrackAxisOffset -= otherTrackAxisOffset; firstTrackAxisOffset -= otherTrackAxisOffset;
} }
++visibleTrackCount; ++visibleTrackCount;
@ -353,38 +358,38 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWid
} }
int scrollBarWidth = 0; int scrollBarWidth = 0;
if (m_scrollBar->isVisible()) scrollBarWidth = m_scrollBar->sizeHint().width(); if ( m_scrollBar->isVisible() ) scrollBarWidth = m_scrollBar->sizeHint().width();
std::map<int, int> trackWidths; std::map<int, int> trackWidths;
if (visibleTrackCount) if ( visibleTrackCount )
{ {
int totalTrackWidth = (frameWidth - firstTrackAxisOffset - scrollBarWidth); int totalTrackWidth = ( frameWidth - firstTrackAxisOffset - scrollBarWidth );
int trackWidthExtra = (frameWidth - firstTrackAxisOffset - scrollBarWidth) % visibleTrackCount; int trackWidthExtra = ( frameWidth - firstTrackAxisOffset - scrollBarWidth ) % visibleTrackCount;
int totalWidthWeights = 0; int totalWidthWeights = 0;
for (int tIdx = 0; tIdx < trackCount; ++tIdx) for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
totalWidthWeights += m_trackPlots[tIdx]->widthScaleFactor(); totalWidthWeights += m_trackPlots[tIdx]->widthScaleFactor();
} }
} }
bool firstVisible = true; bool firstVisible = true;
for (int tIdx = 0; tIdx < trackCount; ++tIdx) for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
int realTrackWidth = (totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor()) / totalWidthWeights; int realTrackWidth = ( totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor() ) / totalWidthWeights;
if (firstVisible) if ( firstVisible )
{ {
realTrackWidth += firstTrackAxisOffset; realTrackWidth += firstTrackAxisOffset;
firstVisible = false; firstVisible = false;
} }
if (trackWidthExtra > 0) if ( trackWidthExtra > 0 )
{ {
realTrackWidth += 1; realTrackWidth += 1;
--trackWidthExtra; --trackWidthExtra;
@ -401,98 +406,102 @@ std::map<int, int> RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWid
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::placeChildWidgets(int frameHeight, int frameWidth) void RiuWellLogPlot::placeChildWidgets( int frameHeight, int frameWidth )
{ {
CVF_ASSERT(m_legends.size() == m_trackPlots.size()); CVF_ASSERT( m_legends.size() == m_trackPlots.size() );
positionTitle(frameWidth); positionTitle( frameWidth );
const int trackPadding = 2; const int trackPadding = 2;
std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame(frameWidth); std::map<int, int> trackWidths = calculateTrackWidthsToMatchFrame( frameWidth );
size_t visibleTrackCount = trackWidths.size(); size_t visibleTrackCount = trackWidths.size();
int maxLegendHeight = 0; int maxLegendHeight = 0;
if (m_plotDefinition && m_plotDefinition->areTrackLegendsVisible()) if ( m_plotDefinition && m_plotDefinition->areTrackLegendsVisible() )
{ {
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx ) for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{ {
if ( m_trackPlots[tIdx]->isVisible() ) if ( m_trackPlots[tIdx]->isVisible() )
{ {
int legendHeight = m_legends[tIdx]->heightForWidth(trackWidths[tIdx] - 2 * trackPadding); int legendHeight = m_legends[tIdx]->heightForWidth( trackWidths[tIdx] - 2 * trackPadding );
if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight; if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight;
} }
} }
} }
int titleHeight = 0; int titleHeight = 0;
if (m_plotTitle && m_plotTitle->isVisible()) if ( m_plotTitle && m_plotTitle->isVisible() )
{ {
titleHeight = m_plotTitle->height() + 2; titleHeight = m_plotTitle->height() + 2;
} }
int trackHeight = frameHeight - maxLegendHeight - titleHeight; int trackHeight = frameHeight - maxLegendHeight - titleHeight;
int trackX = 0; int trackX = 0;
if (visibleTrackCount) if ( visibleTrackCount )
{ {
int maxCanvasOffset = 0; int maxCanvasOffset = 0;
for (int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx) for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
// Hack to align QWT plots. See below. // Hack to align QWT plots. See below.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect(); QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
maxCanvasOffset = std::max(maxCanvasOffset, static_cast<int>(canvasRect.top())); maxCanvasOffset = std::max( maxCanvasOffset, static_cast<int>( canvasRect.top() ) );
} }
} }
for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx )
for (int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx)
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
int adjustedVerticalPosition = titleHeight + maxLegendHeight + 10; int adjustedVerticalPosition = titleHeight + maxLegendHeight + 10;
int adjustedTrackHeight = trackHeight; int adjustedTrackHeight = trackHeight;
{ {
// Hack to align QWT plots which doesn't have an x-axis with the other tracks. // 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. // Since they are missing the axis, QWT will shift them upwards.
// So we shift the plot downwards and resize to match the others. // So we shift the plot downwards and resize to match the others.
// TODO: Look into subclassing QwtPlotLayout instead. // TODO: Look into subclassing QwtPlotLayout instead.
QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect(); QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect();
int myCanvasOffset = static_cast<int>(canvasRect.top()); int myCanvasOffset = static_cast<int>( canvasRect.top() );
int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin(QwtPlot::xTop); int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop );
int canvasShift = std::max(0, maxCanvasOffset - myCanvasOffset); int canvasShift = std::max( 0, maxCanvasOffset - myCanvasOffset );
adjustedVerticalPosition += canvasShift - myMargins; adjustedVerticalPosition += canvasShift - myMargins;
adjustedTrackHeight -= canvasShift; adjustedTrackHeight -= canvasShift;
} }
int realTrackWidth = trackWidths[tIdx]; int realTrackWidth = trackWidths[tIdx];
m_legends[tIdx]->setGeometry(trackX + trackPadding, titleHeight, realTrackWidth - 2 * trackPadding, maxLegendHeight); m_legends[tIdx]->setGeometry( trackX + trackPadding,
m_trackPlots[tIdx]->setGeometry(trackX + trackPadding, adjustedVerticalPosition, realTrackWidth - 2 * trackPadding, adjustedTrackHeight); titleHeight,
realTrackWidth - 2 * trackPadding,
maxLegendHeight );
m_trackPlots[tIdx]->setGeometry( trackX + trackPadding,
adjustedVerticalPosition,
realTrackWidth - 2 * trackPadding,
adjustedTrackHeight );
trackX += realTrackWidth; trackX += realTrackWidth;
} }
} }
} }
if (m_scrollBar->isVisible()) if ( m_scrollBar->isVisible() )
{ {
m_scrollBar->setGeometry(trackX, titleHeight + maxLegendHeight, m_scrollBar->sizeHint().width(), trackHeight); m_scrollBar->setGeometry( trackX, titleHeight + maxLegendHeight, m_scrollBar->sizeHint().width(), trackHeight );
} }
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::positionTitle(int frameWidth) void RiuWellLogPlot::positionTitle( int frameWidth )
{ {
if (m_plotDefinition && m_plotDefinition->isPlotTitleVisible()) if ( m_plotDefinition && m_plotDefinition->isPlotTitleVisible() )
{ {
int textWidth = m_plotTitle->sizeHint().width(); int textWidth = m_plotTitle->sizeHint().width();
m_plotTitle->setGeometry(frameWidth/2 - textWidth/2, 0, textWidth, m_plotTitle->sizeHint().height()); m_plotTitle->setGeometry( frameWidth / 2 - textWidth / 2, 0, textWidth, m_plotTitle->sizeHint().height() );
m_plotTitle->show(); m_plotTitle->show();
} }
else else
@ -506,21 +515,21 @@ void RiuWellLogPlot::positionTitle(int frameWidth)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::updateChildrenLayout() void RiuWellLogPlot::updateChildrenLayout()
{ {
int trackCount = m_trackPlots.size(); int trackCount = m_trackPlots.size();
int numTracksAlreadyShown = 0; int numTracksAlreadyShown = 0;
for (int tIdx = 0; tIdx < trackCount; ++tIdx) for ( int tIdx = 0; tIdx < trackCount; ++tIdx )
{ {
if (m_trackPlots[tIdx]->isVisible()) if ( m_trackPlots[tIdx]->isVisible() )
{ {
int legendColumns = 1; int legendColumns = 1;
if (m_plotDefinition->areTrackLegendsHorizontal()) if ( m_plotDefinition->areTrackLegendsHorizontal() )
{ {
legendColumns = 0; // unlimited legendColumns = 0; // unlimited
} }
m_legends[tIdx]->setMaxColumns(legendColumns); m_legends[tIdx]->setMaxColumns( legendColumns );
m_legends[tIdx]->show(); m_legends[tIdx]->show();
m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle(numTracksAlreadyShown == 0); m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle( numTracksAlreadyShown == 0 );
numTracksAlreadyShown++; numTracksAlreadyShown++;
} }
else else
@ -529,13 +538,13 @@ void RiuWellLogPlot::updateChildrenLayout()
} }
} }
placeChildWidgets(this->height(), this->width()); placeChildWidgets( this->height(), this->width() );
} }
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::showEvent(QShowEvent *) void RiuWellLogPlot::showEvent( QShowEvent* )
{ {
updateChildrenLayout(); updateChildrenLayout();
} }
@ -543,9 +552,9 @@ void RiuWellLogPlot::showEvent(QShowEvent *)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::changeEvent(QEvent *event) void RiuWellLogPlot::changeEvent( QEvent* event )
{ {
if (event->type() == QEvent::WindowStateChange) if ( event->type() == QEvent::WindowStateChange )
{ {
updateChildrenLayout(); updateChildrenLayout();
} }
@ -558,15 +567,15 @@ void RiuWellLogPlot::changeEvent(QEvent *event)
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
void RiuWellLogPlot::scheduleUpdateChildrenLayout() void RiuWellLogPlot::scheduleUpdateChildrenLayout()
{ {
if (!m_scheduleUpdateChildrenLayoutTimer) if ( !m_scheduleUpdateChildrenLayoutTimer )
{ {
m_scheduleUpdateChildrenLayoutTimer = new QTimer(this); m_scheduleUpdateChildrenLayoutTimer = new QTimer( this );
connect(m_scheduleUpdateChildrenLayoutTimer, SIGNAL(timeout()), this, SLOT(updateChildrenLayout())); connect( m_scheduleUpdateChildrenLayoutTimer, SIGNAL( timeout() ), this, SLOT( updateChildrenLayout() ) );
} }
if (!m_scheduleUpdateChildrenLayoutTimer->isActive()) if ( !m_scheduleUpdateChildrenLayoutTimer->isActive() )
{ {
m_scheduleUpdateChildrenLayoutTimer->setSingleShot(true); m_scheduleUpdateChildrenLayoutTimer->setSingleShot( true );
m_scheduleUpdateChildrenLayoutTimer->start(100); m_scheduleUpdateChildrenLayoutTimer->start( 100 );
} }
} }

View File

@ -47,45 +47,44 @@ class RiuWellLogPlot : public QWidget, public RiuInterfaceToViewWindow
Q_OBJECT Q_OBJECT
public: public:
RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent = nullptr); RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent = nullptr );
~RiuWellLogPlot() override; ~RiuWellLogPlot() override;
RimWellLogPlot* ownerPlotDefinition(); RimWellLogPlot* ownerPlotDefinition();
RimViewWindow* ownerViewWindow() const override; RimViewWindow* ownerViewWindow() const override;
void addTrackPlot(RiuWellLogTrack* trackPlot); void addTrackPlot( RiuWellLogTrack* trackPlot );
void insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index); void insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index );
void removeTrackPlot(RiuWellLogTrack* trackPlot); void removeTrackPlot( RiuWellLogTrack* trackPlot );
void setDepthZoomAndReplot(double minDepth, double maxDepth); void setDepthZoomAndReplot( double minDepth, double maxDepth );
void setPlotTitle(const QString& plotTitle); void setPlotTitle( const QString& plotTitle );
virtual QSize preferredSize() const; virtual QSize preferredSize() const;
void showTitle(); void showTitle();
void hideTitle(); void hideTitle();
public slots: public slots:
void updateChildrenLayout(); void updateChildrenLayout();
protected: protected:
void resizeEvent(QResizeEvent *event) override; void resizeEvent( QResizeEvent* event ) override;
void showEvent(QShowEvent *) override; void showEvent( QShowEvent* ) override;
void changeEvent(QEvent *) override; void changeEvent( QEvent* ) override;
void contextMenuEvent(QContextMenuEvent *) override; void contextMenuEvent( QContextMenuEvent* ) override;
QSize sizeHint() const override; QSize sizeHint() const override;
void keyPressEvent( QKeyEvent* keyEvent ) override;
void keyPressEvent(QKeyEvent* keyEvent) override;
private: private:
void updateScrollBar(double minDepth, double maxDepth); void updateScrollBar( double minDepth, double maxDepth );
std::map<int, int> calculateTrackWidthsToMatchFrame(int frameWidth) const; std::map<int, int> calculateTrackWidthsToMatchFrame( int frameWidth ) const;
void placeChildWidgets(int frameHeight, int frameWidth); void placeChildWidgets( int frameHeight, int frameWidth );
void positionTitle(int frameWidth); void positionTitle( int frameWidth );
private slots: private slots:
void slotSetMinDepth(int value); void slotSetMinDepth( int value );
void scheduleUpdateChildrenLayout(); void scheduleUpdateChildrenLayout();
protected: protected:
QPointer<QLabel> m_plotTitle; QPointer<QLabel> m_plotTitle;
@ -95,4 +94,3 @@ protected:
caf::PdmPointer<RimWellLogPlot> m_plotDefinition; caf::PdmPointer<RimWellLogPlot> m_plotDefinition;
QTimer* m_scheduleUpdateChildrenLayoutTimer; QTimer* m_scheduleUpdateChildrenLayoutTimer;
}; };