From de8a5a59f352cd4468d5c4fa9d9d2113a68820dd Mon Sep 17 00:00:00 2001 From: Gaute Lindkvist Date: Fri, 6 Sep 2019 13:17:36 +0200 Subject: [PATCH] Clang-format changed files --- .../WellLogCommands/RicNewPltPlotFeature.cpp | 114 ++- .../WellLogCommands/RicNewRftPlotFeature.cpp | 55 +- .../Flow/RimWellAllocationPlot.cpp | 579 ++++++------ .../Flow/RimWellAllocationPlot.h | 119 +-- .../ProjectDataModel/Flow/RimWellPltPlot.cpp | 731 ++++++++------- .../ProjectDataModel/Flow/RimWellPltPlot.h | 94 +- .../ProjectDataModel/Flow/RimWellRftPlot.cpp | 754 +++++++-------- .../ProjectDataModel/Flow/RimWellRftPlot.h | 39 +- .../GridCrossPlots/RimGridCrossPlot.cpp | 484 +++++----- .../GridCrossPlots/RimGridCrossPlot.h | 85 +- .../RimGridCrossPlotDataSet.cpp | 863 +++++++++--------- .../GridCrossPlots/RimGridCrossPlotDataSet.h | 89 +- .../ProjectDataModel/Rim3dView.cpp | 690 +++++++------- .../Rim3dWellLogExtractionCurve.cpp | 345 +++---- .../Rim3dWellLogFileCurve.cpp | 137 ++- .../ProjectDataModel/Rim3dWellLogRftCurve.cpp | 137 +-- .../ProjectDataModel/RimNameConfig.cpp | 80 +- .../ProjectDataModel/RimNameConfig.h | 33 +- .../ProjectDataModel/RimViewNameConfig.cpp | 50 +- .../ProjectDataModel/RimViewNameConfig.h | 46 +- .../RimWellLogExtractionCurveNameConfig.cpp | 46 +- .../RimWellLogExtractionCurveNameConfig.h | 26 +- .../RimWellLogFileCurveNameConfig.cpp | 11 +- .../RimWellLogFileCurveNameConfig.h | 1 - .../ProjectDataModel/RimWellLogPlot.cpp | 659 ++++++------- .../ProjectDataModel/RimWellLogPlot.h | 172 ++-- .../RimWellLogPlotNameConfig.cpp | 43 +- .../RimWellLogPlotNameConfig.h | 16 +- .../RimWellLogRftCurveNameConfig.cpp | 11 +- .../RimWellLogRftCurveNameConfig.h | 1 - .../UserInterface/RiuWellAllocationPlot.cpp | 106 +-- .../UserInterface/RiuWellAllocationPlot.h | 30 +- .../UserInterface/RiuWellLogPlot.cpp | 377 ++++---- .../UserInterface/RiuWellLogPlot.h | 58 +- 34 files changed, 3612 insertions(+), 3469 deletions(-) diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp index b707fb358d..86c3104ea2 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewPltPlotFeature.cpp @@ -2,44 +2,44 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "RicNewPltPlotFeature.h" -#include "RicWellLogPlotCurveFeatureImpl.h" #include "RicNewWellLogPlotFeatureImpl.h" +#include "RicWellLogPlotCurveFeatureImpl.h" #include "RiaApplication.h" #include "RigWellLogCurveData.h" +#include "Rim3dView.h" +#include "RimEclipseResultCase.h" +#include "RimMainPlotCollection.h" +#include "RimPltPlotCollection.h" #include "RimProject.h" #include "RimSimWellInView.h" -#include "Rim3dView.h" #include "RimWellLogExtractionCurve.h" -#include "RimWellPltPlot.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" #include "RimWellPath.h" -#include "RimPltPlotCollection.h" -#include "RimMainPlotCollection.h" -#include "RimEclipseResultCase.h" +#include "RimWellPltPlot.h" -#include "RiuPlotMainWindowTools.h" #include "Riu3dSelectionManager.h" +#include "RiuPlotMainWindowTools.h" #include "cafSelectionManagerTools.h" @@ -47,99 +47,98 @@ #include - -CAF_CMD_SOURCE_INIT(RicNewPltPlotFeature, "RicNewPltPlotFeature"); +CAF_CMD_SOURCE_INIT( RicNewPltPlotFeature, "RicNewPltPlotFeature" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RicNewPltPlotFeature::isCommandEnabled() { - if (RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot()) return false; + if ( RicWellLogPlotCurveFeatureImpl::parentWellAllocationPlot() ) return false; - RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject(); - RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject(); + RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject(); + RimWellPath* selectedWellPath = caf::firstAncestorOfTypeFromSelectedObject(); bool enable = true; - if (selectedWellPath) + if ( selectedWellPath ) { - if (selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData(selectedWellPath)) + if ( selectedWellPath->wellPathGeometry() == nullptr && !RimWellPlotTools::hasFlowData( selectedWellPath ) ) { return false; } } - if (simWell != nullptr) + if ( simWell != nullptr ) { - RimProject* proj = RiaApplication::instance()->project(); - QString simWellName = simWell->name(); + RimProject* proj = RiaApplication::instance()->project(); + QString simWellName = simWell->name(); - RimWellPath* wellPath = proj->wellPathFromSimWellName(simWellName); - enable = wellPath != nullptr; + RimWellPath* wellPath = proj->wellPathFromSimWellName( simWellName ); + enable = wellPath != nullptr; } return enable; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RicNewPltPlotFeature::onActionTriggered(bool isChecked) +void RicNewPltPlotFeature::onActionTriggered( bool isChecked ) { RimProject* proj = RiaApplication::instance()->project(); RimPltPlotCollection* pltPlotColl = proj->mainPlotCollection()->pltPlotCollection(); - if (pltPlotColl) + if ( pltPlotColl ) { - QString wellPathName; - RimWellPath* wellPath = nullptr; + QString wellPathName; + RimWellPath* wellPath = nullptr; RimSimWellInView* eclipseWell = nullptr; - if ((wellPath = caf::firstAncestorOfTypeFromSelectedObject()) != nullptr) + if ( ( wellPath = caf::firstAncestorOfTypeFromSelectedObject() ) != nullptr ) { wellPathName = wellPath->name(); } - else if ((eclipseWell = caf::firstAncestorOfTypeFromSelectedObject()) != nullptr) + else if ( ( eclipseWell = caf::firstAncestorOfTypeFromSelectedObject() ) != nullptr ) { - wellPath = proj->wellPathFromSimWellName(eclipseWell->name()); - if (!wellPath ) return; + wellPath = proj->wellPathFromSimWellName( eclipseWell->name() ); + if ( !wellPath ) return; wellPathName = wellPath->name(); } - QString plotName = QString(RimWellPltPlot::plotNameFormatString()).arg(wellPathName); + QString plotName = QString( RimWellPltPlot::plotNameFormatString() ).arg( wellPathName ); RimWellPltPlot* pltPlot = new RimWellPltPlot(); - pltPlot->setCurrentWellName(wellPathName); + pltPlot->setCurrentWellName( wellPathName ); RimWellLogTrack* plotTrack = new RimWellLogTrack(); - pltPlot->addTrack(plotTrack); - plotTrack->setDescription(QString("Track %1").arg(pltPlot->trackCount())); + pltPlot->addTrack( plotTrack ); + plotTrack->setDescription( QString( "Track %1" ).arg( pltPlot->trackCount() ) ); - pltPlotColl->addPlot(pltPlot); - pltPlot->setDescription(plotName); + pltPlotColl->addPlot( pltPlot ); + pltPlot->setDescription( plotName ); - //pltPlot->applyInitialSelections(); + // pltPlot->applyInitialSelections(); pltPlot->loadDataAndUpdate(); pltPlotColl->updateConnectedEditors(); RiuPlotMainWindowTools::showPlotMainWindow(); - RiuPlotMainWindowTools::setExpanded(plotTrack); - RiuPlotMainWindowTools::selectAsCurrentItem(pltPlot); + RiuPlotMainWindowTools::setExpanded( plotTrack ); + RiuPlotMainWindowTools::selectAsCurrentItem( pltPlot ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RicNewPltPlotFeature::setupActionLook(QAction* actionToSetup) +void RicNewPltPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText("New PLT Plot"); - actionToSetup->setIcon(QIcon(":/WellFlowPlot16x16.png")); + actionToSetup->setText( "New PLT Plot" ); + actionToSetup->setIcon( QIcon( ":/WellFlowPlot16x16.png" ) ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellPath* RicNewPltPlotFeature::selectedWellPath() const { @@ -148,34 +147,33 @@ RimWellPath* RicNewPltPlotFeature::selectedWellPath() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell(int * branchIndex) const +RimSimWellInView* RicNewPltPlotFeature::selectedSimulationWell( int* branchIndex ) const { - RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem(Riu3dSelectionManager::RUI_TEMPORARY); - RiuSimWellSelectionItem* simWellSelItem = dynamic_cast(selItem); - if (simWellSelItem) + RiuSelectionItem* selItem = Riu3dSelectionManager::instance()->selectedItem( Riu3dSelectionManager::RUI_TEMPORARY ); + RiuSimWellSelectionItem* simWellSelItem = dynamic_cast( selItem ); + if ( simWellSelItem ) { - (*branchIndex) = static_cast(simWellSelItem->m_branchIndex); + ( *branchIndex ) = static_cast( simWellSelItem->m_branchIndex ); return simWellSelItem->m_simWell; } else { std::vector selection; - caf::SelectionManager::instance()->objectsByType(&selection); - (*branchIndex) = 0; + caf::SelectionManager::instance()->objectsByType( &selection ); + ( *branchIndex ) = 0; return selection.size() > 0 ? selection[0] : nullptr; } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RicNewPltPlotFeature::caseAvailable() const { std::vector cases; - RiaApplication::instance()->project()->allCases(cases); + RiaApplication::instance()->project()->allCases( cases ); return cases.size() > 0; } - diff --git a/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp b/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp index a341b30ba8..b2692b51d3 100644 --- a/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp +++ b/ApplicationCode/Commands/WellLogCommands/RicNewRftPlotFeature.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -37,18 +37,17 @@ #include - -CAF_CMD_SOURCE_INIT(RicNewRftPlotFeature, "RicNewRftPlotFeature"); +CAF_CMD_SOURCE_INIT( RicNewRftPlotFeature, "RicNewRftPlotFeature" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RicNewRftPlotFeature::isCommandEnabled() { RimRftPlotCollection* simWell = caf::firstAncestorOfTypeFromSelectedObject(); - if (simWell) return true; - - if (selectedWellName().isEmpty()) + if ( simWell ) return true; + + if ( selectedWellName().isEmpty() ) { return false; } @@ -57,58 +56,58 @@ bool RicNewRftPlotFeature::isCommandEnabled() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RicNewRftPlotFeature::onActionTriggered(bool isChecked) +void RicNewRftPlotFeature::onActionTriggered( bool isChecked ) { RimProject* proj = RiaApplication::instance()->project(); RimRftPlotCollection* rftPlotColl = proj->mainPlotCollection()->rftPlotCollection(); - if (rftPlotColl) + if ( rftPlotColl ) { QString wellName = selectedWellName(); - QString plotName = QString(RimWellRftPlot::plotNameFormatString()).arg(wellName); + QString plotName = QString( RimWellRftPlot::plotNameFormatString() ).arg( wellName ); RimWellRftPlot* rftPlot = new RimWellRftPlot(); - rftPlot->setSimWellOrWellPathName(wellName); + rftPlot->setSimWellOrWellPathName( wellName ); RimWellLogTrack* plotTrack = new RimWellLogTrack(); - rftPlot->addTrack(plotTrack); - plotTrack->setDescription(QString("Track %1").arg(rftPlot->trackCount())); + rftPlot->addTrack( plotTrack ); + plotTrack->setDescription( QString( "Track %1" ).arg( rftPlot->trackCount() ) ); - rftPlotColl->addPlot(rftPlot); - rftPlot->setDescription(plotName); + rftPlotColl->addPlot( rftPlot ); + rftPlot->setDescription( plotName ); rftPlot->applyInitialSelections(); rftPlot->loadDataAndUpdate(); rftPlotColl->updateConnectedEditors(); RiuPlotMainWindowTools::showPlotMainWindow(); - RiuPlotMainWindowTools::setExpanded(plotTrack); - RiuPlotMainWindowTools::selectAsCurrentItem(rftPlot); + RiuPlotMainWindowTools::setExpanded( plotTrack ); + RiuPlotMainWindowTools::selectAsCurrentItem( rftPlot ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RicNewRftPlotFeature::setupActionLook(QAction* actionToSetup) +void RicNewRftPlotFeature::setupActionLook( QAction* actionToSetup ) { - actionToSetup->setText("New RFT Plot"); - actionToSetup->setIcon(QIcon(":/FlowCharPlot16x16.png")); + actionToSetup->setText( "New RFT Plot" ); + actionToSetup->setIcon( QIcon( ":/FlowCharPlot16x16.png" ) ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RicNewRftPlotFeature::selectedWellName() { RimSimWellInView* simWell = caf::firstAncestorOfTypeFromSelectedObject(); - if (simWell) return simWell->name(); + if ( simWell ) return simWell->name(); RimWellPath* rimWellPath = caf::firstAncestorOfTypeFromSelectedObject(); - if (rimWellPath) return rimWellPath->name(); + if ( rimWellPath ) return rimWellPath->name(); return QString(); } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp index 641fe501e8..1fdc3f3ad6 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -24,107 +24,120 @@ #include "RigEclipseCaseData.h" #include "RigFlowDiagResultAddress.h" #include "RigFlowDiagResults.h" +#include "RigSimWellData.h" #include "RigSimulationWellCenterLineCalculator.h" #include "RigSimulationWellCoordsAndMD.h" -#include "RigSimWellData.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" #include "RimEclipseResultCase.h" #include "RimEclipseView.h" -#include "RimSimWellInViewCollection.h" #include "RimFlowDiagSolution.h" #include "RimProject.h" #include "RimSimWellInView.h" +#include "RimSimWellInViewCollection.h" #include "RimTofAccumulatedPhaseFractionsPlot.h" #include "RimTotalWellAllocationPlot.h" #include "RimWellAllocationPlotLegend.h" #include "RimWellFlowRateCurve.h" #include "RimWellLogFile.h" #include "RimWellLogPlot.h" -#include "RimWellPlotTools.h" #include "RimWellLogTrack.h" +#include "RimWellPlotTools.h" -#include "RiuWellLogPlot.h" #include "RiuPlotMainWindow.h" #include "RiuWellAllocationPlot.h" +#include "RiuWellLogPlot.h" #include "RiuWellLogTrack.h" -CAF_PDM_SOURCE_INIT(RimWellAllocationPlot, "WellAllocationPlot"); +CAF_PDM_SOURCE_INIT( RimWellAllocationPlot, "WellAllocationPlot" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- namespace caf { - -template<> +template <> void AppEnum::setUp() { - addItem(RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated"); - addItem(RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates"); - setDefault(RimWellAllocationPlot::ACCUMULATED); - -} + addItem( RimWellAllocationPlot::ACCUMULATED, "ACCUMULATED", "Accumulated" ); + addItem( RimWellAllocationPlot::INFLOW, "INFLOW", "Inflow Rates" ); + setDefault( RimWellAllocationPlot::ACCUMULATED ); } +} // namespace caf //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellAllocationPlot::RimWellAllocationPlot() : 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", "", "", ""); - m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", true, "Show Plot Title", "", "", "" ); + m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField(&m_branchDetection, "BranchDetection", true, "Branch Detection", "", - "Compute branches based on how simulation well cells are organized", ""); + CAF_PDM_InitField( &m_branchDetection, + "BranchDetection", + true, + "Branch Detection", + "", + "Compute branches based on how simulation well cells are organized", + "" ); - CAF_PDM_InitFieldNoDefault(&m_case, "CurveCase", "Case", "", "", ""); - m_case.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); + m_case.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitField(&m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", ""); - CAF_PDM_InitField(&m_wellName, "WellName", QString("None"), "Well", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_flowType, "FlowType", "Flow Type", "", "", ""); - CAF_PDM_InitField(&m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", ""); - CAF_PDM_InitField(&m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_accumulatedWellFlowPlot_OBSOLETE, "AccumulatedWellFlowPlot", "Accumulated Well Flow", "", "", ""); - m_accumulatedWellFlowPlot_OBSOLETE.uiCapability()->setUiHidden(true); + CAF_PDM_InitField( &m_timeStep, "PlotTimeStep", 0, "Time Step", "", "", "" ); + CAF_PDM_InitField( &m_wellName, "WellName", QString( "None" ), "Well", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowDiagSolution, "FlowDiagSolution", "Plot Type", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_flowType, "FlowType", "Flow Type", "", "", "" ); + CAF_PDM_InitField( &m_groupSmallContributions, "GroupSmallContributions", true, "Group Small Contributions", "", "", "" ); + CAF_PDM_InitField( &m_smallContributionsThreshold, "SmallContributionsThreshold", 0.005, "Threshold", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_accumulatedWellFlowPlot_OBSOLETE, + "AccumulatedWellFlowPlot", + "Accumulated Well Flow", + "", + "", + "" ); + m_accumulatedWellFlowPlot_OBSOLETE.uiCapability()->setUiHidden( true ); m_accumulatedWellFlowPlot_OBSOLETE = new RimWellLogPlot; - m_accumulatedWellFlowPlot_OBSOLETE->setDepthUnit(RiaDefines::UNIT_NONE); - m_accumulatedWellFlowPlot_OBSOLETE->setDepthType(RimWellLogPlot::CONNECTION_NUMBER); - m_accumulatedWellFlowPlot_OBSOLETE->setTrackLegendsVisible(false); - m_accumulatedWellFlowPlot_OBSOLETE->uiCapability()->setUiIconFromResourceString(":/WellFlowPlot16x16.png"); - m_accumulatedWellFlowPlot_OBSOLETE.xmlCapability()->setIOWritable(false); + m_accumulatedWellFlowPlot_OBSOLETE->setDepthUnit( RiaDefines::UNIT_NONE ); + m_accumulatedWellFlowPlot_OBSOLETE->setDepthType( RimWellLogPlot::CONNECTION_NUMBER ); + m_accumulatedWellFlowPlot_OBSOLETE->setTrackLegendsVisible( false ); + m_accumulatedWellFlowPlot_OBSOLETE->uiCapability()->setUiIconFromResourceString( ":/WellFlowPlot16x16.png" ); + m_accumulatedWellFlowPlot_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault(&m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", ""); - m_totalWellAllocationPlot.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_totalWellAllocationPlot, "TotalWellFlowPlot", "Total Well Flow", "", "", "" ); + m_totalWellAllocationPlot.uiCapability()->setUiHidden( true ); m_totalWellAllocationPlot = new RimTotalWellAllocationPlot; - CAF_PDM_InitFieldNoDefault(&m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", ""); - m_wellAllocationPlotLegend.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_wellAllocationPlotLegend, "WellAllocLegend", "Legend", "", "", "" ); + m_wellAllocationPlotLegend.uiCapability()->setUiHidden( true ); m_wellAllocationPlotLegend = new RimWellAllocationPlotLegend; - CAF_PDM_InitFieldNoDefault(&m_tofAccumulatedPhaseFractionsPlot, "TofAccumulatedPhaseFractionsPlot", "TOF Accumulated Phase Fractions", "", "", ""); - m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_tofAccumulatedPhaseFractionsPlot, + "TofAccumulatedPhaseFractionsPlot", + "TOF Accumulated Phase Fractions", + "", + "", + "" ); + m_tofAccumulatedPhaseFractionsPlot.uiCapability()->setUiHidden( true ); m_tofAccumulatedPhaseFractionsPlot = new RimTofAccumulatedPhaseFractionsPlot; - m_nameConfig->setCustomName("Well Allocation Plot"); + m_nameConfig->setCustomName( "Well Allocation Plot" ); this->setAsPlotMdiWindow(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellAllocationPlot::~RimWellAllocationPlot() { removeMdiWindowFromMdiArea(); - + delete m_totalWellAllocationPlot(); delete m_tofAccumulatedPhaseFractionsPlot(); @@ -132,16 +145,16 @@ RimWellAllocationPlot::~RimWellAllocationPlot() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellAllocationPlot::setFromSimulationWell(RimSimWellInView* simWell) +void RimWellAllocationPlot::setFromSimulationWell( RimSimWellInView* simWell ) { RimEclipseView* eclView; - simWell->firstAncestorOrThisOfType(eclView); + simWell->firstAncestorOrThisOfType( eclView ); RimEclipseResultCase* eclCase; - simWell->firstAncestorOrThisOfType(eclCase); + simWell->firstAncestorOrThisOfType( eclCase ); - m_case = eclCase; + m_case = eclCase; m_wellName = simWell->simWellData()->m_wellName; m_timeStep = eclView->currentTimeStep(); @@ -156,194 +169,200 @@ void RimWellAllocationPlot::setFromSimulationWell(RimSimWellInView* simWell) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::updateFromWell() { // Delete existing tracks { std::vector tracks; - descendantsIncludingThisOfType(tracks); + descendantsIncludingThisOfType( tracks ); - for (RimWellLogTrack* t : tracks) + for ( RimWellLogTrack* t : tracks ) { - removeTrack(t); + removeTrack( t ); delete t; } } - CVF_ASSERT(trackCount() == 0); + CVF_ASSERT( trackCount() == 0 ); QString description; - if (m_flowType() == ACCUMULATED) description = "Accumulated Flow"; - if (m_flowType() == INFLOW) description = "Inflow Rates"; + if ( m_flowType() == ACCUMULATED ) description = "Accumulated Flow"; + 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; - - // Set up the Accumulated Well Flow Calculator + if ( !simWellData ) return; - std::vector< std::vector > pipeBranchesCLCoords; - std::vector< std::vector > pipeBranchesCellIds; + // Set up the Accumulated Well Flow Calculator - RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame(m_case->eclipseCaseData(), - simWellData, - m_timeStep, - m_branchDetection, - true, - pipeBranchesCLCoords, - pipeBranchesCellIds); + std::vector> pipeBranchesCLCoords; + std::vector> pipeBranchesCellIds; - std::map* > tracerFractionCellValues = findRelevantTracerCellFractions(simWellData); + RigSimulationWellCenterLineCalculator::calculateWellPipeCenterlineFromWellFrame( m_case->eclipseCaseData(), + simWellData, + m_timeStep, + m_branchDetection, + true, + pipeBranchesCLCoords, + pipeBranchesCellIds ); - std::unique_ptr< RigAccWellFlowCalculator > wfCalculator; + std::map*> tracerFractionCellValues = findRelevantTracerCellFractions( + simWellData ); + + std::unique_ptr wfCalculator; double smallContributionThreshold = 0.0; - if (m_groupSmallContributions()) smallContributionThreshold = m_smallContributionsThreshold; + if ( m_groupSmallContributions() ) smallContributionThreshold = m_smallContributionsThreshold; if ( tracerFractionCellValues.size() ) { - bool isProducer = ( simWellData->wellProductionType(m_timeStep) == RigWellResultFrame::PRODUCER - || simWellData->wellProductionType(m_timeStep) == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ); - RigEclCellIndexCalculator cellIdxCalc(m_case->eclipseCaseData()->mainGrid(), m_case->eclipseCaseData()->activeCellInfo(RiaDefines::MATRIX_MODEL)); - wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, - pipeBranchesCellIds, - tracerFractionCellValues, - cellIdxCalc, - smallContributionThreshold, - isProducer)); + bool isProducer = ( simWellData->wellProductionType( m_timeStep ) == RigWellResultFrame::PRODUCER || + simWellData->wellProductionType( m_timeStep ) == + RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ); + RigEclCellIndexCalculator cellIdxCalc( m_case->eclipseCaseData()->mainGrid(), + m_case->eclipseCaseData()->activeCellInfo( RiaDefines::MATRIX_MODEL ) ); + wfCalculator.reset( new RigAccWellFlowCalculator( pipeBranchesCLCoords, + pipeBranchesCellIds, + tracerFractionCellValues, + cellIdxCalc, + smallContributionThreshold, + isProducer ) ); } - else + else { - if (pipeBranchesCLCoords.size() > 0) + if ( pipeBranchesCLCoords.size() > 0 ) { - wfCalculator.reset(new RigAccWellFlowCalculator(pipeBranchesCLCoords, - pipeBranchesCellIds, - smallContributionThreshold)); + wfCalculator.reset( + new RigAccWellFlowCalculator( pipeBranchesCLCoords, pipeBranchesCellIds, smallContributionThreshold ) ); } } auto depthType = this->depthType(); - if (depthType == RimWellLogPlot::MEASURED_DEPTH) return; + if ( depthType == RimWellLogPlot::MEASURED_DEPTH ) return; // Create tracks and curves from the calculated data 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 - if (pipeBranchesCellIds[brIdx].size() <= 3) continue; + if ( pipeBranchesCellIds[brIdx].size() <= 3 ) continue; RimWellLogTrack* plotTrack = new RimWellLogTrack(); - plotTrack->setDescription(QString("Branch %1").arg(brIdx + 1)); - plotTrack->setFormationsForCaseWithSimWellOnly(true); - plotTrack->setFormationBranchIndex((int)brIdx); + plotTrack->setDescription( QString( "Branch %1" ).arg( brIdx + 1 ) ); + plotTrack->setFormationsForCaseWithSimWellOnly( true ); + plotTrack->setFormationBranchIndex( (int)brIdx ); - addTrack(plotTrack); + addTrack( plotTrack ); + + const std::vector& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER + ? wfCalculator->connectionNumbersFromTop( brIdx ) + : depthType == RimWellLogPlot::PSEUDO_LENGTH + ? wfCalculator->pseudoLengthFromTop( brIdx ) + : depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH + ? wfCalculator->trueVerticalDepth( brIdx ) + : std::vector(); - const std::vector& depthValues = depthType == RimWellLogPlot::CONNECTION_NUMBER ? wfCalculator->connectionNumbersFromTop(brIdx) : - depthType == RimWellLogPlot::PSEUDO_LENGTH ? wfCalculator->pseudoLengthFromTop(brIdx) : - depthType == RimWellLogPlot::TRUE_VERTICAL_DEPTH ? wfCalculator->trueVerticalDepth(brIdx) : - std::vector(); - { std::vector tracerNames = wfCalculator->tracerNames(); - for (const QString& tracerName: tracerNames) + for ( const QString& tracerName : tracerNames ) { const std::vector* accFlow = nullptr; - if (depthType == RimWellLogPlot::CONNECTION_NUMBER) + if ( depthType == RimWellLogPlot::CONNECTION_NUMBER ) { - accFlow = &(m_flowType == ACCUMULATED ? - wfCalculator->accumulatedTracerFlowPrConnection(tracerName, brIdx): - wfCalculator->tracerFlowPrConnection(tracerName, brIdx)); + accFlow = &( m_flowType == ACCUMULATED + ? wfCalculator->accumulatedTracerFlowPrConnection( 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 ? - wfCalculator->accumulatedTracerFlowPrPseudoLength(tracerName, brIdx): - wfCalculator->tracerFlowPrPseudoLength(tracerName, brIdx)); + accFlow = &( m_flowType == ACCUMULATED + ? wfCalculator->accumulatedTracerFlowPrPseudoLength( 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... } } } - - updateWellFlowPlotXAxisTitle(plotTrack); - + updateWellFlowPlotXAxisTitle( plotTrack ); } - QString wellStatusText = QString("(%1)").arg(RimWellAllocationPlot::wellStatusTextForTimeStep(m_wellName, m_case, m_timeStep)); - - QString flowTypeText = m_flowDiagSolution() ? "Well Allocation": "Well Flow"; - setDescription(flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")"); - + QString wellStatusText = QString( "(%1)" ).arg( + RimWellAllocationPlot::wellStatusTextForTimeStep( m_wellName, m_case, m_timeStep ) ); + + QString flowTypeText = m_flowDiagSolution() ? "Well Allocation" : "Well Flow"; + setDescription( flowTypeText + ": " + m_wellName + " " + wellStatusText + ", " + + m_case->timeStepStrings()[m_timeStep] + " (" + m_case->caseUserDescription() + ")" ); + /// Pie chart m_totalWellAllocationPlot->clearSlices(); - if (allocationPlotWidget()) + if ( allocationPlotWidget() ) { allocationPlotWidget()->clearLegend(); } - if (wfCalculator) + if ( wfCalculator ) { - std::vector > totalTracerFractions = wfCalculator->totalTracerFractions() ; + std::vector> totalTracerFractions = wfCalculator->totalTracerFractions(); for ( const auto& tracerVal : totalTracerFractions ) { cvf::Color3f color; - if (m_flowDiagSolution) - color = m_flowDiagSolution->tracerColor(tracerVal.first); + if ( m_flowDiagSolution ) + color = m_flowDiagSolution->tracerColor( tracerVal.first ); 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); - if (allocationPlotWidget()) allocationPlotWidget()->addLegendItem(tracerVal.first, color, tracerPercent); + m_totalWellAllocationPlot->addSlice( 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(); updateConnectedEditors(); m_tofAccumulatedPhaseFractionsPlot->reloadFromWell(); m_tofAccumulatedPhaseFractionsPlot->updateConnectedEditors(); - if (allocationPlotWidget()) allocationPlotWidget()->updateGeometry(); + if ( allocationPlotWidget() ) allocationPlotWidget()->updateGeometry(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -std::map *> RimWellAllocationPlot::findRelevantTracerCellFractions(const RigSimWellData* simWellData) +std::map*> + RimWellAllocationPlot::findRelevantTracerCellFractions( const RigSimWellData* simWellData ) { - std::map *> tracerCellFractionValues; + std::map*> tracerCellFractionValues; - if ( m_flowDiagSolution && simWellData->hasWellResult(m_timeStep) ) + if ( m_flowDiagSolution && simWellData->hasWellResult( m_timeStep ) ) { RimFlowDiagSolution::TracerStatusType requestedTracerType = RimFlowDiagSolution::UNDEFINED; - const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType(m_timeStep); - if ( prodType == RigWellResultFrame::PRODUCER - || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) + const RigWellResultFrame::WellProductionType prodType = simWellData->wellProductionType( m_timeStep ); + if ( prodType == RigWellResultFrame::PRODUCER || prodType == RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE ) { requestedTracerType = RimFlowDiagSolution::INJECTOR; } - else + else { requestedTracerType = RimFlowDiagSolution::PRODUCER; } @@ -351,11 +370,14 @@ std::map *> RimWellAllocationPlot::findReleva std::vector tracerNames = m_flowDiagSolution->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()); - const std::vector* tracerCellFractions = m_flowDiagSolution->flowDiagResults()->resultValues(resAddr, m_timeStep); - if (tracerCellFractions) tracerCellFractionValues[tracerName] = tracerCellFractions; + RigFlowDiagResultAddress resAddr( RIG_FLD_CELL_FRACTION_RESNAME, + RigFlowDiagResultAddress::PHASE_ALL, + tracerName.toStdString() ); + const std::vector* tracerCellFractions = m_flowDiagSolution->flowDiagResults() + ->resultValues( resAddr, m_timeStep ); + if ( tracerCellFractions ) tracerCellFractionValues[tracerName] = tracerCellFractions; } } } @@ -364,18 +386,18 @@ std::map *> RimWellAllocationPlot::findReleva } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack) +void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack ) { - RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType(); - RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR : - RimWellLogFile::WELL_FLOW_COND_STANDARD; + RiaEclipseUnitTools::UnitSystem unitSet = m_case->eclipseCaseData()->unitsType(); + RimWellLogFile::WellFlowCondition condition = m_flowDiagSolution ? RimWellLogFile::WELL_FLOW_COND_RESERVOIR + : RimWellLogFile::WELL_FLOW_COND_STANDARD; - QString axisTitle = RimWellPlotTools::flowPlotAxisTitle(condition, unitSet); - plotTrack->setXAxisTitle(axisTitle); + QString axisTitle = RimWellPlotTools::flowPlotAxisTitle( condition, unitSet ); + plotTrack->setXAxisTitle( axisTitle ); - #if 0 +#if 0 if (m_flowDiagSolution) { QString unitText; @@ -417,72 +439,72 @@ void RimWellAllocationPlot::updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTr plotTrack->setXAxisTitle("Surface Flow Rate " + unitText); } #endif - - } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellAllocationPlot::addStackedCurve(const QString& tracerName, - const std::vector& depthValues, - const std::vector& accFlow, - RimWellLogTrack* plotTrack) +void RimWellAllocationPlot::addStackedCurve( const QString& tracerName, + const std::vector& depthValues, + const std::vector& accFlow, + RimWellLogTrack* plotTrack ) { RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValuesPrDepthValue(tracerName, depthValues, accFlow); + curve->setFlowValuesPrDepthValue( tracerName, depthValues, accFlow ); if ( m_flowDiagSolution ) { - curve->setColor(m_flowDiagSolution->tracerColor(tracerName)); + curve->setColor( m_flowDiagSolution->tracerColor( tracerName ) ); } 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"; - 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; - switch (prodType) + switch ( prodType ) { - case RigWellResultFrame::PRODUCER: - statusText = "Producer"; - break; - case RigWellResultFrame::OIL_INJECTOR: - statusText = "Oil Injector"; - break; - case RigWellResultFrame::GAS_INJECTOR: - statusText = "Gas Injector"; - break; - case RigWellResultFrame::WATER_INJECTOR: - statusText = "Water Injector"; - break; - case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: - break; - default: - break; + case RigWellResultFrame::PRODUCER: + statusText = "Producer"; + break; + case RigWellResultFrame::OIL_INJECTOR: + statusText = "Oil Injector"; + break; + case RigWellResultFrame::GAS_INJECTOR: + statusText = "Gas Injector"; + break; + case RigWellResultFrame::WATER_INJECTOR: + statusText = "Water Injector"; + break; + case RigWellResultFrame::UNDEFINED_PRODUCTION_TYPE: + break; + default: + break; } } } @@ -492,7 +514,7 @@ QString RimWellAllocationPlot::wellStatusTextForTimeStep(const QString& wellName } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot() { @@ -500,15 +522,15 @@ RimTotalWellAllocationPlot* RimWellAllocationPlot::totalWellFlowPlot() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RimTofAccumulatedPhaseFractionsPlot * RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot() +RimTofAccumulatedPhaseFractionsPlot* RimWellAllocationPlot::tofAccumulatedPhaseFractionsPlot() { return m_tofAccumulatedPhaseFractionsPlot(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- caf::PdmObject* RimWellAllocationPlot::plotLegend() { @@ -516,7 +538,7 @@ caf::PdmObject* RimWellAllocationPlot::plotLegend() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimEclipseResultCase* RimWellAllocationPlot::rimCase() { @@ -524,7 +546,7 @@ RimEclipseResultCase* RimWellAllocationPlot::rimCase() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- int RimWellAllocationPlot::timeStep() { @@ -532,72 +554,73 @@ int RimWellAllocationPlot::timeStep() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QList RimWellAllocationPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) +QList + RimWellAllocationPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) { - QList options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); + QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); - if (fieldNeedingOptions == &m_wellName) + if ( fieldNeedingOptions == &m_wellName ) { std::set sortedWellNames = this->findSortedWellNames(); - caf::QIconProvider simWellIcon(":/Well.png"); - for ( const QString& wname: sortedWellNames ) + caf::QIconProvider simWellIcon( ":/Well.png" ); + 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; - if (m_case && m_case->eclipseCaseData()) + if ( m_case && m_case->eclipseCaseData() ) { 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; - this->firstAncestorOrThisOfType(proj); - if (proj) + this->firstAncestorOrThisOfType( proj ); + if ( proj ) { std::vector 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 flowSols = m_case->flowDiagSolutions(); + // std::vector flowSols = m_case->flowDiagSolutions(); // 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())); //} - RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution(); - options.push_back(caf::PdmOptionItemInfo("Well Flow", nullptr)); - if (defaultFlowSolution) + RimFlowDiagSolution* defaultFlowSolution = m_case->defaultFlowDiagSolution(); + options.push_back( caf::PdmOptionItemInfo( "Well Flow", nullptr ) ); + if ( defaultFlowSolution ) { - options.push_back(caf::PdmOptionItemInfo("Allocation", defaultFlowSolution )); + options.push_back( caf::PdmOptionItemInfo( "Allocation", defaultFlowSolution ) ); } } } @@ -606,7 +629,7 @@ QList RimWellAllocationPlot::calculateValueOptions(const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimWellAllocationPlot::wellName() const { @@ -614,7 +637,7 @@ QString RimWellAllocationPlot::wellName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::removeFromMdiAreaAndDeleteViewWidget() { @@ -623,21 +646,23 @@ 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 ) { @@ -648,32 +673,33 @@ void RimWellAllocationPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedF m_flowDiagSolution = nullptr; } - if (!m_case) m_timeStep = 0; - else if (m_timeStep >= static_cast(m_case->timeStepDates().size())) + if ( !m_case ) + m_timeStep = 0; + else if ( m_timeStep >= static_cast( 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 sortedWellNames = findSortedWellNames(); - if (!sortedWellNames.size()) m_wellName = ""; - else if ( sortedWellNames.count(m_wellName()) == 0 ){ m_wellName = *sortedWellNames.begin();} + if ( !sortedWellNames.size() ) + m_wellName = ""; + else if ( sortedWellNames.count( m_wellName() ) == 0 ) + { + m_wellName = *sortedWellNames.begin(); + } onLoadDataAndUpdate(); } - else if ( changedField == &m_wellName - || changedField == &m_timeStep - || changedField == &m_flowDiagSolution - || changedField == &m_groupSmallContributions - || changedField == &m_smallContributionsThreshold - || changedField == &m_flowType - || changedField == &m_branchDetection) + else if ( changedField == &m_wellName || changedField == &m_timeStep || changedField == &m_flowDiagSolution || + changedField == &m_groupSmallContributions || changedField == &m_smallContributionsThreshold || + changedField == &m_flowType || changedField == &m_branchDetection ) { onLoadDataAndUpdate(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::set RimWellAllocationPlot::findSortedWellNames() { @@ -684,7 +710,7 @@ std::set RimWellAllocationPlot::findSortedWellNames() for ( size_t wIdx = 0; wIdx < simWellData.size(); ++wIdx ) { - sortedWellNames.insert(simWellData[wIdx]->m_wellName); + sortedWellNames.insert( simWellData[wIdx]->m_wellName ); } } @@ -692,26 +718,26 @@ std::set 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"); - dataGroup.add(&m_case); - dataGroup.add(&m_timeStep); - dataGroup.add(&m_wellName); - dataGroup.add(&m_branchDetection); + caf::PdmUiGroup& dataGroup = *uiOrdering.addNewGroup( "Plot Data" ); + dataGroup.add( &m_case ); + dataGroup.add( &m_timeStep ); + dataGroup.add( &m_wellName ); + dataGroup.add( &m_branchDetection ); - caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup("Options"); - optionGroup.add(&m_flowDiagSolution); - optionGroup.add(&m_flowType); - optionGroup.add(&m_groupSmallContributions); - optionGroup.add(&m_smallContributionsThreshold); - m_smallContributionsThreshold.uiCapability()->setUiReadOnly(!m_groupSmallContributions()); + caf::PdmUiGroup& optionGroup = *uiOrdering.addNewGroup( "Options" ); + optionGroup.add( &m_flowDiagSolution ); + optionGroup.add( &m_flowType ); + optionGroup.add( &m_groupSmallContributions ); + optionGroup.add( &m_smallContributionsThreshold ); + m_smallContributionsThreshold.uiCapability()->setUiReadOnly( !m_groupSmallContributions() ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::onLoadDataAndUpdate() { @@ -726,14 +752,14 @@ void RimWellAllocationPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::initAfterRead() { - if (m_accumulatedWellFlowPlot_OBSOLETE) + if ( m_accumulatedWellFlowPlot_OBSOLETE ) { - RimWellLogPlot& wellLogPlot = dynamic_cast(*this); - wellLogPlot = std::move(*m_accumulatedWellFlowPlot_OBSOLETE.value()); + RimWellLogPlot& wellLogPlot = dynamic_cast( *this ); + wellLogPlot = std::move( *m_accumulatedWellFlowPlot_OBSOLETE.value() ); m_accumulatedWellFlowPlot_OBSOLETE = nullptr; } - if (m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot()) + if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() ) { m_showTitleInPlot = m_showPlotTitle_OBSOLETE(); } @@ -742,35 +768,34 @@ 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; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -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_GAS_NAME) return cvf::Color3f::DARK_RED; - if (tracerName == RIG_FLOW_WATER_NAME) return cvf::Color3f::BLUE; + 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_WATER_NAME ) return cvf::Color3f::BLUE; return cvf::Color3f::DARK_GRAY; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellAllocationPlot::updateFormationNamesData() const { - for (size_t i = 0; i < trackCount(); ++i) + for ( size_t i = 0; i < trackCount(); ++i ) { - RimWellLogTrack* track = trackByIndex(i); - track->setAndUpdateSimWellFormationNamesData(m_case, m_wellName); + RimWellLogTrack* track = trackByIndex( i ); + track->setAndUpdateSimWellFormationNamesData( m_case, m_wellName ); } } @@ -803,6 +828,6 @@ void RimWellAllocationPlot::onDepthTypeChanged() //-------------------------------------------------------------------------------------------------- RiuWellAllocationPlot* RimWellAllocationPlot::allocationPlotWidget() const { - RiuWellAllocationPlot* plotWidget = dynamic_cast(m_viewer.data()); + RiuWellAllocationPlot* plotWidget = dynamic_cast( m_viewer.data() ); return plotWidget; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h index f27e9a09c7..66fb9f8b60 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellAllocationPlot.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -38,93 +38,106 @@ class RimWellAllocationPlotLegend; class RimWellLogTrack; class RiuWellAllocationPlot; -namespace cvf { - class Color3f; +namespace cvf +{ +class Color3f; } -namespace caf { - class PdmOptionItemInfo; +namespace caf +{ +class PdmOptionItemInfo; } - //================================================================================================== -/// -/// +/// +/// //================================================================================================== class RimWellAllocationPlot : public RimWellLogPlot { CAF_PDM_HEADER_INIT; + public: - enum FlowType { ACCUMULATED, INFLOW}; + enum FlowType + { + ACCUMULATED, + INFLOW + }; public: RimWellAllocationPlot(); ~RimWellAllocationPlot() override; - void setFromSimulationWell(RimSimWellInView* simWell); + void setFromSimulationWell( RimSimWellInView* simWell ); - RimTotalWellAllocationPlot* totalWellFlowPlot(); - RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot(); - caf::PdmObject* plotLegend(); - RimEclipseResultCase* rimCase(); - int timeStep(); + RimTotalWellAllocationPlot* totalWellFlowPlot(); + RimTofAccumulatedPhaseFractionsPlot* tofAccumulatedPhaseFractionsPlot(); + caf::PdmObject* plotLegend(); + RimEclipseResultCase* rimCase(); + int timeStep(); - QString wellName() const; + QString wellName() const; - void removeFromMdiAreaAndDeleteViewWidget(); + void removeFromMdiAreaAndDeleteViewWidget(); + + void showPlotLegend( bool doShow ); - void showPlotLegend(bool doShow); protected: // 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 findSortedWellNames(); + std::set findSortedWellNames(); - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; + QList 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 initAfterRead() override; private: - void updateFromWell(); + void updateFromWell(); - std::map *> findRelevantTracerCellFractions(const RigSimWellData* simWellData); + std::map*> findRelevantTracerCellFractions( const RigSimWellData* simWellData ); - void updateWellFlowPlotXAxisTitle(RimWellLogTrack* plotTrack); + void updateWellFlowPlotXAxisTitle( RimWellLogTrack* plotTrack ); - void addStackedCurve(const QString& tracerName, - const std::vector& depthValues, - const std::vector& accFlow, - RimWellLogTrack* plotTrack); - - static QString wellStatusTextForTimeStep(const QString& wellName, const RimEclipseResultCase* eclipseResultCase, size_t timeStep); + void addStackedCurve( const QString& tracerName, + const std::vector& depthValues, + const std::vector& accFlow, + RimWellLogTrack* plotTrack ); - QWidget* createViewWidget(QWidget* mainWindowParent) override; + static QString wellStatusTextForTimeStep( const QString& wellName, + const RimEclipseResultCase* eclipseResultCase, + size_t timeStep ); - cvf::Color3f getTracerColor(const QString& tracerName); + QWidget* createViewWidget( QWidget* mainWindowParent ) override; - void updateFormationNamesData() const; - std::set availableDepthUnits() const override; - std::set availableDepthTypes() const override; - void onDepthTypeChanged() override; + cvf::Color3f getTracerColor( const QString& tracerName ); + + void updateFormationNamesData() const; + std::set availableDepthUnits() const override; + std::set availableDepthTypes() const override; + void onDepthTypeChanged() override; + + RiuWellAllocationPlot* allocationPlotWidget() const; - RiuWellAllocationPlot* allocationPlotWidget() const; private: - caf::PdmField m_branchDetection; + caf::PdmField m_branchDetection; - caf::PdmPtrField m_case; - caf::PdmField m_wellName; - caf::PdmField m_timeStep; - caf::PdmPtrField m_flowDiagSolution; - caf::PdmField m_groupSmallContributions; - caf::PdmField m_smallContributionsThreshold; - caf::PdmField > m_flowType; + caf::PdmPtrField m_case; + caf::PdmField m_wellName; + caf::PdmField m_timeStep; + caf::PdmPtrField m_flowDiagSolution; + caf::PdmField m_groupSmallContributions; + caf::PdmField m_smallContributionsThreshold; + caf::PdmField> m_flowType; - caf::PdmChildField m_totalWellAllocationPlot; - caf::PdmChildField m_wellAllocationPlotLegend; + caf::PdmChildField m_totalWellAllocationPlot; + caf::PdmChildField m_wellAllocationPlotLegend; caf::PdmChildField m_tofAccumulatedPhaseFractionsPlot; - caf::PdmChildField m_accumulatedWellFlowPlot_OBSOLETE; - caf::PdmField m_showPlotTitle_OBSOLETE; + caf::PdmChildField m_accumulatedWellFlowPlot_OBSOLETE; + caf::PdmField m_showPlotTitle_OBSOLETE; }; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp index 661d4ff217..39ff1951ac 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.cpp @@ -67,25 +67,25 @@ #include #include -CAF_PDM_SOURCE_INIT(RimWellPltPlot, "WellPltPlot"); +CAF_PDM_SOURCE_INIT( RimWellPltPlot, "WellPltPlot" ); namespace caf { -template<> +template <> void caf::AppEnum::setUp() { - addItem(FLOW_TYPE_PHASE_SPLIT, "PHASE_SPLIT", "Phase Split"); - addItem(FLOW_TYPE_TOTAL, "TOTAL", "Total Flow"); - setDefault(FLOW_TYPE_PHASE_SPLIT); + addItem( FLOW_TYPE_PHASE_SPLIT, "PHASE_SPLIT", "Phase Split" ); + addItem( FLOW_TYPE_TOTAL, "TOTAL", "Total Flow" ); + setDefault( FLOW_TYPE_PHASE_SPLIT ); } -template<> +template <> void caf::AppEnum::setUp() { - addItem(FLOW_PHASE_OIL, "PHASE_OIL", "Oil"); - addItem(FLOW_PHASE_GAS, "PHASE_GAS", "Gas"); - addItem(FLOW_PHASE_WATER, "PHASE_WATER", "Water"); - addItem(FLOW_PHASE_TOTAL, "PHASE_TOTAL", "Total"); + addItem( FLOW_PHASE_OIL, "PHASE_OIL", "Oil" ); + addItem( FLOW_PHASE_GAS, "PHASE_GAS", "Gas" ); + addItem( FLOW_PHASE_WATER, "PHASE_WATER", "Water" ); + addItem( FLOW_PHASE_TOTAL, "PHASE_TOTAL", "Total" ); } } // namespace caf @@ -100,40 +100,40 @@ const char RimWellPltPlot::PLOT_NAME_QFORMAT_STRING[] = "PLT: %1"; RimWellPltPlot::RimWellPltPlot() : RimWellLogPlot() { - CAF_PDM_InitObject("Well Allocation Plot", ":/WellFlowPlot16x16.png", "", ""); + CAF_PDM_InitObject( "Well Allocation Plot", ":/WellFlowPlot16x16.png", "", "" ); - CAF_PDM_InitField(&m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", ""); - m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" ); + m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault(&m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", ""); - m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden(true); - m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "WellLog", "", "", "" ); + m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true ); + m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault(&m_wellPathName, "WellName", "Well Name", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_wellPathName, "WellName", "Well Name", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_selectedSources, "SourcesInternal", "Sources Internal", "", "", ""); - m_selectedSources.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); - m_selectedSources.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); - m_selectedSources.uiCapability()->setAutoAddingOptionFromValue(false); + CAF_PDM_InitFieldNoDefault( &m_selectedSources, "SourcesInternal", "Sources Internal", "", "", "" ); + m_selectedSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); + m_selectedSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false ); m_selectedSources.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault(&m_selectedSourcesForIo, "Sources", "Sources", "", "", ""); - m_selectedSourcesForIo.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_selectedSourcesForIo, "Sources", "Sources", "", "", "" ); + m_selectedSourcesForIo.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", ""); - m_selectedTimeSteps.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); - m_selectedTimeSteps.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); - m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue(false); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" ); + m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); + m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitField(&m_useStandardConditionCurves, "UseStandardConditionCurves", true, "Standard Volume", "", "", ""); - CAF_PDM_InitField(&m_useReservoirConditionCurves, "UseReservoirConditionCurves", true, "Reservoir Volume", "", "", ""); + CAF_PDM_InitField( &m_useStandardConditionCurves, "UseStandardConditionCurves", true, "Standard Volume", "", "", "" ); + CAF_PDM_InitField( &m_useReservoirConditionCurves, "UseReservoirConditionCurves", true, "Reservoir Volume", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_phases, "Phases", "Phases", "", "", ""); - m_phases.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); - m_phases = std::vector>({FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER}); - m_phases.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); + CAF_PDM_InitFieldNoDefault( &m_phases, "Phases", "Phases", "", "", "" ); + m_phases.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); + m_phases = std::vector>( {FLOW_PHASE_OIL, FLOW_PHASE_GAS, FLOW_PHASE_WATER} ); + m_phases.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); - m_nameConfig->setCustomName("PLT Plot"); + m_nameConfig->setCustomName( "PLT Plot" ); this->setAsPlotMdiWindow(); m_doInitAfterLoad = false; @@ -153,47 +153,47 @@ RimWellPltPlot::~RimWellPltPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack) +void RimWellPltPlot::setPlotXAxisTitles( RimWellLogTrack* plotTrack ) { std::set presentUnitSystems; - for (const RifDataSourceForRftPlt& source : m_selectedSources.v()) + for ( const RifDataSourceForRftPlt& source : m_selectedSources.v() ) { - if (source.eclCase()) presentUnitSystems.insert(source.eclCase()->eclipseCaseData()->unitsType()); - if (source.wellLogFile()) + if ( source.eclCase() ) presentUnitSystems.insert( source.eclCase()->eclipseCaseData()->unitsType() ); + if ( source.wellLogFile() ) { - if (source.wellLogFile()->wellLogFileData()) + if ( source.wellLogFile()->wellLogFileData() ) { // Todo: Handle different units in the relevant las channels - switch (source.wellLogFile()->wellLogFileData()->depthUnit()) + switch ( source.wellLogFile()->wellLogFileData()->depthUnit() ) { case RiaDefines::UNIT_METER: - presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_METRIC); + presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_METRIC ); case RiaDefines::UNIT_FEET: - presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_FIELD); + presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_FIELD ); case RiaDefines::UNIT_NONE: - presentUnitSystems.insert(RiaEclipseUnitTools::UNITS_UNKNOWN); + presentUnitSystems.insert( RiaEclipseUnitTools::UNITS_UNKNOWN ); } } } } - if (presentUnitSystems.size() > 1) + if ( presentUnitSystems.size() > 1 ) { - QMessageBox::warning(nullptr, "ResInsight PLT Plot", "Inconsistent units in PLT plot"); + QMessageBox::warning( nullptr, "ResInsight PLT Plot", "Inconsistent units in PLT plot" ); } - if (presentUnitSystems.empty()) return; + if ( presentUnitSystems.empty() ) return; RiaEclipseUnitTools::UnitSystem unitSet = *presentUnitSystems.begin(); QString axisTitle; - if (m_useReservoirConditionCurves) - axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet); - if (m_useReservoirConditionCurves && m_useStandardConditionCurves) axisTitle += " | "; - if (m_useStandardConditionCurves) - axisTitle += RimWellPlotTools::flowPlotAxisTitle(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet); + if ( m_useReservoirConditionCurves ) + axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet ); + if ( m_useReservoirConditionCurves && m_useStandardConditionCurves ) axisTitle += " | "; + if ( m_useStandardConditionCurves ) + axisTitle += RimWellPlotTools::flowPlotAxisTitle( RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet ); - plotTrack->setXAxisTitle(axisTitle); + plotTrack->setXAxisTitle( axisTitle ); #if 0 QString unitText; for ( auto unitSet: presentUnitSystems ) @@ -224,26 +224,26 @@ void RimWellPltPlot::setPlotXAxisTitles(RimWellLogTrack* plotTrack) //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::updateFormationsOnPlot() const { - if (trackCount() > 0) + if ( trackCount() > 0 ) { RimProject* proj = RiaApplication::instance()->project(); - RimWellPath* wellPath = proj->wellPathByName(m_wellPathName); + RimWellPath* wellPath = proj->wellPathByName( m_wellPathName ); - RimCase* formationNamesCase = trackByIndex(0)->formationNamesCase(); + RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase(); - if (!formationNamesCase) + if ( !formationNamesCase ) { /// Set default case. Todo : Use the first of the selected cases in the plot std::vector cases; - proj->allCases(cases); + proj->allCases( cases ); - if (!cases.empty()) + if ( !cases.empty() ) { formationNamesCase = cases[0]; } } - trackByIndex(0)->setAndUpdateWellPathFormationNamesData(formationNamesCase, wellPath); + trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath ); } } @@ -262,11 +262,11 @@ std::set RimWellPltPlot::selectedCurveDefs() const { std::set channelTypesToUse = RifEclipseRftAddress::pltPlotChannelTypes(); - return RimWellPlotTools::curveDefsFromTimesteps(RimWellPlotTools::simWellName(m_wellPathName), - m_selectedTimeSteps.v(), - false, - selectedSourcesExpanded(), - channelTypesToUse); + return RimWellPlotTools::curveDefsFromTimesteps( RimWellPlotTools::simWellName( m_wellPathName ), + m_selectedTimeSteps.v(), + false, + selectedSourcesExpanded(), + channelTypesToUse ); } //-------------------------------------------------------------------------------------------------- @@ -292,12 +292,12 @@ public: } protected: - RigEclipseWellLogExtractor* findWellLogExtractor(const QString& wellPathName, RimEclipseResultCase* eclCase) + RigEclipseWellLogExtractor* findWellLogExtractor( const QString& wellPathName, RimEclipseResultCase* eclCase ) { RimProject* proj = RiaApplication::instance()->project(); - RimWellPath* wellPath = proj->wellPathByName(wellPathName); + RimWellPath* wellPath = proj->wellPathByName( wellPathName ); RimWellLogPlotCollection* wellLogCollection = proj->mainPlotCollection()->wellLogPlotCollection(); - RigEclipseWellLogExtractor* eclExtractor = wellLogCollection->findOrCreateExtractor(wellPath, eclCase); + RigEclipseWellLogExtractor* eclExtractor = wellLogCollection->findOrCreateExtractor( wellPath, eclCase ); return eclExtractor; } @@ -314,76 +314,83 @@ protected: class RigRftResultPointCalculator : public RigResultPointCalculator { public: - RigRftResultPointCalculator(const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep) + RigRftResultPointCalculator( const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep ) { - RifEclipseRftAddress gasRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::GRAT); - RifEclipseRftAddress oilRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::ORAT); - RifEclipseRftAddress watRateAddress(RimWellPlotTools::simWellName(wellPathName), m_timeStep, RifEclipseRftAddress::WRAT); + RifEclipseRftAddress gasRateAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::GRAT ); + RifEclipseRftAddress oilRateAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::ORAT ); + RifEclipseRftAddress watRateAddress( RimWellPlotTools::simWellName( wellPathName ), + m_timeStep, + RifEclipseRftAddress::WRAT ); std::vector rftIndices; - eclCase->rftReader()->cellIndices(gasRateAddress, &rftIndices); - if (rftIndices.empty()) eclCase->rftReader()->cellIndices(oilRateAddress, &rftIndices); - if (rftIndices.empty()) eclCase->rftReader()->cellIndices(watRateAddress, &rftIndices); - if (rftIndices.empty()) return; + eclCase->rftReader()->cellIndices( gasRateAddress, &rftIndices ); + if ( rftIndices.empty() ) eclCase->rftReader()->cellIndices( oilRateAddress, &rftIndices ); + if ( rftIndices.empty() ) eclCase->rftReader()->cellIndices( watRateAddress, &rftIndices ); + if ( rftIndices.empty() ) return; std::vector gasRates; std::vector oilRates; std::vector watRates; - eclCase->rftReader()->values(gasRateAddress, &gasRates); - eclCase->rftReader()->values(oilRateAddress, &oilRates); - eclCase->rftReader()->values(watRateAddress, &watRates); + eclCase->rftReader()->values( gasRateAddress, &gasRates ); + eclCase->rftReader()->values( oilRateAddress, &oilRates ); + eclCase->rftReader()->values( watRateAddress, &watRates ); std::map globCellIdxToIdxInRftFile; const RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid(); - for (size_t rftCellIdx = 0; rftCellIdx < rftIndices.size(); rftCellIdx++) + for ( size_t rftCellIdx = 0; rftCellIdx < rftIndices.size(); rftCellIdx++ ) { - caf::VecIjk ijkIndex = rftIndices[rftCellIdx]; - size_t globalCellIndex = mainGrid->cellIndexFromIJK(ijkIndex.i(), ijkIndex.j(), ijkIndex.k()); + caf::VecIjk ijkIndex = rftIndices[rftCellIdx]; + size_t globalCellIndex = mainGrid->cellIndexFromIJK( ijkIndex.i(), ijkIndex.j(), ijkIndex.k() ); globCellIdxToIdxInRftFile[globalCellIndex] = rftCellIdx; } - RigEclipseWellLogExtractor* eclExtractor = findWellLogExtractor(wellPathName, eclCase); - if (!eclExtractor) return; + RigEclipseWellLogExtractor* eclExtractor = findWellLogExtractor( wellPathName, eclCase ); + if ( !eclExtractor ) return; std::vector intersections = eclExtractor->cellIntersectionInfosAlongWellPath(); - for (size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++) + for ( size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++ ) { size_t globCellIdx = intersections[wpExIdx].globCellIndex; - auto it = globCellIdxToIdxInRftFile.find(globCellIdx); - if (it == globCellIdxToIdxInRftFile.end()) + auto it = globCellIdxToIdxInRftFile.find( globCellIdx ); + if ( it == globCellIdxToIdxInRftFile.end() ) { - if (!m_pipeBranchWellResultPoints.empty() && wpExIdx == (intersections.size() - 1)) + if ( !m_pipeBranchWellResultPoints.empty() && wpExIdx == ( intersections.size() - 1 ) ) { m_pipeBranchWellResultPoints.pop_back(); } continue; } - m_pipeBranchCLCoords.push_back(intersections[wpExIdx].startPoint); - m_pipeBranchMeasuredDepths.push_back(intersections[wpExIdx].startMD); + m_pipeBranchCLCoords.push_back( intersections[wpExIdx].startPoint ); + m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].startMD ); - m_pipeBranchCLCoords.push_back(intersections[wpExIdx].endPoint); - m_pipeBranchMeasuredDepths.push_back(intersections[wpExIdx].endMD); + m_pipeBranchCLCoords.push_back( intersections[wpExIdx].endPoint ); + m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].endMD ); RigWellResultPoint resPoint; resPoint.m_isOpen = true; resPoint.m_gridIndex = 0; // Always main grid resPoint.m_gridCellIndex = globCellIdx; // Shortcut, since we only have main grid results from RFT - resPoint.m_gasRate = RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( - eclCase->eclipseCaseData()->unitsType(), gasRates[it->second]); + resPoint.m_gasRate = + RiaEclipseUnitTools::convertSurfaceGasFlowRateToOilEquivalents( eclCase->eclipseCaseData()->unitsType(), + gasRates[it->second] ); resPoint.m_oilRate = oilRates[it->second]; resPoint.m_waterRate = watRates[it->second]; - m_pipeBranchWellResultPoints.push_back(resPoint); + m_pipeBranchWellResultPoints.push_back( resPoint ); - if (wpExIdx < intersections.size() - 1) + if ( wpExIdx < intersections.size() - 1 ) { m_pipeBranchWellResultPoints.push_back( - RigWellResultPoint()); // Invalid res point describing the "line" between the cells + RigWellResultPoint() ); // Invalid res point describing the "line" between the cells } } } @@ -395,81 +402,83 @@ public: class RigSimWellResultPointCalculator : public RigResultPointCalculator { public: - RigSimWellResultPointCalculator(const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep) + RigSimWellResultPointCalculator( const QString& wellPathName, RimEclipseResultCase* eclCase, QDateTime m_timeStep ) { // Find timestep index from qdatetime - const std::vector timeSteps = eclCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(); - size_t tsIdx = timeSteps.size(); - for (tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx) + const std::vector timeSteps = + eclCase->eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->timeStepDates(); + size_t tsIdx = timeSteps.size(); + for ( tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx ) { - if (timeSteps[tsIdx] == m_timeStep) break; + if ( timeSteps[tsIdx] == m_timeStep ) break; } - if (tsIdx >= timeSteps.size()) return; + if ( tsIdx >= timeSteps.size() ) return; // Build search map into simulation well data std::map> globCellIdxToIdxInSimWellBranch; - const RimWellPath* wellPath = RimWellPlotTools::wellPathByWellPathNameOrSimWellName(wellPathName); - const RigSimWellData* simWell = - wellPath != nullptr ? eclCase->eclipseCaseData()->findSimWellData(wellPath->associatedSimulationWellName()) : nullptr; + const RimWellPath* wellPath = RimWellPlotTools::wellPathByWellPathNameOrSimWellName( wellPathName ); + const RigSimWellData* simWell = wellPath != nullptr ? eclCase->eclipseCaseData()->findSimWellData( + wellPath->associatedSimulationWellName() ) + : nullptr; - if (!simWell) return; + if ( !simWell ) return; - if (!simWell->hasWellResult(tsIdx)) return; + if ( !simWell->hasWellResult( tsIdx ) ) return; - const RigWellResultFrame& resFrame = simWell->wellResultFrame(tsIdx); + const RigWellResultFrame& resFrame = simWell->wellResultFrame( tsIdx ); const RigMainGrid* mainGrid = eclCase->eclipseCaseData()->mainGrid(); - for (size_t brIdx = 0; brIdx < resFrame.m_wellResultBranches.size(); ++brIdx) + for ( size_t brIdx = 0; brIdx < resFrame.m_wellResultBranches.size(); ++brIdx ) { const std::vector& branchResPoints = resFrame.m_wellResultBranches[brIdx].m_branchResultPoints; - for (size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++) + for ( size_t wrpIdx = 0; wrpIdx < branchResPoints.size(); wrpIdx++ ) { - const RigGridBase* grid = mainGrid->gridByIndex(branchResPoints[wrpIdx].m_gridIndex); - size_t globalCellIndex = grid->reservoirCellIndex(branchResPoints[wrpIdx].m_gridCellIndex); + const RigGridBase* grid = mainGrid->gridByIndex( branchResPoints[wrpIdx].m_gridIndex ); + size_t globalCellIndex = grid->reservoirCellIndex( branchResPoints[wrpIdx].m_gridCellIndex ); - globCellIdxToIdxInSimWellBranch[globalCellIndex] = std::make_pair(brIdx, wrpIdx); + globCellIdxToIdxInSimWellBranch[globalCellIndex] = std::make_pair( brIdx, wrpIdx ); } } - RigEclipseWellLogExtractor* eclExtractor = findWellLogExtractor(wellPathName, eclCase); + RigEclipseWellLogExtractor* eclExtractor = findWellLogExtractor( wellPathName, eclCase ); - if (!eclExtractor) return; + if ( !eclExtractor ) return; std::vector intersections = eclExtractor->cellIntersectionInfosAlongWellPath(); - for (size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++) + for ( size_t wpExIdx = 0; wpExIdx < intersections.size(); wpExIdx++ ) { size_t globCellIdx = intersections[wpExIdx].globCellIndex; - auto it = globCellIdxToIdxInSimWellBranch.find(globCellIdx); - if (it == globCellIdxToIdxInSimWellBranch.end()) + auto it = globCellIdxToIdxInSimWellBranch.find( globCellIdx ); + if ( it == globCellIdxToIdxInSimWellBranch.end() ) { - if (!m_pipeBranchWellResultPoints.empty() && wpExIdx == (intersections.size() - 1)) + if ( !m_pipeBranchWellResultPoints.empty() && wpExIdx == ( intersections.size() - 1 ) ) { m_pipeBranchWellResultPoints.pop_back(); } continue; } - m_pipeBranchCLCoords.push_back(intersections[wpExIdx].startPoint); - m_pipeBranchMeasuredDepths.push_back(intersections[wpExIdx].startMD); + m_pipeBranchCLCoords.push_back( intersections[wpExIdx].startPoint ); + m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].startMD ); - m_pipeBranchCLCoords.push_back(intersections[wpExIdx].endPoint); - m_pipeBranchMeasuredDepths.push_back(intersections[wpExIdx].endMD); + m_pipeBranchCLCoords.push_back( intersections[wpExIdx].endPoint ); + m_pipeBranchMeasuredDepths.push_back( intersections[wpExIdx].endMD ); - const RigWellResultPoint& resPoint = - resFrame.m_wellResultBranches[it->second.first].m_branchResultPoints[it->second.second]; + const RigWellResultPoint& resPoint = resFrame.m_wellResultBranches[it->second.first] + .m_branchResultPoints[it->second.second]; - m_pipeBranchWellResultPoints.push_back(resPoint); - if (wpExIdx < intersections.size() - 1) + m_pipeBranchWellResultPoints.push_back( resPoint ); + if ( wpExIdx < intersections.size() - 1 ) { m_pipeBranchWellResultPoints.push_back( - RigWellResultPoint()); // Invalid res point describing the "line" between the cells + RigWellResultPoint() ); // Invalid res point describing the "line" between the cells } } } @@ -480,10 +489,10 @@ public: //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::syncCurvesFromUiSelection() { - RimWellLogTrack* plotTrack = trackByIndex(0); + RimWellLogTrack* plotTrack = trackByIndex( 0 ); const std::set& curveDefs = selectedCurveDefs(); - setPlotXAxisTitles(plotTrack); + setPlotXAxisTitles( plotTrack ); // Delete existing curves @@ -494,17 +503,17 @@ void RimWellPltPlot::syncCurvesFromUiSelection() QString dateFormatString; { std::vector allTimeSteps; - for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs) + for ( const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs ) { - allTimeSteps.push_back(curveDefToAdd.timeStep()); + allTimeSteps.push_back( curveDefToAdd.timeStep() ); } - dateFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates(allTimeSteps); + dateFormatString = RiaQDateTimeTools::createTimeFormatStringFromDates( allTimeSteps ); } // Add curves - for (const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs) + for ( const RiaRftPltCurveDefinition& curveDefToAdd : curveDefs ) { - std::set selectedPhases = std::set(m_phases().begin(), m_phases().end()); + std::set selectedPhases = std::set( m_phases().begin(), m_phases().end() ); RifDataSourceForRftPlt sourceDef = curveDefToAdd.address(); QDateTime timeStep = curveDefToAdd.timeStep(); @@ -516,109 +525,112 @@ void RimWellPltPlot::syncCurvesFromUiSelection() { curveName += sourceDef.eclCase() ? sourceDef.eclCase()->caseUserDescription() : ""; curveName += sourceDef.wellLogFile() ? sourceDef.wellLogFile()->name() : ""; - if (sourceDef.sourceType() == RifDataSourceForRftPlt::RFT) curveName += ", RFT"; + if ( sourceDef.sourceType() == RifDataSourceForRftPlt::RFT ) curveName += ", RFT"; - curveName += ", " + RiaQDateTimeTools::toStringUsingApplicationLocale(timeStep, dateFormatString); + curveName += ", " + RiaQDateTimeTools::toStringUsingApplicationLocale( timeStep, dateFormatString ); } - RimEclipseResultCase* rimEclipseResultCase = dynamic_cast(sourceDef.eclCase()); + RimEclipseResultCase* rimEclipseResultCase = dynamic_cast( sourceDef.eclCase() ); - if (sourceDef.sourceType() == RifDataSourceForRftPlt::RFT) + if ( sourceDef.sourceType() == RifDataSourceForRftPlt::RFT ) { - resultPointCalc.reset(new RigRftResultPointCalculator(m_wellPathName, rimEclipseResultCase, timeStep)); + resultPointCalc.reset( new RigRftResultPointCalculator( m_wellPathName, rimEclipseResultCase, timeStep ) ); } - else if (sourceDef.sourceType() == RifDataSourceForRftPlt::GRID) + else if ( sourceDef.sourceType() == RifDataSourceForRftPlt::GRID ) { - resultPointCalc.reset(new RigSimWellResultPointCalculator(m_wellPathName, rimEclipseResultCase, timeStep)); + resultPointCalc.reset( new RigSimWellResultPointCalculator( m_wellPathName, rimEclipseResultCase, timeStep ) ); } RiaEclipseUnitTools::UnitSystem unitSet = RiaEclipseUnitTools::UNITS_UNKNOWN; - if (rimEclipseResultCase) + if ( rimEclipseResultCase ) { unitSet = rimEclipseResultCase->eclipseCaseData()->unitsType(); } - if (resultPointCalc != nullptr) + if ( resultPointCalc != nullptr ) { - if (!resultPointCalc->pipeBranchCLCoords().empty()) + if ( !resultPointCalc->pipeBranchCLCoords().empty() ) { - if (selectedPhases.count(FLOW_PHASE_TOTAL) && m_useReservoirConditionCurves() && - sourceDef.sourceType() == RifDataSourceForRftPlt::GRID) + if ( selectedPhases.count( FLOW_PHASE_TOTAL ) && m_useReservoirConditionCurves() && + sourceDef.sourceType() == RifDataSourceForRftPlt::GRID ) { - RigAccWellFlowCalculator wfTotalAccumulator(resultPointCalc->pipeBranchCLCoords(), - resultPointCalc->pipeBranchWellResultPoints(), - resultPointCalc->pipeBranchMeasuredDepths(), - true); + RigAccWellFlowCalculator wfTotalAccumulator( resultPointCalc->pipeBranchCLCoords(), + resultPointCalc->pipeBranchWellResultPoints(), + resultPointCalc->pipeBranchMeasuredDepths(), + true ); - const std::vector& depthValues = wfTotalAccumulator.pseudoLengthFromTop(0); + const std::vector& depthValues = wfTotalAccumulator.pseudoLengthFromTop( 0 ); - QString curveUnitText = RimWellPlotTools::flowUnitText(RimWellLogFile::WELL_FLOW_COND_RESERVOIR, unitSet); + QString curveUnitText = RimWellPlotTools::flowUnitText( RimWellLogFile::WELL_FLOW_COND_RESERVOIR, + unitSet ); - const std::vector accFlow = - wfTotalAccumulator.accumulatedTracerFlowPrPseudoLength(RIG_FLOW_TOTAL_NAME, 0); - addStackedCurve(curveName + ", " + RIG_FLOW_TOTAL_NAME + " " + curveUnitText, - depthValues, - accFlow, - plotTrack, - cvf::Color3f::DARK_GRAY, - curveGroupId, - false); + const std::vector accFlow = wfTotalAccumulator + .accumulatedTracerFlowPrPseudoLength( RIG_FLOW_TOTAL_NAME, 0 ); + addStackedCurve( curveName + ", " + RIG_FLOW_TOTAL_NAME + " " + curveUnitText, + depthValues, + accFlow, + plotTrack, + cvf::Color3f::DARK_GRAY, + curveGroupId, + false ); curveGroupId++; } - if (m_useStandardConditionCurves()) + if ( m_useStandardConditionCurves() ) { - RigAccWellFlowCalculator wfPhaseAccumulator(resultPointCalc->pipeBranchCLCoords(), - resultPointCalc->pipeBranchWellResultPoints(), - resultPointCalc->pipeBranchMeasuredDepths(), - false); + RigAccWellFlowCalculator wfPhaseAccumulator( resultPointCalc->pipeBranchCLCoords(), + resultPointCalc->pipeBranchWellResultPoints(), + resultPointCalc->pipeBranchMeasuredDepths(), + false ); - const std::vector& depthValues = wfPhaseAccumulator.pseudoLengthFromTop(0); + const std::vector& depthValues = wfPhaseAccumulator.pseudoLengthFromTop( 0 ); std::vector tracerNames = wfPhaseAccumulator.tracerNames(); - for (const QString& tracerName : tracerNames) + for ( const QString& tracerName : tracerNames ) { auto color = tracerName == RIG_FLOW_OIL_NAME ? cvf::Color3f::DARK_GREEN : tracerName == RIG_FLOW_GAS_NAME ? cvf::Color3f::DARK_RED - : tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE : cvf::Color3f::DARK_GRAY; + : tracerName == RIG_FLOW_WATER_NAME ? cvf::Color3f::BLUE + : cvf::Color3f::DARK_GRAY; - if (tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count(FLOW_PHASE_OIL) || - tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count(FLOW_PHASE_GAS) || - tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count(FLOW_PHASE_WATER)) + if ( tracerName == RIG_FLOW_OIL_NAME && selectedPhases.count( FLOW_PHASE_OIL ) || + tracerName == RIG_FLOW_GAS_NAME && selectedPhases.count( FLOW_PHASE_GAS ) || + tracerName == RIG_FLOW_WATER_NAME && selectedPhases.count( FLOW_PHASE_WATER ) ) { FlowPhase flowPhase = FLOW_PHASE_NONE; - if (tracerName == RIG_FLOW_OIL_NAME) + if ( tracerName == RIG_FLOW_OIL_NAME ) flowPhase = FLOW_PHASE_OIL; - else if (tracerName == RIG_FLOW_GAS_NAME) + else if ( tracerName == RIG_FLOW_GAS_NAME ) flowPhase = FLOW_PHASE_GAS; - else if (tracerName == RIG_FLOW_WATER_NAME) + else if ( tracerName == RIG_FLOW_WATER_NAME ) flowPhase = FLOW_PHASE_WATER; - QString curveUnitText = - RimWellPlotTools::curveUnitText(RimWellLogFile::WELL_FLOW_COND_STANDARD, unitSet, flowPhase); + QString curveUnitText = RimWellPlotTools::curveUnitText( RimWellLogFile::WELL_FLOW_COND_STANDARD, + unitSet, + flowPhase ); - const std::vector& accFlow = - wfPhaseAccumulator.accumulatedTracerFlowPrPseudoLength(tracerName, 0); - addStackedCurve(curveName + ", " + tracerName + " " + curveUnitText, - depthValues, - accFlow, - plotTrack, - color, - curveGroupId, - false); + const std::vector& accFlow = wfPhaseAccumulator + .accumulatedTracerFlowPrPseudoLength( tracerName, 0 ); + addStackedCurve( curveName + ", " + tracerName + " " + curveUnitText, + depthValues, + accFlow, + plotTrack, + color, + curveGroupId, + false ); } } } } } - else if (sourceDef.sourceType() == RifDataSourceForRftPlt::OBSERVED) + else if ( sourceDef.sourceType() == RifDataSourceForRftPlt::OBSERVED ) { - if (sourceDef.wellLogFile() && sourceDef.wellLogFile()->wellLogFileData()) + if ( sourceDef.wellLogFile() && sourceDef.wellLogFile()->wellLogFileData() ) { RimWellLogFile::WellFlowCondition flowCondition = sourceDef.wellLogFile()->wellFlowRateCondition(); - if ((m_useStandardConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_STANDARD) || - (m_useReservoirConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR)) + if ( ( m_useStandardConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_STANDARD ) || + ( m_useReservoirConditionCurves() && flowCondition == RimWellLogFile::WELL_FLOW_COND_RESERVOIR ) ) { using ChannelValNameIdxTuple = std::tuple; @@ -628,15 +640,16 @@ void RimWellPltPlot::syncCurvesFromUiSelection() std::multiset sortedChannels; std::vector> channelData; - channelData.resize(channelNames.size()); + channelData.resize( channelNames.size() ); - for (int chIdx = 0; chIdx < channelNames.size(); ++chIdx) + for ( int chIdx = 0; chIdx < channelNames.size(); ++chIdx ) { QString channelName = channelNames[chIdx]; - channelData[chIdx] = wellLogFileData->values(channelName); - if (!channelData[chIdx].empty()) + channelData[chIdx] = wellLogFileData->values( channelName ); + if ( !channelData[chIdx].empty() ) { - sortedChannels.insert(ChannelValNameIdxTuple(-fabs(channelData[chIdx].front()), channelName, chIdx)); + sortedChannels.insert( + ChannelValNameIdxTuple( -fabs( channelData[chIdx].front() ), channelName, chIdx ) ); } } @@ -645,42 +658,43 @@ void RimWellPltPlot::syncCurvesFromUiSelection() RiaEclipseUnitTools::UnitSystem unitSystem = RiaEclipseUnitTools::UNITS_UNKNOWN; { RiaDefines::DepthUnitType depthUnit = wellLogFileData->depthUnit(); - if (depthUnit == RiaDefines::UNIT_FEET) unitSystem = RiaEclipseUnitTools::UNITS_FIELD; - if (depthUnit == RiaDefines::UNIT_METER) unitSystem = RiaEclipseUnitTools::UNITS_METRIC; + if ( depthUnit == RiaDefines::UNIT_FEET ) unitSystem = RiaEclipseUnitTools::UNITS_FIELD; + if ( depthUnit == RiaDefines::UNIT_METER ) unitSystem = RiaEclipseUnitTools::UNITS_METRIC; } - for (const ChannelValNameIdxTuple& channelInfo : sortedChannels) + for ( const ChannelValNameIdxTuple& channelInfo : sortedChannels ) { - const auto& channelName = std::get<1>(channelInfo); - if (selectedPhases.count(RimWellPlotTools::flowPhaseFromChannelName(channelName)) > 0) + const auto& channelName = std::get<1>( channelInfo ); + if ( selectedPhases.count( RimWellPlotTools::flowPhaseFromChannelName( channelName ) ) > 0 ) { - auto color = RimWellPlotTools::isOilFlowChannel(channelName) + auto color = RimWellPlotTools::isOilFlowChannel( channelName ) ? cvf::Color3f::DARK_GREEN - : RimWellPlotTools::isGasFlowChannel(channelName) + : RimWellPlotTools::isGasFlowChannel( channelName ) ? cvf::Color3f::DARK_RED - : RimWellPlotTools::isWaterFlowChannel(channelName) ? cvf::Color3f::BLUE - : cvf::Color3f::DARK_GRAY; + : RimWellPlotTools::isWaterFlowChannel( channelName ) + ? cvf::Color3f::BLUE + : cvf::Color3f::DARK_GRAY; FlowPhase flowPhase = FLOW_PHASE_NONE; - if (RimWellPlotTools::isOilFlowChannel(channelName)) + if ( RimWellPlotTools::isOilFlowChannel( channelName ) ) flowPhase = FLOW_PHASE_OIL; - else if (RimWellPlotTools::isGasFlowChannel(channelName)) + else if ( RimWellPlotTools::isGasFlowChannel( channelName ) ) flowPhase = FLOW_PHASE_GAS; - else if (RimWellPlotTools::isWaterFlowChannel(channelName)) + else if ( RimWellPlotTools::isWaterFlowChannel( channelName ) ) flowPhase = FLOW_PHASE_WATER; - QString curveUnitText = RimWellPlotTools::curveUnitText(flowCondition, unitSystem, flowPhase); + QString curveUnitText = RimWellPlotTools::curveUnitText( flowCondition, unitSystem, flowPhase ); - addStackedCurve(curveName + ", " + channelName + " " + curveUnitText, - depthValues, - channelData[std::get<2>(channelInfo)], - plotTrack, - color, - curveGroupId, - true); + addStackedCurve( curveName + ", " + channelName + " " + curveUnitText, + depthValues, + channelData[std::get<2>( channelInfo )], + plotTrack, + color, + curveGroupId, + true ); // Total flow channel will end up first, so just increment the group // idx to make the rest of the phases group together - if (RimWellPlotTools::isTotalFlowChannel(channelName)) curveGroupId++; + if ( RimWellPlotTools::isTotalFlowChannel( channelName ) ) curveGroupId++; } } } @@ -696,33 +710,33 @@ void RimWellPltPlot::syncCurvesFromUiSelection() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::addStackedCurve(const QString& curveName, - const std::vector& depthValues, - const std::vector& accFlow, - RimWellLogTrack* plotTrack, - cvf::Color3f color, - int curveGroupId, - bool doFillCurve) +void RimWellPltPlot::addStackedCurve( const QString& curveName, + const std::vector& depthValues, + const std::vector& accFlow, + RimWellLogTrack* plotTrack, + cvf::Color3f color, + int curveGroupId, + bool doFillCurve ) { RimWellFlowRateCurve* curve = new RimWellFlowRateCurve; - curve->setFlowValuesPrDepthValue(curveName, depthValues, accFlow); + curve->setFlowValuesPrDepthValue( curveName, depthValues, accFlow ); - curve->setColor(color); - curve->setGroupId(curveGroupId); + curve->setColor( color ); + curve->setGroupId( curveGroupId ); - if (curveGroupId == 0) + if ( curveGroupId == 0 ) { - curve->setDoFillCurve(true); - curve->setSymbol(RiuQwtSymbol::SYMBOL_NONE); + curve->setDoFillCurve( true ); + curve->setSymbol( RiuQwtSymbol::SYMBOL_NONE ); } else { - curve->setDoFillCurve(false); - curve->setSymbol(RimSummaryCurveAppearanceCalculator::cycledSymbol(curveGroupId)); + curve->setDoFillCurve( false ); + curve->setSymbol( RimSummaryCurveAppearanceCalculator::cycledSymbol( curveGroupId ) ); } - curve->setSymbolSkipDistance(10); - plotTrack->addCurve(curve); + curve->setSymbolSkipDistance( 10 ); + plotTrack->addCurve( curve ); } //-------------------------------------------------------------------------------------------------- @@ -731,17 +745,17 @@ void RimWellPltPlot::addStackedCurve(const QString& curveName, std::vector RimWellPltPlot::selectedSourcesExpanded() const { std::vector sources; - for (const RifDataSourceForRftPlt& addr : m_selectedSources()) + for ( const RifDataSourceForRftPlt& addr : m_selectedSources() ) { - if (addr.sourceType() == RifDataSourceForRftPlt::OBSERVED) + if ( addr.sourceType() == RifDataSourceForRftPlt::OBSERVED ) { - for (RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingFlow(m_wellPathName)) + for ( RimWellLogFile* const wellLogFile : RimWellPlotTools::wellLogFilesContainingFlow( m_wellPathName ) ) { - sources.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED, wellLogFile)); + sources.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED, wellLogFile ) ); } } else - sources.push_back(addr); + sources.push_back( addr ); } return sources; } @@ -749,7 +763,7 @@ std::vector RimWellPltPlot::selectedSourcesExpanded() co //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::setCurrentWellName(const QString& currWellName) +void RimWellPltPlot::setCurrentWellName( const QString& currWellName ) { m_wellPathName = currWellName; } @@ -765,89 +779,95 @@ const char* RimWellPltPlot::plotNameFormatString() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellPltPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList RimWellPltPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { - QList options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); + QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); - const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName); + const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName ); - if (fieldNeedingOptions == &m_wellPathName) + if ( fieldNeedingOptions == &m_wellPathName ) { - calculateValueOptionsForWells(options); + calculateValueOptionsForWells( options ); } - else if (fieldNeedingOptions == &m_selectedSources) + else if ( fieldNeedingOptions == &m_selectedSources ) { std::set optionAddresses; - const std::vector rftCases = RimWellPlotTools::rftCasesForWell(simWellName); + const std::vector rftCases = RimWellPlotTools::rftCasesForWell( simWellName ); std::set availableRftSources; - for (const auto& rftCase : rftCases) + for ( const auto& rftCase : rftCases ) { - std::set channelTypesToUse = RifEclipseRftAddress::pltPlotChannelTypes(); + std::set channelTypesToUse = + RifEclipseRftAddress::pltPlotChannelTypes(); - std::set rftTimes = rftCase->rftReader()->availableTimeSteps(simWellName, channelTypesToUse); - if (!rftTimes.empty()) + std::set rftTimes = rftCase->rftReader()->availableTimeSteps( simWellName, channelTypesToUse ); + if ( !rftTimes.empty() ) { - availableRftSources.insert(RifDataSourceForRftPlt(RifDataSourceForRftPlt::RFT, rftCase)); + availableRftSources.insert( RifDataSourceForRftPlt( RifDataSourceForRftPlt::RFT, rftCase ) ); } } - if (!availableRftSources.empty()) + if ( !availableRftSources.empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::RFT ), + true ) ); - for (const auto& addr : availableRftSources) + for ( const auto& addr : availableRftSources ) { - auto item = caf::PdmOptionItemInfo(addr.eclCase()->caseUserDescription(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto item = caf::PdmOptionItemInfo( addr.eclCase()->caseUserDescription(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } } - const std::vector gridCases = RimWellPlotTools::gridCasesForWell(simWellName); - if (!gridCases.empty()) + const std::vector gridCases = RimWellPlotTools::gridCasesForWell( simWellName ); + if ( !gridCases.empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::GRID ), + true ) ); } - for (const auto& gridCase : gridCases) + for ( const auto& gridCase : gridCases ) { - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::GRID, gridCase); - auto item = caf::PdmOptionItemInfo(gridCase->caseUserDescription(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::GRID, gridCase ); + auto item = caf::PdmOptionItemInfo( gridCase->caseUserDescription(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } - if (!RimWellPlotTools::wellLogFilesContainingFlow(m_wellPathName).empty()) + if ( !RimWellPlotTools::wellLogFilesContainingFlow( m_wellPathName ).empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::OBSERVED ), + true ) ); - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED); - auto item = caf::PdmOptionItemInfo("Observed Data", QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); - optionAddresses.insert(addr); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED ); + auto item = caf::PdmOptionItemInfo( "Observed Data", QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); + optionAddresses.insert( addr ); } } - else if (fieldNeedingOptions == &m_selectedTimeSteps) + else if ( fieldNeedingOptions == &m_selectedTimeSteps ) { std::set channelTypesToUse = RifEclipseRftAddress::pltPlotChannelTypes(); - RimWellPlotTools::calculateValueOptionsForTimeSteps( - RimWellPlotTools::simWellName(m_wellPathName), selectedSourcesExpanded(), channelTypesToUse, options); + RimWellPlotTools::calculateValueOptionsForTimeSteps( RimWellPlotTools::simWellName( m_wellPathName ), + selectedSourcesExpanded(), + channelTypesToUse, + options ); } - if (fieldNeedingOptions == &m_phases) + if ( fieldNeedingOptions == &m_phases ) { - options.push_back(caf::PdmOptionItemInfo("Oil", FLOW_PHASE_OIL)); - options.push_back(caf::PdmOptionItemInfo("Gas", FLOW_PHASE_GAS)); - options.push_back(caf::PdmOptionItemInfo("Water", FLOW_PHASE_WATER)); - options.push_back(caf::PdmOptionItemInfo("Total", FLOW_PHASE_TOTAL)); + options.push_back( caf::PdmOptionItemInfo( "Oil", FLOW_PHASE_OIL ) ); + options.push_back( caf::PdmOptionItemInfo( "Gas", FLOW_PHASE_GAS ) ); + options.push_back( caf::PdmOptionItemInfo( "Water", FLOW_PHASE_WATER ) ); + options.push_back( caf::PdmOptionItemInfo( "Total", FLOW_PHASE_TOTAL ) ); } return options; @@ -856,39 +876,43 @@ QList RimWellPltPlot::calculateValueOptions(const caf::P //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimWellPltPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - RimWellLogPlot::fieldChangedByUi(changedField, oldValue, newValue); + RimWellLogPlot::fieldChangedByUi( changedField, oldValue, newValue ); - if (changedField == &m_wellPathName) + if ( changedField == &m_wellPathName ) { - setDescription(QString(plotNameFormatString()).arg(m_wellPathName)); + setDescription( QString( plotNameFormatString() ).arg( m_wellPathName ) ); } - if (changedField == &m_wellPathName) + if ( changedField == &m_wellPathName ) { - RimWellLogTrack* const plotTrack = trackByIndex(0); + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); plotTrack->deleteAllCurves(); m_selectedSources.v().clear(); m_selectedTimeSteps.v().clear(); updateFormationsOnPlot(); } - else if (changedField == &m_selectedSources) + else if ( changedField == &m_selectedSources ) { RimProject* project = RiaApplication::instance()->project(); - RimWellPath* wellPath = project->wellPathByName(m_wellPathName()); - if (wellPath && !wellPath->wellPathGeometry()) + RimWellPath* wellPath = project->wellPathByName( m_wellPathName() ); + if ( wellPath && !wellPath->wellPathGeometry() ) { - for (const RifDataSourceForRftPlt& address : m_selectedSources()) + for ( const RifDataSourceForRftPlt& address : m_selectedSources() ) { - if (address.sourceType() == RifDataSourceForRftPlt::RFT || address.sourceType() == RifDataSourceForRftPlt::GRID) + if ( address.sourceType() == RifDataSourceForRftPlt::RFT || + address.sourceType() == RifDataSourceForRftPlt::GRID ) { - if (!wellPath->wellPathGeometry()) + if ( !wellPath->wellPathGeometry() ) { - QString tmp = QString("Display of Measured Depth (MD) for Grid or RFT curves is not possible without a " - "well log path, and the curve will be hidden in this mode.\n\n"); + QString tmp = QString( + "Display of Measured Depth (MD) for Grid or RFT curves is not possible without a " + "well log path, and the curve will be hidden in this mode.\n\n" ); - QMessageBox::warning(nullptr, "Grid/RFT curve without MD", tmp); + QMessageBox::warning( nullptr, "Grid/RFT curve without MD", tmp ); // Do not show multiple dialogs break; @@ -898,24 +922,24 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c } } - if (changedField == &m_selectedSources || changedField == &m_selectedTimeSteps) + if ( changedField == &m_selectedSources || changedField == &m_selectedTimeSteps ) { updateFormationsOnPlot(); syncSourcesIoFieldFromGuiField(); syncCurvesFromUiSelection(); updateDepthZoom(); - RimWellLogTrack* const plotTrack = trackByIndex(0); + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); plotTrack->calculateXZoomRangeAndUpdateQwt(); } - if (changedField == &m_useStandardConditionCurves || changedField == &m_useReservoirConditionCurves || - changedField == &m_phases) + if ( changedField == &m_useStandardConditionCurves || changedField == &m_useReservoirConditionCurves || + changedField == &m_phases ) { syncCurvesFromUiSelection(); updateDepthZoom(); - RimWellLogTrack* const plotTrack = trackByIndex(0); + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); plotTrack->calculateXZoomRangeAndUpdateQwt(); } } @@ -923,63 +947,64 @@ void RimWellPltPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) +void RimWellPltPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { - uiTreeOrdering.skipRemainingChildren(true); + uiTreeOrdering.skipRemainingChildren( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimWellPltPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - const QString simWellName = RimWellPlotTools::simWellName(m_wellPathName); + const QString simWellName = RimWellPlotTools::simWellName( m_wellPathName ); - uiOrdering.add(&m_wellPathName); + uiOrdering.add( &m_wellPathName ); - caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources"); - sourcesGroup->add(&m_selectedSources); + caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword( "Sources", "Sources" ); + sourcesGroup->add( &m_selectedSources ); - caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword("Time Steps", "TimeSteps"); - timeStepsGroup->add(&m_selectedTimeSteps); + caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword( "Time Steps", "TimeSteps" ); + timeStepsGroup->add( &m_selectedTimeSteps ); - caf::PdmUiGroup* flowGroup = uiOrdering.addNewGroupWithKeyword("Curve Selection", "PhaseSelection"); - flowGroup->add(&m_useStandardConditionCurves); - flowGroup->add(&m_useReservoirConditionCurves); + caf::PdmUiGroup* flowGroup = uiOrdering.addNewGroupWithKeyword( "Curve Selection", "PhaseSelection" ); + flowGroup->add( &m_useStandardConditionCurves ); + flowGroup->add( &m_useReservoirConditionCurves ); - flowGroup->add(&m_phases); + flowGroup->add( &m_phases ); - if (trackCount() > 0) + if ( trackCount() > 0 ) { - RimWellLogTrack* track = trackByIndex(0); + RimWellLogTrack* track = trackByIndex( 0 ); - track->uiOrderingForRftPltFormations(uiOrdering); + track->uiOrderingForRftPltFormations( uiOrdering ); - caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup("Legend and Axis"); - legendAndAxisGroup->setCollapsedByDefault(true); + caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" ); + legendAndAxisGroup->setCollapsedByDefault( true ); - uiOrderingForPlotSettings(*legendAndAxisGroup); + uiOrderingForPlotSettings( *legendAndAxisGroup ); - track->uiOrderingForXAxisSettings(*legendAndAxisGroup); + track->uiOrderingForXAxisSettings( *legendAndAxisGroup ); - uiOrderingForDepthAxis(*legendAndAxisGroup); + uiOrderingForDepthAxis( *legendAndAxisGroup ); } - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::defineEditorAttribute(const caf::PdmFieldHandle* field, - QString uiConfigName, - caf::PdmUiEditorAttribute* attribute) +void RimWellPltPlot::defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) { - if (field == &m_phases) + if ( field == &m_phases ) { - caf::PdmUiTreeSelectionEditorAttribute* attrib = dynamic_cast(attribute); - attrib->showTextFilter = false; - attrib->showToggleAllCheckbox = false; + caf::PdmUiTreeSelectionEditorAttribute* attrib = dynamic_cast( + attribute ); + attrib->showTextFilter = false; + attrib->showToggleAllCheckbox = false; } } @@ -990,14 +1015,14 @@ void RimWellPltPlot::initAfterRead() { RimViewWindow::initAfterRead(); - if (m_wellLogPlot_OBSOLETE) + if ( m_wellLogPlot_OBSOLETE ) { - RimWellLogPlot& wellLogPlot = dynamic_cast(*this); - wellLogPlot = std::move(*m_wellLogPlot_OBSOLETE.value()); - m_wellLogPlot_OBSOLETE = nullptr; + RimWellLogPlot& wellLogPlot = dynamic_cast( *this ); + wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() ); + m_wellLogPlot_OBSOLETE = nullptr; } - if (m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot()) + if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() ) { m_showTitleInPlot = m_showPlotTitle_OBSOLETE(); } @@ -1022,9 +1047,9 @@ void RimWellPltPlot::setupBeforeSave() void RimWellPltPlot::initAfterLoad() { std::vector selectedSources; - for (RimDataSourceForRftPlt* addr : m_selectedSourcesForIo) + for ( RimDataSourceForRftPlt* addr : m_selectedSourcesForIo ) { - selectedSources.push_back(addr->address()); + selectedSources.push_back( addr->address() ); } m_selectedSources = selectedSources; } @@ -1036,32 +1061,32 @@ void RimWellPltPlot::syncSourcesIoFieldFromGuiField() { m_selectedSourcesForIo.clear(); - for (const RifDataSourceForRftPlt& addr : m_selectedSources()) + for ( const RifDataSourceForRftPlt& addr : m_selectedSources() ) { - m_selectedSourcesForIo.push_back(new RimDataSourceForRftPlt(addr)); + m_selectedSourcesForIo.push_back( new RimDataSourceForRftPlt( addr ) ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellPltPlot::calculateValueOptionsForWells(QList& options) +void RimWellPltPlot::calculateValueOptionsForWells( QList& options ) { RimProject* proj = RiaApplication::instance()->project(); - if (proj != nullptr) + if ( proj != nullptr ) { // Observed wells - for (const RimWellPath* const wellPath : proj->allWellPaths()) + for ( const RimWellPath* const wellPath : proj->allWellPaths() ) { const QString wellName = wellPath->name(); - if (wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData(wellPath)) - options.push_back(caf::PdmOptionItemInfo(wellName, wellName)); + if ( wellPath->wellPathGeometry() || RimWellPlotTools::hasFlowData( wellPath ) ) + options.push_back( caf::PdmOptionItemInfo( wellName, wellName ) ); } } - options.push_back(caf::PdmOptionItemInfo("None", "")); + options.push_back( caf::PdmOptionItemInfo( "None", "" ) ); } //-------------------------------------------------------------------------------------------------- @@ -1069,17 +1094,17 @@ void RimWellPltPlot::calculateValueOptionsForWells(QList //-------------------------------------------------------------------------------------------------- void RimWellPltPlot::onLoadDataAndUpdate() { - if (m_doInitAfterLoad) + if ( m_doInitAfterLoad ) { initAfterLoad(); m_doInitAfterLoad = false; } - if (m_isOnLoad) + if ( m_isOnLoad ) { - if (trackCount() > 0) + if ( trackCount() > 0 ) { - trackByIndex(0)->setShowFormations(true); + trackByIndex( 0 )->setShowFormations( true ); } m_isOnLoad = false; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h index bee034c70e..e222eeee9f 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellPltPlot.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -22,18 +22,18 @@ #include "RimWellLogPlot.h" #include "RimWellPlotTools.h" +#include "cafPdmChildArrayField.h" #include "cafPdmField.h" #include "cafPdmObject.h" #include "cafPdmPtrField.h" -#include "cafPdmChildArrayField.h" #include "cvfCollection.h" -#include #include #include +#include -#include #include +#include class RimEclipseCase; class RimEclipseResultCase; @@ -45,18 +45,19 @@ class RimWellLogTrack; class RiaRftPltCurveDefinition; class RimDataSourceForRftPlt; - -namespace cvf { - class Color3f; +namespace cvf +{ +class Color3f; } -namespace caf { - class PdmOptionItemInfo; +namespace caf +{ +class PdmOptionItemInfo; } //================================================================================================== -/// -/// +/// +/// //================================================================================================== class RimWellPltPlot : public RimWellLogPlot { @@ -68,64 +69,69 @@ public: RimWellPltPlot(); ~RimWellPltPlot() override; - void setCurrentWellName(const QString& currWellName); - - static const char* plotNameFormatString(); + void setCurrentWellName( const QString& currWellName ); + static const char* plotNameFormatString(); protected: // Overridden PDM methods - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool * useOptionsOnly) override; - void calculateValueOptionsForWells(QList& options); + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + void calculateValueOptionsForWells( QList& options ); - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; - void onLoadDataAndUpdate() override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineEditorAttribute( const caf::PdmFieldHandle* field, + QString uiConfigName, + caf::PdmUiEditorAttribute* attribute ) override; + void onLoadDataAndUpdate() override; - void initAfterRead() override; - void setupBeforeSave() override; - void initAfterLoad(); + void initAfterRead() override; + void setupBeforeSave() override; + void initAfterLoad(); private: - void syncSourcesIoFieldFromGuiField(); - void syncCurvesFromUiSelection(); + void syncSourcesIoFieldFromGuiField(); + void syncCurvesFromUiSelection(); - std::set selectedCurveDefs() const; - void addStackedCurve(const QString& tracerName, + std::set selectedCurveDefs() const; + void addStackedCurve( const QString& tracerName, const std::vector& depthValues, const std::vector& accFlow, RimWellLogTrack* plotTrack, cvf::Color3f color, int curveGroupId, - bool doFillCurve); + bool doFillCurve ); std::vector selectedSourcesExpanded() const; // RimViewWindow overrides - void setPlotXAxisTitles(RimWellLogTrack* plotTrack); + void setPlotXAxisTitles( RimWellLogTrack* plotTrack ); - void updateFormationsOnPlot() const; + void updateFormationsOnPlot() const; std::set availableDepthTypes() const override; + private: - caf::PdmField m_showPlotTitle_OBSOLETE; + caf::PdmField m_showPlotTitle_OBSOLETE; - caf::PdmField m_wellPathName; + caf::PdmField m_wellPathName; - caf::PdmField> m_selectedSources; - caf::PdmChildArrayField m_selectedSourcesForIo; + caf::PdmField> m_selectedSources; + caf::PdmChildArrayField m_selectedSourcesForIo; - caf::PdmField> m_selectedTimeSteps; + caf::PdmField> m_selectedTimeSteps; - caf::PdmChildField m_wellLogPlot_OBSOLETE; + caf::PdmChildField m_wellLogPlot_OBSOLETE; - caf::PdmField m_useStandardConditionCurves; - caf::PdmField m_useReservoirConditionCurves; + caf::PdmField m_useStandardConditionCurves; + caf::PdmField m_useReservoirConditionCurves; caf::PdmField>> m_phases; - bool m_doInitAfterLoad; - bool m_isOnLoad; + bool m_doInitAfterLoad; + bool m_isOnLoad; }; diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp index 22af489755..76c2eb1f13 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.cpp @@ -61,7 +61,7 @@ #include #include -CAF_PDM_SOURCE_INIT(RimWellRftPlot, "WellRftPlot"); +CAF_PDM_SOURCE_INIT( RimWellRftPlot, "WellRftPlot" ); //-------------------------------------------------------------------------------------------------- /// @@ -74,43 +74,43 @@ const char RimWellRftPlot::PLOT_NAME_QFORMAT_STRING[] = "RFT: %1"; RimWellRftPlot::RimWellRftPlot() : RimWellLogPlot() { - CAF_PDM_InitObject("RFT Plot", ":/RFTPlot16x16.png", "", ""); + CAF_PDM_InitObject( "RFT Plot", ":/RFTPlot16x16.png", "", "" ); - CAF_PDM_InitField(&m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", ""); - m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField( &m_showPlotTitle_OBSOLETE, "ShowPlotTitle", false, "Show Plot Title", "", "", "" ); + m_showPlotTitle_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField(&m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", ""); - CAF_PDM_InitField(&m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", ""); + CAF_PDM_InitField( &m_showStatisticsCurves, "ShowStatisticsCurves", true, "Show Statistics Curves", "", "", "" ); + CAF_PDM_InitField( &m_showEnsembleCurves, "ShowEnsembleCurves", true, "Show Ensemble Curves", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_wellLogPlot_OBSOLETE, "WellLog", "Well Log", "", "", ""); - m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden(true); - m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitFieldNoDefault( &m_wellLogPlot_OBSOLETE, "WellLog", "Well Log", "", "", "" ); + m_wellLogPlot_OBSOLETE.uiCapability()->setUiHidden( true ); + m_wellLogPlot_OBSOLETE.xmlCapability()->setIOWritable( false ); m_depthType = RimWellLogPlot::TRUE_VERTICAL_DEPTH; - CAF_PDM_InitFieldNoDefault(&m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", ""); - CAF_PDM_InitField(&m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", ""); - CAF_PDM_InitField(&m_branchDetection, - "BranchDetection", - true, - "Branch Detection", - "", - "Compute branches based on how simulation well cells are organized", - ""); + CAF_PDM_InitFieldNoDefault( &m_wellPathNameOrSimWellName, "WellName", "Well Name", "", "", "" ); + CAF_PDM_InitField( &m_branchIndex, "BranchIndex", 0, "Branch Index", "", "", "" ); + CAF_PDM_InitField( &m_branchDetection, + "BranchDetection", + true, + "Branch Detection", + "", + "Compute branches based on how simulation well cells are organized", + "" ); - CAF_PDM_InitFieldNoDefault(&m_selectedSources, "Sources", "Sources", "", "", ""); - m_selectedSources.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault( &m_selectedSources, "Sources", "Sources", "", "", "" ); + m_selectedSources.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedSources.xmlCapability()->disableIO(); - m_selectedSources.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); - m_selectedSources.uiCapability()->setAutoAddingOptionFromValue(false); + m_selectedSources.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + m_selectedSources.uiCapability()->setAutoAddingOptionFromValue( false ); - CAF_PDM_InitFieldNoDefault(&m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", ""); - m_selectedTimeSteps.uiCapability()->setUiEditorTypeName(caf::PdmUiTreeSelectionEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault( &m_selectedTimeSteps, "TimeSteps", "Time Steps", "", "", "" ); + m_selectedTimeSteps.uiCapability()->setUiEditorTypeName( caf::PdmUiTreeSelectionEditor::uiEditorTypeName() ); m_selectedTimeSteps.xmlCapability()->disableIO(); - m_selectedTimeSteps.uiCapability()->setUiLabelPosition(caf::PdmUiItemInfo::HIDDEN); - m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue(false); + m_selectedTimeSteps.uiCapability()->setUiLabelPosition( caf::PdmUiItemInfo::HIDDEN ); + m_selectedTimeSteps.uiCapability()->setAutoAddingOptionFromValue( false ); - m_nameConfig->setCustomName("RFT Plot"); + m_nameConfig->setCustomName( "RFT Plot" ); m_trackLegendsHorizontal = true; this->setAsPlotMdiWindow(); @@ -130,22 +130,22 @@ RimWellRftPlot::~RimWellRftPlot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve) +void RimWellRftPlot::applyCurveAppearance( RimWellLogCurve* newCurve ) { - RiaRftPltCurveDefinition newCurveDef = RimWellPlotTools::curveDefFromCurve(newCurve); + RiaRftPltCurveDefinition newCurveDef = RimWellPlotTools::curveDefFromCurve( newCurve ); RiuQwtPlotCurve::LineStyleEnum currentLineStyle = RiuQwtPlotCurve::STYLE_SOLID; cvf::Color3f currentColor; - if (newCurveDef.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT) + if ( newCurveDef.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT ) { - RifDataSourceForRftPlt sourceAddress(RifDataSourceForRftPlt::ENSEMBLE_RFT, newCurveDef.address().ensemble()); + RifDataSourceForRftPlt sourceAddress( RifDataSourceForRftPlt::ENSEMBLE_RFT, newCurveDef.address().ensemble() ); currentColor = m_dataSourceColors[sourceAddress]; - if (m_showStatisticsCurves) + if ( m_showStatisticsCurves ) { - cvf::Color3f backgroundColor = - RiaColorTools::fromQColorTo3f(trackByIndex(0)->viewer()->canvasBackground().color()); - currentColor = RiaColorTools::blendCvfColors(backgroundColor, currentColor, 2, 1); + cvf::Color3f backgroundColor = RiaColorTools::fromQColorTo3f( + trackByIndex( 0 )->viewer()->canvasBackground().color() ); + currentColor = RiaColorTools::blendCvfColors( backgroundColor, currentColor, 2, 1 ); } } else @@ -154,20 +154,20 @@ void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve) } RiuQwtSymbol::PointSymbolEnum currentSymbol = RiuQwtSymbol::SYMBOL_NONE; - if (newCurveDef.address().sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT) + if ( newCurveDef.address().sourceType() != RifDataSourceForRftPlt::ENSEMBLE_RFT ) { currentSymbol = m_timeStepSymbols[newCurveDef.timeStep()]; } - bool isObservedData = newCurveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED || + bool isObservedData = newCurveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED || newCurveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT; // Observed data currentLineStyle = isObservedData ? RiuQwtPlotCurve::STYLE_NONE : RiuQwtPlotCurve::STYLE_SOLID; - newCurve->setColor(currentColor); - newCurve->setSymbolEdgeColor(currentColor); - newCurve->setSymbol(currentSymbol); - newCurve->setLineStyle(currentLineStyle); + newCurve->setColor( currentColor ); + newCurve->setSymbolEdgeColor( currentColor ); + newCurve->setSymbol( currentSymbol ); + newCurve->setLineStyle( currentLineStyle ); } //-------------------------------------------------------------------------------------------------- @@ -175,33 +175,35 @@ void RimWellRftPlot::applyCurveAppearance(RimWellLogCurve* newCurve) //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::updateFormationsOnPlot() const { - if (trackCount() > 0) + if ( trackCount() > 0 ) { RimProject* proj = RiaApplication::instance()->project(); - RimWellPath* wellPath = proj->wellPathByName(m_wellPathNameOrSimWellName); + RimWellPath* wellPath = proj->wellPathByName( m_wellPathNameOrSimWellName ); - RimCase* formationNamesCase = trackByIndex(0)->formationNamesCase(); + RimCase* formationNamesCase = trackByIndex( 0 )->formationNamesCase(); - if (!formationNamesCase) + if ( !formationNamesCase ) { /// Set default case. Todo : Use the first of the selected cases in the plot std::vector cases; - proj->allCases(cases); + proj->allCases( cases ); - if (!cases.empty()) + if ( !cases.empty() ) { formationNamesCase = cases[0]; } } - if (wellPath) + if ( wellPath ) { - trackByIndex(0)->setAndUpdateWellPathFormationNamesData(formationNamesCase, wellPath); + trackByIndex( 0 )->setAndUpdateWellPathFormationNamesData( formationNamesCase, wellPath ); } else { - trackByIndex(0)->setAndUpdateSimWellFormationNamesAndBranchData( - formationNamesCase, associatedSimWellName(), m_branchIndex, m_branchDetection); + trackByIndex( 0 )->setAndUpdateSimWellFormationNamesAndBranchData( formationNamesCase, + associatedSimWellName(), + m_branchIndex, + m_branchDetection ); } } } @@ -211,7 +213,7 @@ void RimWellRftPlot::updateFormationsOnPlot() const //-------------------------------------------------------------------------------------------------- QString RimWellRftPlot::associatedSimWellName() const { - return RimWellPlotTools::simWellName(m_wellPathNameOrSimWellName); + return RimWellPlotTools::simWellName( m_wellPathNameOrSimWellName ); } //-------------------------------------------------------------------------------------------------- @@ -222,33 +224,35 @@ void RimWellRftPlot::applyInitialSelections() std::vector sourcesToSelect; const QString simWellName = associatedSimWellName(); - for (RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell(simWellName)) + for ( RimEclipseResultCase* const rftCase : RimWellPlotTools::rftCasesForWell( simWellName ) ) { - sourcesToSelect.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::RFT, rftCase)); + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::RFT, rftCase ) ); } - for (RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell(simWellName)) + for ( RimEclipseResultCase* const gridCase : RimWellPlotTools::gridCasesForWell( simWellName ) ) { - sourcesToSelect.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::GRID, gridCase)); + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::GRID, gridCase ) ); } - for (RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell(m_wellPathNameOrSimWellName)) + for ( RimSummaryCaseCollection* const ensemble : RimWellPlotTools::rftEnsemblesForWell( m_wellPathNameOrSimWellName ) ) { - sourcesToSelect.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::ENSEMBLE_RFT, ensemble)); + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, ensemble ) ); } - std::vector wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName); - if (!wellLogFiles.empty()) + std::vector wellLogFiles = RimWellPlotTools::wellLogFilesContainingPressure( + m_wellPathNameOrSimWellName ); + if ( !wellLogFiles.empty() ) { - for (RimWellLogFile* const wellLogFile : wellLogFiles) + for ( RimWellLogFile* const wellLogFile : wellLogFiles ) { - sourcesToSelect.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED, wellLogFile)); + sourcesToSelect.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED, wellLogFile ) ); } } - for (RimObservedFmuRftData* const observedFmuRftData : RimWellPlotTools::observedFmuRftData()) + for ( RimObservedFmuRftData* const observedFmuRftData : RimWellPlotTools::observedFmuRftData() ) { - sourcesToSelect.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED_FMU_RFT, observedFmuRftData)); + sourcesToSelect.push_back( + RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED_FMU_RFT, observedFmuRftData ) ); } m_selectedSources = sourcesToSelect; @@ -256,12 +260,13 @@ void RimWellRftPlot::applyInitialSelections() { std::set channelTypesToUse = RifEclipseRftAddress::rftPlotChannelTypes(); - auto relevantTimeSteps = - RimWellPlotTools::calculateRelevantTimeStepsFromCases(m_wellPathNameOrSimWellName, m_selectedSources, channelTypesToUse); + auto relevantTimeSteps = RimWellPlotTools::calculateRelevantTimeStepsFromCases( m_wellPathNameOrSimWellName, + m_selectedSources, + channelTypesToUse ); std::vector timeStepVector; - for (const auto& item : relevantTimeSteps) - timeStepVector.push_back(item.first); + for ( const auto& item : relevantTimeSteps ) + timeStepVector.push_back( item.first ); m_selectedTimeSteps = timeStepVector; } @@ -278,21 +283,21 @@ void RimWellRftPlot::updateEditorsFromCurves() std::set selectedTimeSteps; std::map> selectedTimeStepsMap; - for (const RiaRftPltCurveDefinition& curveDef : curveDefsFromCurves()) + for ( const RiaRftPltCurveDefinition& curveDef : curveDefsFromCurves() ) { - if (curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED) - selectedSources.insert(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED)); + if ( curveDef.address().sourceType() == RifDataSourceForRftPlt::OBSERVED ) + selectedSources.insert( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED ) ); else - selectedSources.insert(curveDef.address()); + selectedSources.insert( curveDef.address() ); auto newTimeStepMap = std::map>{ {curveDef.timeStep(), std::set{curveDef.address()}}}; - RimWellPlotTools::addTimeStepsToMap(selectedTimeStepsMap, newTimeStepMap); - selectedTimeSteps.insert(curveDef.timeStep()); + RimWellPlotTools::addTimeStepsToMap( selectedTimeStepsMap, newTimeStepMap ); + selectedTimeSteps.insert( curveDef.timeStep() ); } - m_selectedSources = std::vector(selectedSources.begin(), selectedSources.end()); - m_selectedTimeSteps = std::vector(selectedTimeSteps.begin(), selectedTimeSteps.end()); + m_selectedSources = std::vector( selectedSources.begin(), selectedSources.end() ); + m_selectedTimeSteps = std::vector( selectedTimeSteps.begin(), selectedTimeSteps.end() ); } //-------------------------------------------------------------------------------------------------- @@ -300,7 +305,7 @@ void RimWellRftPlot::updateEditorsFromCurves() //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::syncCurvesFromUiSelection() { - RimWellLogTrack* plotTrack = trackByIndex(0); + RimWellLogTrack* plotTrack = trackByIndex( 0 ); const std::set& allCurveDefs = selectedCurveDefs(); const std::set& curveDefsInPlot = curveDefsFromCurves(); @@ -308,37 +313,37 @@ void RimWellRftPlot::syncCurvesFromUiSelection() std::set curvesToDelete; std::set newCurveDefs; - if (allCurveDefs.size() < curveDefsInPlot.size()) + if ( allCurveDefs.size() < curveDefsInPlot.size() ) { // Determine which curves to delete from plot std::set deleteCurveDefs; - std::set_difference(curveDefsInPlot.begin(), - curveDefsInPlot.end(), - allCurveDefs.begin(), - allCurveDefs.end(), - std::inserter(deleteCurveDefs, deleteCurveDefs.end())); + std::set_difference( curveDefsInPlot.begin(), + curveDefsInPlot.end(), + allCurveDefs.begin(), + allCurveDefs.end(), + std::inserter( deleteCurveDefs, deleteCurveDefs.end() ) ); - for (RimWellLogCurve* const curve : plotTrack->curvesVector()) + for ( RimWellLogCurve* const curve : plotTrack->curvesVector() ) { - RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve(curve); - if (deleteCurveDefs.count(curveDef) > 0) + RiaRftPltCurveDefinition curveDef = RimWellPlotTools::curveDefFromCurve( curve ); + if ( deleteCurveDefs.count( curveDef ) > 0 ) { - curvesToDelete.insert(curve); + curvesToDelete.insert( curve ); } } } else { // Determine which curves are new since last time - std::set_difference(allCurveDefs.begin(), - allCurveDefs.end(), - curveDefsInPlot.begin(), - curveDefsInPlot.end(), - std::inserter(newCurveDefs, newCurveDefs.end())); + std::set_difference( allCurveDefs.begin(), + allCurveDefs.end(), + curveDefsInPlot.begin(), + curveDefsInPlot.end(), + std::inserter( newCurveDefs, newCurveDefs.end() ) ); } - updateCurvesInPlot(allCurveDefs, newCurveDefs, curvesToDelete); + updateCurvesInPlot( allCurveDefs, newCurveDefs, curvesToDelete ); } //-------------------------------------------------------------------------------------------------- @@ -348,8 +353,11 @@ std::set RimWellRftPlot::selectedCurveDefs() const { std::set channelTypesToUse = RifEclipseRftAddress::rftPlotChannelTypes(); - return RimWellPlotTools::curveDefsFromTimesteps( - m_wellPathNameOrSimWellName, m_selectedTimeSteps.v(), true, selectedSourcesExpanded(), channelTypesToUse); + return RimWellPlotTools::curveDefsFromTimesteps( m_wellPathNameOrSimWellName, + m_selectedTimeSteps.v(), + true, + selectedSourcesExpanded(), + channelTypesToUse ); } //-------------------------------------------------------------------------------------------------- @@ -359,10 +367,10 @@ std::set RimWellRftPlot::curveDefsFromCurves() const { std::set curveDefs; - RimWellLogTrack* const plotTrack = trackByIndex(0); - for (RimWellLogCurve* const curve : plotTrack->curvesVector()) + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); + for ( RimWellLogCurve* const curve : plotTrack->curvesVector() ) { - curveDefs.insert(RimWellPlotTools::curveDefFromCurve(curve)); + curveDefs.insert( RimWellPlotTools::curveDefFromCurve( curve ) ); } return curveDefs; } @@ -370,162 +378,170 @@ std::set RimWellRftPlot::curveDefsFromCurves() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::updateCurvesInPlot(const std::set& allCurveDefs, - const std::set& curveDefsToAdd, - const std::set& curvesToDelete) +void RimWellRftPlot::updateCurvesInPlot( const std::set& allCurveDefs, + const std::set& curveDefsToAdd, + const std::set& curvesToDelete ) { const QString simWellName = associatedSimWellName(); - RimWellLogTrack* const plotTrack = trackByIndex(0); + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); // Delete curves plotTrack->deleteAllCurves(); - defineCurveColorsAndSymbols(allCurveDefs); + defineCurveColorsAndSymbols( allCurveDefs ); - std::set ensemblesWithSummaryCurves; + std::set ensemblesWithSummaryCurves; // Add new curves - for (const RiaRftPltCurveDefinition& curveDefToAdd : allCurveDefs) + for ( const RiaRftPltCurveDefinition& curveDefToAdd : allCurveDefs ) { - if (curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::RFT) + if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::RFT ) { auto curve = new RimWellLogRftCurve(); - plotTrack->addCurve(curve); + plotTrack->addCurve( curve ); auto rftCase = curveDefToAdd.address().eclCase(); - curve->setEclipseResultCase(dynamic_cast(rftCase)); + curve->setEclipseResultCase( dynamic_cast( rftCase ) ); - RifEclipseRftAddress address(simWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE); - curve->setRftAddress(address); - curve->setZOrder(1); - curve->setSimWellBranchData(m_branchDetection, m_branchIndex); + RifEclipseRftAddress address( simWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE ); + curve->setRftAddress( address ); + curve->setZOrder( 1 ); + curve->setSimWellBranchData( m_branchDetection, m_branchIndex ); - applyCurveAppearance(curve); + applyCurveAppearance( curve ); } - else if (curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT) + else if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::OBSERVED_FMU_RFT ) { auto curve = new RimWellLogRftCurve(); - plotTrack->addCurve(curve); + plotTrack->addCurve( curve ); - auto observedFmuRftData = curveDefToAdd.address().observedFmuRftData(); - curve->setObservedFmuRftData(observedFmuRftData); - RifEclipseRftAddress address(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE); - curve->setRftAddress(address); - curve->setZOrder(RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED); - applyCurveAppearance(curve); + auto observedFmuRftData = curveDefToAdd.address().observedFmuRftData(); + curve->setObservedFmuRftData( observedFmuRftData ); + RifEclipseRftAddress address( m_wellPathNameOrSimWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::PRESSURE ); + curve->setRftAddress( address ); + curve->setZOrder( RiuQwtPlotCurve::Z_SINGLE_CURVE_OBSERVED ); + applyCurveAppearance( curve ); } - else if (m_showEnsembleCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT) + else if ( m_showEnsembleCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::SUMMARY_RFT ) { auto curve = new RimWellLogRftCurve(); - plotTrack->addCurve(curve); + plotTrack->addCurve( curve ); auto rftCase = curveDefToAdd.address().summaryCase(); - curve->setSummaryCase(rftCase); - curve->setEnsemble(curveDefToAdd.address().ensemble()); - curve->setObservedFmuRftData(this->findObservedFmuData(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep())); - RifEclipseRftAddress address(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep(), RifEclipseRftAddress::PRESSURE); - curve->setRftAddress(address); - curve->setZOrder(1); - applyCurveAppearance(curve); + curve->setSummaryCase( rftCase ); + curve->setEnsemble( curveDefToAdd.address().ensemble() ); + curve->setObservedFmuRftData( + this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) ); + RifEclipseRftAddress address( m_wellPathNameOrSimWellName, + curveDefToAdd.timeStep(), + RifEclipseRftAddress::PRESSURE ); + curve->setRftAddress( address ); + curve->setZOrder( 1 ); + applyCurveAppearance( curve ); - bool isFirstSummaryCurveInEnsemble = ensemblesWithSummaryCurves.count(curveDefToAdd.address().ensemble()) == 0u; - curve->showLegend(isFirstSummaryCurveInEnsemble); - ensemblesWithSummaryCurves.insert(curveDefToAdd.address().ensemble()); + bool isFirstSummaryCurveInEnsemble = ensemblesWithSummaryCurves.count( curveDefToAdd.address().ensemble() ) == + 0u; + curve->showLegend( isFirstSummaryCurveInEnsemble ); + ensemblesWithSummaryCurves.insert( curveDefToAdd.address().ensemble() ); } - else if (m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT) + else if ( m_showStatisticsCurves && curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT ) { - RimSummaryCaseCollection* ensemble = curveDefToAdd.address().ensemble(); - std::set rftAddresses = - ensemble->rftStatisticsReader()->eclipseRftAddresses(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep()); - for (auto rftAddress : rftAddresses) + RimSummaryCaseCollection* ensemble = curveDefToAdd.address().ensemble(); + std::set rftAddresses = ensemble->rftStatisticsReader() + ->eclipseRftAddresses( m_wellPathNameOrSimWellName, + curveDefToAdd.timeStep() ); + for ( auto rftAddress : rftAddresses ) { - if (rftAddress.wellLogChannel() != RifEclipseRftAddress::TVD) + if ( rftAddress.wellLogChannel() != RifEclipseRftAddress::TVD ) { auto curve = new RimWellLogRftCurve(); - plotTrack->addCurve(curve); - curve->setEnsemble(ensemble); - curve->setRftAddress(rftAddress); - curve->setObservedFmuRftData(this->findObservedFmuData(m_wellPathNameOrSimWellName, curveDefToAdd.timeStep())); - curve->setZOrder(RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE); - applyCurveAppearance(curve); - auto symbol = statisticsCurveSymbolFromAddress(rftAddress); - RiuQwtSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress(rftAddress); - curve->setSymbol(symbol); - curve->setSymbolLabelPosition(labelPos); - curve->setSymbolSize(curve->symbolSize() + 3); - curve->setSymbolSkipDistance(150); - curve->setLineStyle(RiuQwtPlotCurve::STYLE_SOLID); - QString uiText = - caf::AppEnum::uiText(rftAddress.wellLogChannel()); - QString label = uiText.replace("Pressure", ""); - curve->setSymbolLabel(label); + plotTrack->addCurve( curve ); + curve->setEnsemble( ensemble ); + curve->setRftAddress( rftAddress ); + curve->setObservedFmuRftData( + this->findObservedFmuData( m_wellPathNameOrSimWellName, curveDefToAdd.timeStep() ) ); + curve->setZOrder( RiuQwtPlotCurve::Z_ENSEMBLE_STAT_CURVE ); + applyCurveAppearance( curve ); + auto symbol = statisticsCurveSymbolFromAddress( rftAddress ); + RiuQwtSymbol::LabelPosition labelPos = statisticsLabelPosFromAddress( rftAddress ); + curve->setSymbol( symbol ); + curve->setSymbolLabelPosition( labelPos ); + curve->setSymbolSize( curve->symbolSize() + 3 ); + curve->setSymbolSkipDistance( 150 ); + curve->setLineStyle( RiuQwtPlotCurve::STYLE_SOLID ); + QString uiText = caf::AppEnum::uiText( + rftAddress.wellLogChannel() ); + QString label = uiText.replace( "Pressure", "" ); + curve->setSymbolLabel( label ); } } } - else if (curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::GRID) + else if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::GRID ) { auto curve = new RimWellLogExtractionCurve(); - plotTrack->addCurve(curve); + plotTrack->addCurve( curve ); - cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f(plotTrack->curveCount()); - curve->setColor(curveColor); - curve->setFromSimulationWellName(simWellName, m_branchIndex, m_branchDetection); + cvf::Color3f curveColor = RiaColorTables::wellLogPlotPaletteColors().cycledColor3f( plotTrack->curveCount() ); + curve->setColor( curveColor ); + curve->setFromSimulationWellName( simWellName, m_branchIndex, m_branchDetection ); // Fetch cases and time steps auto gridCase = curveDefToAdd.address().eclCase(); - if (gridCase != nullptr) + if ( gridCase != nullptr ) { // Case - curve->setCase(gridCase); - curve->setEclipseResultVariable("PRESSURE"); + curve->setCase( gridCase ); + curve->setEclipseResultVariable( "PRESSURE" ); // Time step std::vector timeSteps = - gridCase->eclipseCaseData()->results(RiaDefines::MATRIX_MODEL)->timeStepDates(); + gridCase->eclipseCaseData()->results( RiaDefines::MATRIX_MODEL )->timeStepDates(); int currentTimeStepIndex = -1; - for (size_t tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx) + for ( size_t tsIdx = 0; tsIdx < timeSteps.size(); ++tsIdx ) { - if (timeSteps[tsIdx] == curveDefToAdd.timeStep()) + if ( timeSteps[tsIdx] == curveDefToAdd.timeStep() ) { - currentTimeStepIndex = static_cast(tsIdx); + currentTimeStepIndex = static_cast( tsIdx ); break; } } - curve->setCurrentTimeStep(currentTimeStepIndex); - curve->setZOrder(0); + curve->setCurrentTimeStep( currentTimeStepIndex ); + curve->setZOrder( 0 ); - applyCurveAppearance(curve); + applyCurveAppearance( curve ); } } - else if (curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::OBSERVED) + else if ( curveDefToAdd.address().sourceType() == RifDataSourceForRftPlt::OBSERVED ) { RimWellLogFile* const wellLogFile = curveDefToAdd.address().wellLogFile(); - RimWellPath* const wellPath = RimWellPlotTools::wellPathFromWellLogFile(wellLogFile); - if (wellLogFile != nullptr) + RimWellPath* const wellPath = RimWellPlotTools::wellPathFromWellLogFile( wellLogFile ); + if ( wellLogFile != nullptr ) { - RimWellLogFileChannel* pressureChannel = RimWellPlotTools::getPressureChannelFromWellFile(wellLogFile); + RimWellLogFileChannel* pressureChannel = RimWellPlotTools::getPressureChannelFromWellFile( wellLogFile ); auto curve = new RimWellLogFileCurve(); - plotTrack->addCurve(curve); - curve->setWellPath(wellPath); - curve->setWellLogFile(wellLogFile); - curve->setWellLogChannelName(pressureChannel->name()); - curve->setZOrder(2); + plotTrack->addCurve( curve ); + curve->setWellPath( wellPath ); + curve->setWellLogFile( wellLogFile ); + curve->setWellLogChannelName( pressureChannel->name() ); + curve->setZOrder( 2 ); - applyCurveAppearance(curve); + applyCurveAppearance( curve ); } } } - if (depthType() == RimWellLogPlot::MEASURED_DEPTH) + if ( depthType() == RimWellLogPlot::MEASURED_DEPTH ) { assignWellPathToExtractionCurves(); } RimWellLogPlot::onLoadDataAndUpdate(); - if (plotTrack->curveCount()) + if ( plotTrack->curveCount() ) { zoomAll(); } @@ -537,18 +553,18 @@ void RimWellRftPlot::updateCurvesInPlot(const std::set std::vector RimWellRftPlot::selectedSourcesExpanded() const { std::vector sources; - for (const RifDataSourceForRftPlt& addr : m_selectedSources()) + for ( const RifDataSourceForRftPlt& addr : m_selectedSources() ) { - if (addr.sourceType() == RifDataSourceForRftPlt::OBSERVED) + if ( addr.sourceType() == RifDataSourceForRftPlt::OBSERVED ) { - for (RimWellLogFile* const wellLogFile : - RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName)) + for ( RimWellLogFile* const wellLogFile : + RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName ) ) { - sources.push_back(RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED, wellLogFile)); + sources.push_back( RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED, wellLogFile ) ); } } else - sources.push_back(addr); + sources.push_back( addr ); } return sources; } @@ -564,10 +580,10 @@ const QString& RimWellRftPlot::simWellOrWellPathName() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::setSimWellOrWellPathName(const QString& currWellName) +void RimWellRftPlot::setSimWellOrWellPathName( const QString& currWellName ) { m_wellPathNameOrSimWellName = currWellName; - if (m_wellPathNameOrSimWellName().isEmpty()) + if ( m_wellPathNameOrSimWellName().isEmpty() ) { m_wellPathNameOrSimWellName = "None"; } @@ -592,122 +608,130 @@ const char* RimWellRftPlot::plotNameFormatString() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData(const RimObservedFmuRftData* observedFmuRftData) +void RimWellRftPlot::deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData ) { - for (auto track : tracks()) - { + for ( auto track : tracks() ) + { auto curves = track->curvesVector(); - for (auto curve : curves) - { - RimWellLogRftCurve* rftCurve = dynamic_cast(curve); - if (rftCurve && rftCurve->observedFmuRftData() == observedFmuRftData) - { - track->takeOutCurve(rftCurve); + for ( auto curve : curves ) + { + RimWellLogRftCurve* rftCurve = dynamic_cast( curve ); + if ( rftCurve && rftCurve->observedFmuRftData() == observedFmuRftData ) + { + track->takeOutCurve( rftCurve ); delete rftCurve; - } - } - } + } + } + } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimWellRftPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList RimWellRftPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { - QList options = RimWellLogPlot::calculateValueOptions(fieldNeedingOptions, useOptionsOnly); + QList options = RimWellLogPlot::calculateValueOptions( fieldNeedingOptions, useOptionsOnly ); const QString simWellName = associatedSimWellName(); - if (fieldNeedingOptions == &m_wellPathNameOrSimWellName) + if ( fieldNeedingOptions == &m_wellPathNameOrSimWellName ) { - calculateValueOptionsForWells(options); + calculateValueOptionsForWells( options ); } - else if (fieldNeedingOptions == &m_selectedSources) + else if ( fieldNeedingOptions == &m_selectedSources ) { - const std::vector rftCases = RimWellPlotTools::rftCasesForWell(simWellName); - if (!rftCases.empty()) + const std::vector rftCases = RimWellPlotTools::rftCasesForWell( simWellName ); + if ( !rftCases.empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::RFT), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::RFT ), + true ) ); - for (const auto& rftCase : rftCases) + for ( const auto& rftCase : rftCases ) { - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::RFT, rftCase); - auto item = caf::PdmOptionItemInfo(rftCase->caseUserDescription(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::RFT, rftCase ); + auto item = caf::PdmOptionItemInfo( rftCase->caseUserDescription(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } } - const std::vector rftEnsembles = RimWellPlotTools::rftEnsemblesForWell(m_wellPathNameOrSimWellName); - if (!rftEnsembles.empty()) + const std::vector rftEnsembles = RimWellPlotTools::rftEnsemblesForWell( + m_wellPathNameOrSimWellName ); + if ( !rftEnsembles.empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::ENSEMBLE_RFT), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::ENSEMBLE_RFT ), + true ) ); - for (RimSummaryCaseCollection* rftEnsemble : rftEnsembles) + for ( RimSummaryCaseCollection* rftEnsemble : rftEnsembles ) { - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::ENSEMBLE_RFT, rftEnsemble); - auto item = caf::PdmOptionItemInfo(rftEnsemble->name(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::ENSEMBLE_RFT, rftEnsemble ); + auto item = caf::PdmOptionItemInfo( rftEnsemble->name(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } } - const std::vector gridCases = RimWellPlotTools::gridCasesForWell(simWellName); - if (!gridCases.empty()) + const std::vector gridCases = RimWellPlotTools::gridCasesForWell( simWellName ); + if ( !gridCases.empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::GRID), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::GRID ), + true ) ); - for (const auto& gridCase : gridCases) + for ( const auto& gridCase : gridCases ) { - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::GRID, gridCase); - auto item = caf::PdmOptionItemInfo(gridCase->caseUserDescription(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::GRID, gridCase ); + auto item = caf::PdmOptionItemInfo( gridCase->caseUserDescription(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } } - if (!RimWellPlotTools::wellLogFilesContainingPressure(m_wellPathNameOrSimWellName).empty()) + if ( !RimWellPlotTools::wellLogFilesContainingPressure( m_wellPathNameOrSimWellName ).empty() ) { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED), true)); + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::OBSERVED ), + true ) ); - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED); - auto item = caf::PdmOptionItemInfo("Observed Data", QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED ); + auto item = caf::PdmOptionItemInfo( "Observed Data", QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); } - const std::vector observedFmuRftCases = RimWellPlotTools::observedFmuRftDataForWell(m_wellPathNameOrSimWellName); - if (!observedFmuRftCases.empty()) - { - options.push_back(caf::PdmOptionItemInfo::createHeader( - RifDataSourceForRftPlt::sourceTypeUiText(RifDataSourceForRftPlt::OBSERVED_FMU_RFT), true)); - - for (const auto& observedFmuRftCase : observedFmuRftCases) - { - auto addr = RifDataSourceForRftPlt(RifDataSourceForRftPlt::OBSERVED_FMU_RFT, observedFmuRftCase); - auto item = caf::PdmOptionItemInfo(observedFmuRftCase->name(), QVariant::fromValue(addr)); - item.setLevel(1); - options.push_back(item); - } - } + const std::vector observedFmuRftCases = RimWellPlotTools::observedFmuRftDataForWell( + m_wellPathNameOrSimWellName ); + if ( !observedFmuRftCases.empty() ) + { + options.push_back( caf::PdmOptionItemInfo::createHeader( RifDataSourceForRftPlt::sourceTypeUiText( + RifDataSourceForRftPlt::OBSERVED_FMU_RFT ), + true ) ); + for ( const auto& observedFmuRftCase : observedFmuRftCases ) + { + auto addr = RifDataSourceForRftPlt( RifDataSourceForRftPlt::OBSERVED_FMU_RFT, observedFmuRftCase ); + auto item = caf::PdmOptionItemInfo( observedFmuRftCase->name(), QVariant::fromValue( addr ) ); + item.setLevel( 1 ); + options.push_back( item ); + } + } } - else if (fieldNeedingOptions == &m_selectedTimeSteps) + else if ( fieldNeedingOptions == &m_selectedTimeSteps ) { std::set channelTypesToUse = RifEclipseRftAddress::rftPlotChannelTypes(); - RimWellPlotTools::calculateValueOptionsForTimeSteps( - m_wellPathNameOrSimWellName, selectedSourcesExpanded(), channelTypesToUse, options); + RimWellPlotTools::calculateValueOptionsForTimeSteps( m_wellPathNameOrSimWellName, + selectedSourcesExpanded(), + channelTypesToUse, + options ); } - else if (fieldNeedingOptions == &m_branchIndex) + else if ( fieldNeedingOptions == &m_branchIndex ) { - auto simulationWellBranches = RiaSimWellBranchTools::simulationWellBranches(simWellName, m_branchDetection); + auto simulationWellBranches = RiaSimWellBranchTools::simulationWellBranches( simWellName, m_branchDetection ); - options = RiaSimWellBranchTools::valueOptionsForBranchIndexField(simulationWellBranches); + options = RiaSimWellBranchTools::valueOptionsForBranchIndexField( simulationWellBranches ); } return options; @@ -716,18 +740,20 @@ QList RimWellRftPlot::calculateValueOptions(const caf::P //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimWellRftPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - RimWellLogPlot::fieldChangedByUi(changedField, oldValue, newValue); + RimWellLogPlot::fieldChangedByUi( changedField, oldValue, newValue ); - if (changedField == &m_wellPathNameOrSimWellName) + if ( changedField == &m_wellPathNameOrSimWellName ) { - setDescription(QString(plotNameFormatString()).arg(m_wellPathNameOrSimWellName)); + setDescription( QString( plotNameFormatString() ).arg( m_wellPathNameOrSimWellName ) ); m_branchIndex = 0; - RimWellLogTrack* const plotTrack = trackByIndex(0); - if (plotTrack) + RimWellLogTrack* const plotTrack = trackByIndex( 0 ); + if ( plotTrack ) { plotTrack->deleteAllCurves(); } @@ -735,27 +761,27 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c updateEditorsFromCurves(); updateFormationsOnPlot(); } - else if (changedField == &m_branchIndex || changedField == &m_branchDetection) + else if ( changedField == &m_branchIndex || changedField == &m_branchDetection ) { const QString simWellName = associatedSimWellName(); - m_branchIndex = RiaSimWellBranchTools::clampBranchIndex(simWellName, m_branchIndex, m_branchDetection); + m_branchIndex = RiaSimWellBranchTools::clampBranchIndex( simWellName, m_branchIndex, m_branchDetection ); updateFormationsOnPlot(); syncCurvesFromUiSelection(); } - else if (changedField == &m_selectedSources || changedField == &m_selectedTimeSteps) + else if ( changedField == &m_selectedSources || changedField == &m_selectedTimeSteps ) { updateFormationsOnPlot(); syncCurvesFromUiSelection(); this->updateConnectedEditors(); } - else if (changedField == &m_showStatisticsCurves || changedField == &m_showEnsembleCurves) + else if ( changedField == &m_showStatisticsCurves || changedField == &m_showEnsembleCurves ) { updateFormationsOnPlot(); syncCurvesFromUiSelection(); } - else if (changedField == &m_showTitleInPlot) + else if ( changedField == &m_showTitleInPlot ) { // m_wellLogPlot->setShowDescription(m_showPlotTitle); } @@ -764,128 +790,130 @@ void RimWellRftPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) +void RimWellRftPlot::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) { - uiTreeOrdering.skipRemainingChildren(true); + uiTreeOrdering.skipRemainingChildren( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimWellRftPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add(&m_wellPathNameOrSimWellName); - uiOrdering.add(&m_showStatisticsCurves); - uiOrdering.add(&m_showEnsembleCurves); + uiOrdering.add( &m_wellPathNameOrSimWellName ); + uiOrdering.add( &m_showStatisticsCurves ); + uiOrdering.add( &m_showEnsembleCurves ); bool showingEnsembleData = false; - for (const RifDataSourceForRftPlt& dataSource : m_selectedSources()) + for ( const RifDataSourceForRftPlt& dataSource : m_selectedSources() ) { - if (dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT) + if ( dataSource.sourceType() == RifDataSourceForRftPlt::ENSEMBLE_RFT ) { showingEnsembleData = true; break; } } - m_showStatisticsCurves.uiCapability()->setUiReadOnly(!showingEnsembleData); - m_showEnsembleCurves.uiCapability()->setUiReadOnly(!showingEnsembleData); + m_showStatisticsCurves.uiCapability()->setUiReadOnly( !showingEnsembleData ); + m_showEnsembleCurves.uiCapability()->setUiReadOnly( !showingEnsembleData ); - RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName( - &uiOrdering, m_wellPathNameOrSimWellName, m_branchDetection, m_branchIndex); + RiaSimWellBranchTools::appendSimWellBranchFieldsIfRequiredFromWellName( &uiOrdering, + m_wellPathNameOrSimWellName, + m_branchDetection, + m_branchIndex ); - caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword("Sources", "Sources"); - sourcesGroup->add(&m_selectedSources); + caf::PdmUiGroup* sourcesGroup = uiOrdering.addNewGroupWithKeyword( "Sources", "Sources" ); + sourcesGroup->add( &m_selectedSources ); - caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword("Time Steps", "TimeSteps"); - timeStepsGroup->add(&m_selectedTimeSteps); + caf::PdmUiGroup* timeStepsGroup = uiOrdering.addNewGroupWithKeyword( "Time Steps", "TimeSteps" ); + timeStepsGroup->add( &m_selectedTimeSteps ); - if (trackCount() > 0) + if ( trackCount() > 0 ) { - RimWellLogTrack* track = trackByIndex(0); + RimWellLogTrack* track = trackByIndex( 0 ); - track->uiOrderingForRftPltFormations(uiOrdering); + track->uiOrderingForRftPltFormations( uiOrdering ); - caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup("Legend and Axis"); - legendAndAxisGroup->setCollapsedByDefault(true); + caf::PdmUiGroup* legendAndAxisGroup = uiOrdering.addNewGroup( "Legend and Axis" ); + legendAndAxisGroup->setCollapsedByDefault( true ); - uiOrderingForPlotSettings(*legendAndAxisGroup); - track->uiOrderingForXAxisSettings(*legendAndAxisGroup); - uiOrderingForDepthAxis(*legendAndAxisGroup); + uiOrderingForPlotSettings( *legendAndAxisGroup ); + track->uiOrderingForXAxisSettings( *legendAndAxisGroup ); + uiOrderingForDepthAxis( *legendAndAxisGroup ); } - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::calculateValueOptionsForWells(QList& options) +void RimWellRftPlot::calculateValueOptionsForWells( QList& options ) { RimProject* proj = RiaApplication::instance()->project(); - options.push_back(caf::PdmOptionItemInfo("None", "None")); + options.push_back( caf::PdmOptionItemInfo( "None", "None" ) ); - if (proj != nullptr) + if ( proj != nullptr ) { const std::vector simWellNames = proj->simulationWellNames(); std::set simWellsAssociatedWithWellPath; std::map wellNames; // Observed wells - for (RimWellPath* const wellPath : proj->allWellPaths()) + for ( RimWellPath* const wellPath : proj->allWellPaths() ) { - wellNames[wellPath->name()].push_back("Well Path"); + wellNames[wellPath->name()].push_back( "Well Path" ); - if (!wellPath->associatedSimulationWellName().isEmpty()) + if ( !wellPath->associatedSimulationWellName().isEmpty() ) { - simWellsAssociatedWithWellPath.insert(wellPath->associatedSimulationWellName()); + simWellsAssociatedWithWellPath.insert( wellPath->associatedSimulationWellName() ); } } // Sim wells not associated with well path - for (const QString& simWellName : simWellNames) + for ( const QString& simWellName : simWellNames ) { - if (simWellsAssociatedWithWellPath.count(simWellName) == 0) + if ( simWellsAssociatedWithWellPath.count( simWellName ) == 0 ) { - wellNames[simWellName].push_back("Sim.Well"); + wellNames[simWellName].push_back( "Sim.Well" ); } } const std::vector rftEnsembles = RimWellPlotTools::rftEnsembles(); - // Ensemble RFT wells + // Ensemble RFT wells { - for (RimSummaryCaseCollection* summaryCaseColl : rftEnsembles) + for ( RimSummaryCaseCollection* summaryCaseColl : rftEnsembles ) { std::set wellsWithRftData = summaryCaseColl->wellsWithRftData(); - for (QString wellName : wellsWithRftData) + for ( QString wellName : wellsWithRftData ) { - wellNames[wellName].push_back("Ensemble"); + wellNames[wellName].push_back( "Ensemble" ); } } } - // Observed FMU RFT wells + // Observed FMU RFT wells const std::vector allRftFmuData = RimWellPlotTools::observedFmuRftData(); - if (!allRftFmuData.empty()) - { - for (RimObservedFmuRftData* rftFmuData : allRftFmuData) - { - for (QString wellName : rftFmuData->wells()) - { - wellNames[wellName].push_back("Observed"); - } - } - } - - for (const auto& wellName : wellNames) + if ( !allRftFmuData.empty() ) { - const QStringList& tags = wellName.second; - QString uiText = wellName.first; - if (!tags.empty()) + for ( RimObservedFmuRftData* rftFmuData : allRftFmuData ) { - uiText += QString(" (%1)").arg(wellName.second.join(", ")); + for ( QString wellName : rftFmuData->wells() ) + { + wellNames[wellName].push_back( "Observed" ); + } + } + } + + for ( const auto& wellName : wellNames ) + { + const QStringList& tags = wellName.second; + QString uiText = wellName.first; + if ( !tags.empty() ) + { + uiText += QString( " (%1)" ).arg( wellName.second.join( ", " ) ); } - options.push_back(caf::PdmOptionItemInfo(uiText, wellName.first)); + options.push_back( caf::PdmOptionItemInfo( uiText, wellName.first ) ); } } } @@ -895,11 +923,11 @@ void RimWellRftPlot::calculateValueOptionsForWells(QList //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::onLoadDataAndUpdate() { - if (m_isOnLoad) + if ( m_isOnLoad ) { - if (trackCount() > 0) + if ( trackCount() > 0 ) { - trackByIndex(0)->setShowFormations(true); + trackByIndex( 0 )->setShowFormations( true ); } m_isOnLoad = false; @@ -908,7 +936,7 @@ void RimWellRftPlot::onLoadDataAndUpdate() updateMdiWindowVisibility(); updateFormationsOnPlot(); - if (depthType() == RimWellLogPlot::MEASURED_DEPTH) + if ( depthType() == RimWellLogPlot::MEASURED_DEPTH ) { assignWellPathToExtractionCurves(); } @@ -923,17 +951,17 @@ void RimWellRftPlot::onLoadDataAndUpdate() //-------------------------------------------------------------------------------------------------- void RimWellRftPlot::initAfterRead() { - if (m_wellLogPlot_OBSOLETE) + if ( m_wellLogPlot_OBSOLETE ) { - RimWellLogPlot& wellLogPlot = dynamic_cast(*this); - wellLogPlot = std::move(*m_wellLogPlot_OBSOLETE.value()); - m_wellLogPlot_OBSOLETE = nullptr; + RimWellLogPlot& wellLogPlot = dynamic_cast( *this ); + wellLogPlot = std::move( *m_wellLogPlot_OBSOLETE.value() ); + m_wellLogPlot_OBSOLETE = nullptr; } - if (m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot()) + if ( m_showPlotTitle_OBSOLETE() && !m_showTitleInPlot() ) { m_showTitleInPlot = m_showPlotTitle_OBSOLETE(); } - + RimWellLogPlot::initAfterRead(); } @@ -943,17 +971,17 @@ void RimWellRftPlot::initAfterRead() void RimWellRftPlot::assignWellPathToExtractionCurves() { RimProject* proj = RiaApplication::instance()->project(); - RimWellPath* wellPath = proj->wellPathByName(m_wellPathNameOrSimWellName); + RimWellPath* wellPath = proj->wellPathByName( m_wellPathNameOrSimWellName ); - if (wellPath) + if ( wellPath ) { - for (RimWellLogCurve* curve : trackByIndex(0)->curvesVector()) + for ( RimWellLogCurve* curve : trackByIndex( 0 )->curvesVector() ) { - auto extractionCurve = dynamic_cast(curve); - if (extractionCurve) + auto extractionCurve = dynamic_cast( curve ); + if ( extractionCurve ) { - extractionCurve->setTrajectoryType(RimWellLogExtractionCurve::WELL_PATH); - extractionCurve->setWellPath(wellPath); + extractionCurve->setTrajectoryType( RimWellLogExtractionCurve::WELL_PATH ); + extractionCurve->setWellPath( wellPath ); } } } @@ -962,9 +990,9 @@ void RimWellRftPlot::assignWellPathToExtractionCurves() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAddress(const RifEclipseRftAddress& address) +RiuQwtSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ) { - switch (address.wellLogChannel()) + switch ( address.wellLogChannel() ) { case RifEclipseRftAddress::PRESSURE_P10: return RiuQwtSymbol::SYMBOL_TRIANGLE; @@ -981,9 +1009,9 @@ RiuQwtSymbol::PointSymbolEnum RimWellRftPlot::statisticsCurveSymbolFromAddress(c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -RiuQwtSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress(const RifEclipseRftAddress& address) +RiuQwtSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ) { - switch (address.wellLogChannel()) + switch ( address.wellLogChannel() ) { case RifEclipseRftAddress::PRESSURE_P10: return RiuQwtSymbol::LabelLeftOfSymbol; @@ -1000,13 +1028,13 @@ RiuQwtSymbol::LabelPosition RimWellRftPlot::statisticsLabelPosFromAddress(const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellRftPlot::defineCurveColorsAndSymbols(const std::set& allCurveDefs) +void RimWellRftPlot::defineCurveColorsAndSymbols( const std::set& allCurveDefs ) { m_dataSourceColors.clear(); m_timeStepSymbols.clear(); std::vector colorTable; - RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector(&colorTable); + RiaColorTables::summaryCurveDefaultPaletteColors().color3fArray().toStdVector( &colorTable ); std::vector symbolTable = {RiuQwtSymbol::SYMBOL_ELLIPSE, RiuQwtSymbol::SYMBOL_RECT, @@ -1016,25 +1044,25 @@ void RimWellRftPlot::defineCurveColorsAndSymbols(const std::setrftReader()->availableTimeSteps(wellPathName).count(timeStep)) + if ( observedData->rftReader()->availableTimeSteps( wellPathName ).count( timeStep ) ) { return observedData; } diff --git a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h index 786d0c80bd..e06b7a221e 100644 --- a/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h +++ b/ApplicationCode/ProjectDataModel/Flow/RimWellRftPlot.h @@ -74,7 +74,7 @@ public: ~RimWellRftPlot() override; const QString& simWellOrWellPathName() const; - void setSimWellOrWellPathName(const QString& currWellName); + void setSimWellOrWellPathName( const QString& currWellName ); int branchIndex() const; @@ -82,49 +82,52 @@ public: static const char* plotNameFormatString(); - void deleteCurvesAssosicatedWithObservedData(const RimObservedFmuRftData* observedFmuRftData); + void deleteCurvesAssosicatedWithObservedData( const RimObservedFmuRftData* observedFmuRftData ); protected: - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName ) override; - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override; + QList 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 initAfterRead() override; private: - void calculateValueOptionsForWells(QList& options); + void calculateValueOptionsForWells( QList& options ); void updateEditorsFromCurves(); void syncCurvesFromUiSelection(); void assignWellPathToExtractionCurves(); - RimObservedFmuRftData* findObservedFmuData(const QString& wellPathName, const QDateTime& timeStep) const; + RimObservedFmuRftData* findObservedFmuData( const QString& wellPathName, const QDateTime& timeStep ) const; std::set selectedCurveDefs() const; std::set curveDefsFromCurves() const; - void updateCurvesInPlot(const std::set& allCurveDefs, - const std::set& curveDefsToAdd, - const std::set& curvesToDelete); + void updateCurvesInPlot( const std::set& allCurveDefs, + const std::set& curveDefsToAdd, + const std::set& curvesToDelete ); std::vector selectedSourcesExpanded() const; // RimViewWindow overrides - void applyCurveAppearance(RimWellLogCurve* newCurve); + void applyCurveAppearance( RimWellLogCurve* newCurve ); void updateFormationsOnPlot() const; QString associatedSimWellName() const; - static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress(const RifEclipseRftAddress& address); - static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress(const RifEclipseRftAddress& address); + static RiuQwtSymbol::PointSymbolEnum statisticsCurveSymbolFromAddress( const RifEclipseRftAddress& address ); + static RiuQwtSymbol::LabelPosition statisticsLabelPosFromAddress( const RifEclipseRftAddress& address ); - void defineCurveColorsAndSymbols(const std::set& allCurveDefs); + void defineCurveColorsAndSymbols( const std::set& allCurveDefs ); void onDepthTypeChanged() override; + private: caf::PdmField m_wellPathNameOrSimWellName; caf::PdmField m_branchIndex; @@ -139,7 +142,7 @@ private: caf::PdmField m_showPlotTitle_OBSOLETE; caf::PdmChildField m_wellLogPlot_OBSOLETE; - std::map m_dataSourceColors; + std::map m_dataSourceColors; std::map m_timeStepSymbols; - bool m_isOnLoad; + bool m_isOnLoad; }; diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp index 54766f0ef4..9c1f398469 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.cpp @@ -43,41 +43,40 @@ #include -CAF_PDM_SOURCE_INIT(RimGridCrossPlot, "RimGridCrossPlot"); +CAF_PDM_SOURCE_INIT( 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_showLegend, "ShowLegend", true, "Show Legend", "", "", ""); - CAF_PDM_InitField(&m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", ""); - m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum(RiaApplication::instance()->preferences()->defaultPlotFontSize()); + CAF_PDM_InitField( &m_showInfoBox, "ShowInfoBox", true, "Show Info Box", "", "", "" ); + CAF_PDM_InitField( &m_showLegend, "ShowLegend", true, "Show Legend", "", "", "" ); + CAF_PDM_InitField( &m_legendFontSize, "LegendFontSize", 10, "Legend and Info Font Size", "", "", "" ); + m_legendFontSize = RiaFontCache::pointSizeFromFontSizeEnum( + RiaApplication::instance()->preferences()->defaultPlotFontSize() ); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name Config", "", "", ""); - m_nameConfig.uiCapability()->setUiTreeHidden(true); - m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name Config", "", "", "" ); + m_nameConfig.uiCapability()->setUiTreeHidden( true ); + m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_nameConfig = new RimGridCrossPlotNameConfig(); - CAF_PDM_InitFieldNoDefault(&m_xAxisProperties, "xAxisProperties", "X Axis", "", "", ""); - m_xAxisProperties.uiCapability()->setUiTreeHidden(true); + CAF_PDM_InitFieldNoDefault( &m_xAxisProperties, "xAxisProperties", "X Axis", "", "", "" ); + m_xAxisProperties.uiCapability()->setUiTreeHidden( true ); m_xAxisProperties = new RimPlotAxisProperties; - m_xAxisProperties->setNameAndAxis("X-Axis", QwtPlot::xBottom); - m_xAxisProperties->setEnableTitleTextSettings(false); + m_xAxisProperties->setNameAndAxis( "X-Axis", QwtPlot::xBottom ); + m_xAxisProperties->setEnableTitleTextSettings( false ); - CAF_PDM_InitFieldNoDefault(&m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", ""); - m_yAxisProperties.uiCapability()->setUiTreeHidden(true); + CAF_PDM_InitFieldNoDefault( &m_yAxisProperties, "yAxisProperties", "Y Axis", "", "", "" ); + m_yAxisProperties.uiCapability()->setUiTreeHidden( true ); m_yAxisProperties = new RimPlotAxisProperties; - m_yAxisProperties->setNameAndAxis("Y-Axis", QwtPlot::yLeft); - m_yAxisProperties->setEnableTitleTextSettings(false); - - CAF_PDM_InitFieldNoDefault(&m_crossPlotDataSets, "CrossPlotCurve", "Cross Plot Data Set", "", "", ""); - m_crossPlotDataSets.uiCapability()->setUiHidden(true); - + m_yAxisProperties->setNameAndAxis( "Y-Axis", QwtPlot::yLeft ); + m_yAxisProperties->setEnableTitleTextSettings( false ); + 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* dataSet = new RimGridCrossPlotDataSet(); - m_crossPlotDataSets.push_back(dataSet); + m_crossPlotDataSets.push_back( dataSet ); return dataSet; } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -int RimGridCrossPlot::indexOfDataSet(const RimGridCrossPlotDataSet* dataSetToCheck) const +int RimGridCrossPlot::indexOfDataSet( const RimGridCrossPlotDataSet* dataSetToCheck ) const { int index = 0; - for (auto dataSet : m_crossPlotDataSets()) + for ( auto dataSet : m_crossPlotDataSets() ) { - if (dataSet == dataSetToCheck) + if ( dataSet == dataSetToCheck ) { return index; } - if (dataSet->isChecked() && dataSet->visibleCurveCount() > 0u) + if ( dataSet->isChecked() && dataSet->visibleCurveCount() > 0u ) { 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; - if (m_qwtPlot) + if ( m_qwtPlot ) { - QPixmap pix = QPixmap::grabWidget(m_qwtPlot); + QPixmap pix = QPixmap::grabWidget( m_qwtPlot ); image = pix.toImage(); } @@ -164,16 +163,16 @@ QImage RimGridCrossPlot::snapshotWindowContent() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::zoomAll() { - if (!m_qwtPlot) return; + if ( !m_qwtPlot ) return; - setAutoZoomForAllAxes(true); - updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT); - updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM); + setAutoZoomForAllAxes( true ); + updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT ); + updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM ); m_qwtPlot->replot(); - updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT); - updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM); + updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT ); + updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM ); } //-------------------------------------------------------------------------------------------------- @@ -181,7 +180,7 @@ void RimGridCrossPlot::zoomAll() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt() { - if (m_qwtPlot) + if ( m_qwtPlot ) { m_qwtPlot->replot(); } @@ -192,14 +191,14 @@ void RimGridCrossPlot::calculateZoomRangeAndUpdateQwt() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::reattachCurvesToQwtAndReplot() { - if (m_qwtPlot) + if ( m_qwtPlot ) { - for (auto dataSet : m_crossPlotDataSets) + for ( auto dataSet : m_crossPlotDataSets ) { dataSet->detachAllCurves(); - if (dataSet->isChecked()) + if ( dataSet->isChecked() ) { - dataSet->setParentQwtPlotNoReplot(m_qwtPlot); + dataSet->setParentQwtPlotNoReplot( m_qwtPlot ); } } updateAxisDisplay(); @@ -212,52 +211,52 @@ void RimGridCrossPlot::reattachCurvesToQwtAndReplot() QString RimGridCrossPlot::createAutoName() const { QStringList autoName; - if (!m_nameConfig->customName().isEmpty()) + if ( !m_nameConfig->customName().isEmpty() ) { autoName += m_nameConfig->customName(); } - if (m_nameConfig->addDataSetNames()) + if ( m_nameConfig->addDataSetNames() ) { - QStringList dataSetStrings; + QStringList dataSetStrings; std::map> allNameComponents; - for (auto dataSet : m_crossPlotDataSets) + for ( auto dataSet : m_crossPlotDataSets ) { - if (dataSet->isChecked()) + if ( dataSet->isChecked() ) { 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; - 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(); - 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() { - for (auto dataSet : m_crossPlotDataSets()) + for ( auto dataSet : m_crossPlotDataSets() ) { dataSet->detachAllCurves(); } @@ -300,13 +299,13 @@ void RimGridCrossPlot::updateAxisScaling() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::updateAxisDisplay() { - if (!m_qwtPlot) return; + if ( !m_qwtPlot ) return; - updateAxisInQwt(RiaDefines::PLOT_AXIS_BOTTOM); - updateAxisInQwt(RiaDefines::PLOT_AXIS_LEFT); + updateAxisInQwt( RiaDefines::PLOT_AXIS_BOTTOM ); + updateAxisInQwt( RiaDefines::PLOT_AXIS_LEFT ); - m_qwtPlot->updateAnnotationObjects(m_xAxisProperties); - m_qwtPlot->updateAnnotationObjects(m_yAxisProperties); + m_qwtPlot->updateAnnotationObjects( m_xAxisProperties ); + m_qwtPlot->updateAnnotationObjects( m_yAxisProperties ); m_qwtPlot->replot(); } @@ -316,48 +315,48 @@ void RimGridCrossPlot::updateAxisDisplay() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::updateZoomWindowFromQwt() { - if (!m_qwtPlot) return; + if ( !m_qwtPlot ) return; - updateAxisFromQwt(RiaDefines::PLOT_AXIS_LEFT); - updateAxisFromQwt(RiaDefines::PLOT_AXIS_BOTTOM); - setAutoZoomForAllAxes(false); + updateAxisFromQwt( RiaDefines::PLOT_AXIS_LEFT ); + updateAxisFromQwt( RiaDefines::PLOT_AXIS_BOTTOM ); + setAutoZoomForAllAxes( false ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlot::selectAxisInPropertyEditor(int axis) +void RimGridCrossPlot::selectAxisInPropertyEditor( int axis ) { 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_yAxisProperties->setAutoZoom(enableAutoZoom); + m_xAxisProperties->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; } @@ -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(); } @@ -391,7 +390,7 @@ QWidget* RimGridCrossPlot::createViewWidget(QWidget* mainWindowParent) void RimGridCrossPlot::deleteViewWidget() { detachAllCurves(); - if (m_qwtPlot) + if ( m_qwtPlot ) { m_qwtPlot->deleteLater(); m_qwtPlot = nullptr; @@ -405,9 +404,9 @@ void RimGridCrossPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); - for (auto dataSet : m_crossPlotDataSets) + for ( auto dataSet : m_crossPlotDataSets ) { - dataSet->loadDataAndUpdate(false); + dataSet->loadDataAndUpdate( false ); 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_showLegend); + uiOrdering.add( &m_showInfoBox ); + 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"); - m_nameConfig->uiOrdering(uiConfigName, *nameGroup); + caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" ); + 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_yAxisProperties); + axisFolder->add( &m_xAxisProperties ); + 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, - const QVariant& oldValue, - const QVariant& newValue) +void RimGridCrossPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - if (changedField == &m_legendFontSize) + if ( changedField == &m_legendFontSize ) { - for (auto dataSet : m_crossPlotDataSets) + for ( auto dataSet : m_crossPlotDataSets ) { dataSet->updateLegendIcons(); } @@ -469,24 +468,24 @@ void RimGridCrossPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimGridCrossPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList RimGridCrossPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { QList options; - if (fieldNeedingOptions == &m_legendFontSize) + if ( fieldNeedingOptions == &m_legendFontSize ) { std::vector fontSizes; - fontSizes.push_back(8); - fontSizes.push_back(10); - fontSizes.push_back(12); - fontSizes.push_back(14); - fontSizes.push_back(16); + fontSizes.push_back( 8 ); + fontSizes.push_back( 10 ); + fontSizes.push_back( 12 ); + fontSizes.push_back( 14 ); + fontSizes.push_back( 16 ); - for (int value : fontSizes) + for ( int value : fontSizes ) { - QString text = QString("%1").arg(value); - options.push_back(caf::PdmOptionItemInfo(text, value)); + QString text = QString( "%1" ).arg( value ); + options.push_back( caf::PdmOptionItemInfo( text, value ) ); } } return options; @@ -505,31 +504,31 @@ void RimGridCrossPlot::performAutoNameUpdate() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlot::updatePlot() { - if (m_qwtPlot) + if ( m_qwtPlot ) { - RiuQwtPlotTools::setCommonPlotBehaviour(m_qwtPlot); - RiuQwtPlotTools::setDefaultAxes(m_qwtPlot); + RiuQwtPlotTools::setCommonPlotBehaviour( m_qwtPlot ); + RiuQwtPlotTools::setDefaultAxes( m_qwtPlot ); 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 - QwtLegend* legend = new QwtLegend(m_qwtPlot); + QwtLegend* legend = new QwtLegend( m_qwtPlot ); auto font = legend->font(); - font.setPointSize(m_legendFontSize()); - legend->setFont(font); - m_qwtPlot->insertLegend(legend, QwtPlot::BottomLegend); + font.setPointSize( m_legendFontSize() ); + legend->setFont( font ); + m_qwtPlot->insertLegend( legend, QwtPlot::BottomLegend ); } else { - m_qwtPlot->insertLegend(nullptr); + m_qwtPlot->insertLegend( nullptr ); } m_qwtPlot->updateLegendSizesToMatchPlot(); m_qwtPlot->replot(); @@ -541,14 +540,14 @@ void RimGridCrossPlot::updatePlot() //-------------------------------------------------------------------------------------------------- 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(); } @@ -563,17 +562,17 @@ void RimGridCrossPlot::swapAxes() QString tmpName = xAxisProperties->name(); QwtPlot::Axis tmpAxis = xAxisProperties->qwtPlotAxisType(); - xAxisProperties->setNameAndAxis(yAxisProperties->name(), yAxisProperties->qwtPlotAxisType()); - yAxisProperties->setNameAndAxis(tmpName, tmpAxis); + xAxisProperties->setNameAndAxis( yAxisProperties->name(), yAxisProperties->qwtPlotAxisType() ); + yAxisProperties->setNameAndAxis( tmpName, tmpAxis ); - m_xAxisProperties.removeChildObject(xAxisProperties); - m_yAxisProperties.removeChildObject(yAxisProperties); + m_xAxisProperties.removeChildObject( xAxisProperties ); + m_yAxisProperties.removeChildObject( yAxisProperties ); m_yAxisProperties = xAxisProperties; m_xAxisProperties = yAxisProperties; - for (auto dataSet : m_crossPlotDataSets) + for ( auto dataSet : m_crossPlotDataSets ) { - dataSet->swapAxisProperties(false); + dataSet->swapAxisProperties( false ); } 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(); } @@ -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; - QTextStream stringStream(&asciiData); + QTextStream stringStream( &asciiData ); - RifEclipseDataTableFormatter formatter(stringStream); - formatter.setCommentPrefix(""); - formatter.setTableRowPrependText(""); - formatter.setTableRowLineAppendText(""); - formatter.setColumnSpacing(3); + RifEclipseDataTableFormatter formatter( stringStream ); + formatter.setCommentPrefix( "" ); + formatter.setTableRowPrependText( "" ); + formatter.setTableRowLineAppendText( "" ); + formatter.setColumnSpacing( 3 ); - m_crossPlotDataSets[dataSetIndex]->exportFormattedData(formatter); + m_crossPlotDataSets[dataSetIndex]->exportFormattedData( formatter ); formatter.tableCompleted(); 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; } } - if (legendFontSize() != defaultFontSize) + if ( legendFontSize() != defaultFontSize ) { 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; - 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; } - if (forceChange || plotAxis->valuesFontSize() == oldFontSize) + if ( forceChange || plotAxis->valuesFontSize() == oldFontSize ) { - plotAxis->setValuesFontSize(fontSize); + plotAxis->setValuesFontSize( fontSize ); anyChange = true; } } - if (forceChange || legendFontSize() == oldFontSize) + if ( forceChange || legendFontSize() == oldFontSize ) { m_legendFontSize = fontSize; - anyChange = true; + anyChange = true; } - if (anyChange) loadDataAndUpdate(); + if ( anyChange ) loadDataAndUpdate(); return anyChange; } @@ -720,22 +722,22 @@ bool RimGridCrossPlot::applyFontSize(RiaDefines::FontSettingType fontSettingType QString RimGridCrossPlot::xAxisParameterString() const { 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(); - 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 { 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(); - 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(); QString axisParameterString = xAxisParameterString(); - if (axisType == RiaDefines::PLOT_AXIS_LEFT) + if ( axisType == RiaDefines::PLOT_AXIS_LEFT ) { axisProperties = m_yAxisProperties(); axisParameterString = yAxisParameterString(); @@ -780,110 +782,110 @@ void RimGridCrossPlot::updateAxisInQwt(RiaDefines::PlotAxis axisType) QwtPlot::Axis qwtAxisId = axisProperties->qwtPlotAxisType(); - if (axisProperties->isActive()) + if ( axisProperties->isActive() ) { - m_qwtPlot->enableAxis(qwtAxisId, true); + m_qwtPlot->enableAxis( qwtAxisId, true ); - QwtText axisTitle(axisParameterString); - QFont titleFont = m_qwtPlot->axisTitle(qwtAxisId).font(); - titleFont.setBold(true); - titleFont.setPointSize(axisProperties->titleFontSize()); - axisTitle.setFont(titleFont); + QwtText axisTitle( axisParameterString ); + QFont titleFont = m_qwtPlot->axisTitle( qwtAxisId ).font(); + titleFont.setBold( true ); + titleFont.setPointSize( axisProperties->titleFontSize() ); + axisTitle.setFont( titleFont ); - QFont valuesFont = m_qwtPlot->axisFont(qwtAxisId); - valuesFont.setPointSize(axisProperties->valuesFontSize()); - m_qwtPlot->setAxisFont(qwtAxisId, valuesFont); + QFont valuesFont = m_qwtPlot->axisFont( qwtAxisId ); + valuesFont.setPointSize( axisProperties->valuesFontSize() ); + m_qwtPlot->setAxisFont( qwtAxisId, valuesFont ); - switch (axisProperties->titlePosition()) + switch ( axisProperties->titlePosition() ) { case RimPlotAxisProperties::AXIS_TITLE_CENTER: - axisTitle.setRenderFlags(Qt::AlignCenter); + axisTitle.setRenderFlags( Qt::AlignCenter ); break; case RimPlotAxisProperties::AXIS_TITLE_END: - axisTitle.setRenderFlags(Qt::AlignRight); + axisTitle.setRenderFlags( Qt::AlignRight ); break; } - m_qwtPlot->setAxisTitle(qwtAxisId, axisTitle); + m_qwtPlot->setAxisTitle( qwtAxisId, axisTitle ); - if (axisProperties->isLogarithmicScaleEnabled) + if ( axisProperties->isLogarithmicScaleEnabled ) { - QwtLogScaleEngine* currentScaleEngine = - dynamic_cast(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())); - if (!currentScaleEngine) + QwtLogScaleEngine* currentScaleEngine = dynamic_cast( + m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) ); + if ( !currentScaleEngine ) { - m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine); - m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 5); + m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLogScaleEngine ); + m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 5 ); } - if (axisProperties->isAutoZoom()) + if ( axisProperties->isAutoZoom() ) { std::vector plotCurves = visibleQwtCurves(); double min, max; - RimPlotAxisLogRangeCalculator logRangeCalculator(qwtAxisId, plotCurves); - logRangeCalculator.computeAxisRange(&min, &max); - if (axisProperties->isAxisInverted()) + RimPlotAxisLogRangeCalculator logRangeCalculator( qwtAxisId, plotCurves ); + logRangeCalculator.computeAxisRange( &min, &max ); + if ( axisProperties->isAxisInverted() ) { - std::swap(min, max); + std::swap( min, max ); } - m_qwtPlot->setAxisScale(qwtAxisId, min, max); + m_qwtPlot->setAxisScale( qwtAxisId, min, max ); } else { - m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax); + m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax ); } } else { - QwtLinearScaleEngine* currentScaleEngine = - dynamic_cast(m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType())); - if (!currentScaleEngine) + QwtLinearScaleEngine* currentScaleEngine = dynamic_cast( + m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) ); + if ( !currentScaleEngine ) { - m_qwtPlot->setAxisScaleEngine(axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine); - m_qwtPlot->setAxisMaxMinor(axisProperties->qwtPlotAxisType(), 3); + m_qwtPlot->setAxisScaleEngine( axisProperties->qwtPlotAxisType(), new QwtLinearScaleEngine ); + m_qwtPlot->setAxisMaxMinor( axisProperties->qwtPlotAxisType(), 3 ); } - if (axisProperties->isAutoZoom()) + if ( axisProperties->isAutoZoom() ) { - m_qwtPlot->setAxisAutoScale(qwtAxisId); + m_qwtPlot->setAxisAutoScale( qwtAxisId ); } else { - m_qwtPlot->setAxisScale(qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax); + m_qwtPlot->setAxisScale( qwtAxisId, axisProperties->visibleRangeMin, axisProperties->visibleRangeMax ); } } - m_qwtPlot->axisScaleEngine(axisProperties->qwtPlotAxisType()) - ->setAttribute(QwtScaleEngine::Inverted, axisProperties->isAxisInverted()); + m_qwtPlot->axisScaleEngine( axisProperties->qwtPlotAxisType() ) + ->setAttribute( QwtScaleEngine::Inverted, axisProperties->isAxisInverted() ); } 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 yAxisRange = m_qwtPlot->currentAxisRange(QwtPlot::yLeft); + QwtInterval xAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::xBottom ); + QwtInterval yAxisRange = m_qwtPlot->currentAxisRange( QwtPlot::yLeft ); RimPlotAxisProperties* axisProperties = m_xAxisProperties(); QwtInterval axisRange = xAxisRange; - if (axisType == RiaDefines::PLOT_AXIS_LEFT) + if ( axisType == RiaDefines::PLOT_AXIS_LEFT ) { axisProperties = m_yAxisProperties(); axisRange = yAxisRange; } - axisProperties->visibleRangeMin = std::min(axisRange.minValue(), axisRange.maxValue()); - axisProperties->visibleRangeMax = std::max(axisRange.minValue(), axisRange.maxValue()); + axisProperties->visibleRangeMin = std::min( axisRange.minValue(), axisRange.maxValue() ); + axisProperties->visibleRangeMax = std::max( axisRange.minValue(), axisRange.maxValue() ); axisProperties->updateConnectedEditors(); } @@ -894,15 +896,15 @@ void RimGridCrossPlot::updateAxisFromQwt(RiaDefines::PlotAxis axisType) std::vector RimGridCrossPlot::visibleQwtCurves() const { std::vector 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; } @@ -947,7 +949,7 @@ void RimGridCrossPlot::setShowInfoBox(bool enable) //-------------------------------------------------------------------------------------------------- std::set RimGridCrossPlot::allPlotAxes() const { - return { m_xAxisProperties, m_yAxisProperties }; + return {m_xAxisProperties, m_yAxisProperties}; } //-------------------------------------------------------------------------------------------------- @@ -955,7 +957,7 @@ std::set 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() : 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); - uiOrdering.add(&addDataSetNames); + RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering ); + uiOrdering.add( &addDataSetNames ); } diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h index 99c4241211..9025d42e45 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlot.h @@ -22,8 +22,8 @@ #include "cafPdmObject.h" #include "RiaDefines.h" -#include "RimRiuQwtPlotOwnerInterface.h" #include "RimNameConfig.h" +#include "RimRiuQwtPlotOwnerInterface.h" #include "RimViewWindow.h" #include @@ -38,28 +38,29 @@ class RiuGridCrossQwtPlot; class RimGridCrossPlotNameConfig : public RimNameConfig { CAF_PDM_HEADER_INIT; + public: RimGridCrossPlotNameConfig(); + public: caf::PdmField addDataSetNames; 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 { CAF_PDM_HEADER_INIT; - + public: RimGridCrossPlot(); ~RimGridCrossPlot(); RimGridCrossPlotDataSet* createDataSet(); - int indexOfDataSet(const RimGridCrossPlotDataSet* dataSet) const; - void addDataSet(RimGridCrossPlotDataSet* dataSet); - + int indexOfDataSet( const RimGridCrossPlotDataSet* dataSet ) const; + void addDataSet( RimGridCrossPlotDataSet* dataSet ); + std::vector dataSets() const; QWidget* viewWidget() override; @@ -68,74 +69,76 @@ public: void calculateZoomRangeAndUpdateQwt(); void reattachCurvesToQwtAndReplot(); QString createAutoName() const override; - + bool showInfoBox() const; caf::PdmFieldHandle* userDescriptionField() override; void detachAllCurves(); void performAutoNameUpdate() override; void updateCurveNamesAndPlotTitle(); void swapAxes(); - QString asciiTitleForPlotExport(int dataSetIndex) const; - QString asciiDataForPlotExport(int dataSetIndex) const; + QString asciiTitleForPlotExport( int dataSetIndex ) const; + QString asciiDataForPlotExport( int dataSetIndex ) const; RiuGridCrossQwtPlot* qwtPlot() const; bool isXAxisLogarithmic() const; bool isYAxisLogarithmic() const; - void setYAxisInverted(bool inverted); + void setYAxisInverted( bool inverted ); int legendFontSize() const; - bool hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const override; - bool applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange = false) override; + bool hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const override; + bool applyFontSize( RiaDefines::FontSettingType fontSettingType, + int oldFontSize, + int fontSize, + bool forceChange = false ) override; public: // Rim2dPlotInterface overrides - void updateAxisScaling() override; - void updateAxisDisplay() override; - void updateZoomWindowFromQwt() override; - void selectAxisInPropertyEditor(int axis) override; - void setAutoZoomForAllAxes(bool enableAutoZoom) override; - caf::PdmObject* findRimPlotObjectFromQwtCurve(const QwtPlotCurve* curve) const override; + void updateAxisScaling() override; + void updateAxisDisplay() override; + void updateZoomWindowFromQwt() override; + void selectAxisInPropertyEditor( int axis ) override; + void setAutoZoomForAllAxes( bool enableAutoZoom ) override; + caf::PdmObject* findRimPlotObjectFromQwtCurve( const QwtPlotCurve* curve ) const override; protected: - QWidget* createViewWidget(QWidget* mainWindowParent) override; + QWidget* createViewWidget( QWidget* mainWindowParent ) override; void deleteViewWidget() override; void onLoadDataAndUpdate() override; - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - void defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "") override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName = "" ) override; - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; void updatePlot(); virtual QString xAxisParameterString() const; - QString yAxisParameterString() const; + QString yAxisParameterString() const; - void updateAxisInQwt(RiaDefines::PlotAxis axisType); - void updateAxisFromQwt(RiaDefines::PlotAxis axisType); + void updateAxisInQwt( RiaDefines::PlotAxis axisType ); + void updateAxisFromQwt( RiaDefines::PlotAxis axisType ); std::vector visibleQwtCurves() const; RimPlotAxisProperties* xAxisProperties(); RimPlotAxisProperties* yAxisProperties(); RimGridCrossPlotNameConfig* nameConfig(); - void setShowInfoBox(bool enable); + void setShowInfoBox( bool enable ); std::set allPlotAxes() const; + private: - caf::PdmField m_showInfoBox; - caf::PdmField m_showLegend; - caf::PdmField m_legendFontSize; - caf::PdmChildField m_nameConfig; + caf::PdmField m_showInfoBox; + caf::PdmField m_showLegend; + caf::PdmField m_legendFontSize; + caf::PdmChildField m_nameConfig; - caf::PdmChildField m_yAxisProperties; - caf::PdmChildField m_xAxisProperties; + caf::PdmChildField m_yAxisProperties; + caf::PdmChildField m_xAxisProperties; - caf::PdmChildArrayField m_crossPlotDataSets; + caf::PdmChildArrayField m_crossPlotDataSets; - QPointer m_qwtPlot; - + QPointer m_qwtPlot; }; - - - diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp index d639f173f7..5aba6b7c2a 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.cpp @@ -41,10 +41,10 @@ #include "RimEclipseResultCase.h" #include "RimEclipseResultDefinition.h" #include "RimEclipseView.h" +#include "RimFormationNames.h" #include "RimGridCrossPlot.h" #include "RimGridCrossPlotCurve.h" #include "RimGridView.h" -#include "RimFormationNames.h" #include "RimProject.h" #include "RimRegularLegendConfig.h" #include "RimTools.h" @@ -62,18 +62,18 @@ #include -CAF_PDM_SOURCE_INIT(RimGridCrossPlotDataSet, "GridCrossPlotCurveSet"); +CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSet, "GridCrossPlotCurveSet" ); namespace caf { -template<> +template <> void RimGridCrossPlotDataSet::CurveGroupingEnum::setUp() { - addItem(RigGridCrossPlotCurveGrouping::NO_GROUPING, "NONE", "Nothing"); - addItem(RigGridCrossPlotCurveGrouping::GROUP_BY_TIME, "TIME", "Time Step"); - addItem(RigGridCrossPlotCurveGrouping::GROUP_BY_FORMATION, "FORMATION", "Formations"); - addItem(RigGridCrossPlotCurveGrouping::GROUP_BY_RESULT, "RESULT", "Result Property"); - setDefault(RigGridCrossPlotCurveGrouping::NO_GROUPING); + addItem( RigGridCrossPlotCurveGrouping::NO_GROUPING, "NONE", "Nothing" ); + addItem( RigGridCrossPlotCurveGrouping::GROUP_BY_TIME, "TIME", "Time Step" ); + addItem( RigGridCrossPlotCurveGrouping::GROUP_BY_FORMATION, "FORMATION", "Formations" ); + addItem( RigGridCrossPlotCurveGrouping::GROUP_BY_RESULT, "RESULT", "Result Property" ); + setDefault( RigGridCrossPlotCurveGrouping::NO_GROUPING ); } } // namespace caf @@ -82,52 +82,52 @@ void RimGridCrossPlotDataSet::CurveGroupingEnum::setUp() //-------------------------------------------------------------------------------------------------- RimGridCrossPlotDataSet::RimGridCrossPlotDataSet() { - CAF_PDM_InitObject("Cross Plot Data Set", ":/WellLogCurve16x16.png", "", ""); + CAF_PDM_InitObject( "Cross Plot Data Set", ":/WellLogCurve16x16.png", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_case, "Case", "Case", "", "", ""); - m_case.uiCapability()->setUiTreeChildrenHidden(true); - CAF_PDM_InitField(&m_timeStep, "TimeStep", -1, "Time Step", "", "", ""); - m_timeStep.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName()); + CAF_PDM_InitFieldNoDefault( &m_case, "Case", "Case", "", "", "" ); + m_case.uiCapability()->setUiTreeChildrenHidden( true ); + CAF_PDM_InitField( &m_timeStep, "TimeStep", -1, "Time Step", "", "", "" ); + m_timeStep.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault(&m_cellFilterView, "VisibleCellView", "Filter by 3d View Visibility", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_cellFilterView, "VisibleCellView", "Filter by 3d View Visibility", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_grouping, "Grouping", "Group Data by", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_grouping, "Grouping", "Group Data by", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_xAxisProperty, "XAxisProperty", "X-Axis Property", "", "", ""); - m_xAxisProperty = new RimEclipseResultDefinition(caf::PdmUiItemInfo::TOP); - m_xAxisProperty.uiCapability()->setUiHidden(true); - m_xAxisProperty.uiCapability()->setUiTreeChildrenHidden(true); - m_xAxisProperty->setTernaryEnabled(false); + CAF_PDM_InitFieldNoDefault( &m_xAxisProperty, "XAxisProperty", "X-Axis Property", "", "", "" ); + m_xAxisProperty = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP ); + m_xAxisProperty.uiCapability()->setUiHidden( true ); + m_xAxisProperty.uiCapability()->setUiTreeChildrenHidden( true ); + m_xAxisProperty->setTernaryEnabled( false ); - CAF_PDM_InitFieldNoDefault(&m_yAxisProperty, "YAxisProperty", "Y-Axis Property", "", "", ""); - m_yAxisProperty = new RimEclipseResultDefinition(caf::PdmUiItemInfo::TOP); - m_yAxisProperty.uiCapability()->setUiHidden(true); - m_yAxisProperty.uiCapability()->setUiTreeChildrenHidden(true); - - m_yAxisProperty->setTernaryEnabled(false); + CAF_PDM_InitFieldNoDefault( &m_yAxisProperty, "YAxisProperty", "Y-Axis Property", "", "", "" ); + m_yAxisProperty = new RimEclipseResultDefinition( caf::PdmUiItemInfo::TOP ); + m_yAxisProperty.uiCapability()->setUiHidden( true ); + m_yAxisProperty.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault(&m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", ""); + m_yAxisProperty->setTernaryEnabled( false ); + + CAF_PDM_InitFieldNoDefault( &m_groupingProperty, "GroupingProperty", "Data Grouping Property", "", "", "" ); m_groupingProperty = new RimEclipseCellColors; - m_groupingProperty.uiCapability()->setUiHidden(true); - CVF_ASSERT(m_groupingProperty->legendConfig()); - m_groupingProperty->legendConfig()->setMappingMode(RimRegularLegendConfig::CATEGORY_INTEGER); - m_groupingProperty->setTernaryEnabled(false); + m_groupingProperty.uiCapability()->setUiHidden( true ); + CVF_ASSERT( m_groupingProperty->legendConfig() ); + m_groupingProperty->legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER ); + m_groupingProperty->setTernaryEnabled( false ); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "Name", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "Name", "", "", "" ); m_nameConfig = new RimGridCrossPlotDataSetNameConfig(); - m_nameConfig.uiCapability()->setUiTreeHidden(true); - m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true); + m_nameConfig.uiCapability()->setUiTreeHidden( true ); + m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true ); - CAF_PDM_InitFieldNoDefault(&m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", ""); - m_crossPlotCurves.uiCapability()->setUiTreeHidden(true); + CAF_PDM_InitFieldNoDefault( &m_crossPlotCurves, "CrossPlotCurves", "Curves", "", "", "" ); + m_crossPlotCurves.uiCapability()->setUiTreeHidden( true ); - CAF_PDM_InitField(&m_useCustomColor, "UseCustomColor", false, "Use Custom Color", "", "", ""); - CAF_PDM_InitField(&m_customColor, "CustomColor", cvf::Color3f(cvf::Color3f::BLACK), "Custom Color", "", "", ""); + CAF_PDM_InitField( &m_useCustomColor, "UseCustomColor", false, "Use Custom Color", "", "", "" ); + CAF_PDM_InitField( &m_customColor, "CustomColor", cvf::Color3f( cvf::Color3f::BLACK ), "Custom Color", "", "", "" ); - CAF_PDM_InitFieldNoDefault(&m_plotCellFilterCollection, "PlotCellFilterCollection", "Cell Filters", "", "", ""); - m_plotCellFilterCollection.uiCapability()->setUiHidden(true); - m_plotCellFilterCollection.uiCapability()->setUiTreeHidden(true); - m_plotCellFilterCollection.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_plotCellFilterCollection, "PlotCellFilterCollection", "Cell Filters", "", "", "" ); + m_plotCellFilterCollection.uiCapability()->setUiHidden( true ); + m_plotCellFilterCollection.uiCapability()->setUiTreeHidden( true ); + m_plotCellFilterCollection.uiCapability()->setUiTreeChildrenHidden( true ); m_plotCellFilterCollection = new RimPlotCellFilterCollection; setDefaults(); @@ -136,34 +136,34 @@ RimGridCrossPlotDataSet::RimGridCrossPlotDataSet() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::setCellFilterView(RimGridView* cellFilterView) +void RimGridCrossPlotDataSet::setCellFilterView( RimGridView* cellFilterView ) { m_cellFilterView = cellFilterView; - auto eclipseView = dynamic_cast(m_cellFilterView()); + auto eclipseView = dynamic_cast( m_cellFilterView() ); - if (eclipseView) + if ( eclipseView ) { - m_groupingProperty->setReservoirView(eclipseView); + m_groupingProperty->setReservoirView( eclipseView ); RigEclipseResultAddress resAddr = eclipseView->cellResult()->eclipseResultAddress(); - if (resAddr.isValid()) + if ( resAddr.isValid() ) { - m_xAxisProperty->setResultType(resAddr.m_resultCatType); - m_xAxisProperty->setResultVariable(resAddr.m_resultName); - m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE); - m_yAxisProperty->setResultVariable("DEPTH"); + m_xAxisProperty->setResultType( resAddr.m_resultCatType ); + m_xAxisProperty->setResultVariable( resAddr.m_resultName ); + m_yAxisProperty->setResultType( RiaDefines::STATIC_NATIVE ); + m_yAxisProperty->setResultVariable( "DEPTH" ); m_timeStep = eclipseView->currentTimeStep(); m_grouping = NO_GROUPING; - if (eclipseView->eclipseCase() && eclipseView->eclipseCase()->activeFormationNames()) + if ( eclipseView->eclipseCase() && eclipseView->eclipseCase()->activeFormationNames() ) { m_grouping = GROUP_BY_FORMATION; - m_groupingProperty->legendConfig()->setColorRange(RimRegularLegendConfig::CATEGORY); + m_groupingProperty->legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY ); } RimGridCrossPlot* parentPlot = nullptr; - firstAncestorOrThisOfType(parentPlot); - if (parentPlot) + firstAncestorOrThisOfType( parentPlot ); + if ( parentPlot ) { - parentPlot->setYAxisInverted(true); + parentPlot->setYAxisInverted( true ); } } } @@ -172,19 +172,19 @@ void RimGridCrossPlotDataSet::setCellFilterView(RimGridView* cellFilterView) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::loadDataAndUpdate(bool updateParentPlot) +void RimGridCrossPlotDataSet::loadDataAndUpdate( bool updateParentPlot ) { - onLoadDataAndUpdate(updateParentPlot); + onLoadDataAndUpdate( updateParentPlot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::setParentQwtPlotNoReplot(QwtPlot* parent) +void RimGridCrossPlotDataSet::setParentQwtPlotNoReplot( QwtPlot* parent ) { - for (auto& curve : m_crossPlotCurves()) + for ( auto& curve : m_crossPlotCurves() ) { - curve->setParentQwtPlotNoReplot(m_isChecked() ? parent : nullptr); + curve->setParentQwtPlotNoReplot( m_isChecked() ? parent : nullptr ); } } @@ -209,29 +209,29 @@ QString RimGridCrossPlotDataSet::yAxisName() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::infoText() const { - if (!m_case()) return ""; + if ( !m_case() ) return ""; - if (visibleCurveCount() == 0u) return ""; + if ( visibleCurveCount() == 0u ) return ""; QStringList textLines; - textLines += QString("Case: %1").arg(m_case()->caseUserDescription()); - textLines += QString("Parameters:: %1 x %2") - .arg(m_xAxisProperty->resultVariableUiShortName()) - .arg(m_yAxisProperty->resultVariableUiShortName()); - if (m_timeStep != -1) + textLines += QString( "Case: %1" ).arg( m_case()->caseUserDescription() ); + textLines += QString( "Parameters:: %1 x %2" ) + .arg( m_xAxisProperty->resultVariableUiShortName() ) + .arg( m_yAxisProperty->resultVariableUiShortName() ); + if ( m_timeStep != -1 ) { - textLines += QString("Time step: %1").arg(timeStepString()); + textLines += QString( "Time step: %1" ).arg( timeStepString() ); } - if (m_grouping != NO_GROUPING) + if ( m_grouping != NO_GROUPING ) { - textLines += QString("Grouped By: %1").arg(groupParameter()); + textLines += QString( "Grouped By: %1" ).arg( groupParameter() ); } - if (m_cellFilterView()) + if ( m_cellFilterView() ) { - textLines += QString("Filter view: %1").arg(m_cellFilterView->name()); + textLines += QString( "Filter view: %1" ).arg( m_cellFilterView->name() ); } - textLines += QString("Sample Count: %1").arg(sampleCount()); - return textLines.join("
\n"); + textLines += QString( "Sample Count: %1" ).arg( sampleCount() ); + return textLines.join( "
\n" ); } //-------------------------------------------------------------------------------------------------- @@ -240,8 +240,8 @@ QString RimGridCrossPlotDataSet::infoText() const int RimGridCrossPlotDataSet::indexInPlot() const { RimGridCrossPlot* parent; - this->firstAncestorOrThisOfTypeAsserted(parent); - return parent->indexOfDataSet(this); + this->firstAncestorOrThisOfTypeAsserted( parent ); + return parent->indexOfDataSet( this ); } //-------------------------------------------------------------------------------------------------- @@ -249,39 +249,39 @@ int RimGridCrossPlotDataSet::indexInPlot() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::createAutoName() const { - if (m_case() == nullptr) + if ( m_case() == nullptr ) { return "Undefined"; } QStringList nameTags; - if (!m_nameConfig->customName().isEmpty()) + if ( !m_nameConfig->customName().isEmpty() ) { nameTags += m_nameConfig->customName(); } - if (m_nameConfig->addCaseName()) + if ( m_nameConfig->addCaseName() ) { nameTags += caseNameString(); } - if (m_nameConfig->addAxisVariables()) + if ( m_nameConfig->addAxisVariables() ) { nameTags += axisVariableString(); } - if (m_nameConfig->addTimestep() && !timeStepString().isEmpty()) + if ( m_nameConfig->addTimestep() && !timeStepString().isEmpty() ) { nameTags += timeStepString(); } - if (m_nameConfig->addGrouping() && groupParameter() != "None") + if ( m_nameConfig->addGrouping() && groupParameter() != "None" ) { QString catTitle = groupTitle(); - if (!catTitle.isEmpty()) nameTags += catTitle; + if ( !catTitle.isEmpty() ) nameTags += catTitle; } - return nameTags.join(", "); + return nameTags.join( ", " ); } //-------------------------------------------------------------------------------------------------- @@ -289,9 +289,9 @@ QString RimGridCrossPlotDataSet::createAutoName() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::groupTitle() const { - if (m_grouping != NO_GROUPING) + if ( m_grouping != NO_GROUPING ) { - return QString("Grouped by %1").arg(groupParameter()); + return QString( "Grouped by %1" ).arg( groupParameter() ); } return ""; } @@ -301,17 +301,17 @@ QString RimGridCrossPlotDataSet::groupTitle() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::groupParameter() const { - if (m_grouping() == GROUP_BY_TIME) + if ( m_grouping() == GROUP_BY_TIME ) { - return QString("Time Steps"); + return QString( "Time Steps" ); } - else if (m_grouping() == GROUP_BY_FORMATION) + else if ( m_grouping() == GROUP_BY_FORMATION ) { - return QString("Formations"); + return QString( "Formations" ); } - else if (m_grouping() == GROUP_BY_RESULT && m_groupingProperty->hasResult()) + else if ( m_grouping() == GROUP_BY_RESULT && m_groupingProperty->hasResult() ) { - return QString("%1").arg(m_groupingProperty->resultVariableUiShortName()); + return QString( "%1" ).arg( m_groupingProperty->resultVariableUiShortName() ); } return "None"; } @@ -321,7 +321,7 @@ QString RimGridCrossPlotDataSet::groupParameter() const //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::detachAllCurves() { - for (auto curve : m_crossPlotCurves()) + for ( auto curve : m_crossPlotCurves() ) { curve->detachQwtCurve(); } @@ -332,9 +332,9 @@ void RimGridCrossPlotDataSet::detachAllCurves() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::cellFilterViewUpdated() { - if (m_cellFilterView()) + if ( m_cellFilterView() ) { - loadDataAndUpdate(true); + loadDataAndUpdate( true ); } } @@ -359,7 +359,7 @@ std::vector RimGridCrossPlotDataSet::curves() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::caseNameString() const { - if (m_case()) + if ( m_case() ) { return m_case->caseUserDescription(); } @@ -371,7 +371,7 @@ QString RimGridCrossPlotDataSet::caseNameString() const //-------------------------------------------------------------------------------------------------- QString RimGridCrossPlotDataSet::axisVariableString() const { - return QString("%1 x %2").arg(xAxisName(), yAxisName()); + return QString( "%1 x %2" ).arg( xAxisName(), yAxisName() ); } //-------------------------------------------------------------------------------------------------- @@ -380,11 +380,11 @@ QString RimGridCrossPlotDataSet::axisVariableString() const QString RimGridCrossPlotDataSet::timeStepString() const { // If using time categorization, the time step will be included as a category, so skip it here. - if (m_grouping() != RigGridCrossPlotCurveGrouping::GROUP_BY_TIME) + if ( m_grouping() != RigGridCrossPlotCurveGrouping::GROUP_BY_TIME ) { - if (m_case() && (m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult())) + if ( m_case() && ( m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult() ) ) { - if (m_timeStep == -1) + if ( m_timeStep == -1 ) { return "All Time Steps"; } @@ -400,10 +400,10 @@ QString RimGridCrossPlotDataSet::timeStepString() const std::map RimGridCrossPlotDataSet::nameComponents() const { std::map componentNames; - if (m_nameConfig->addCaseName()) componentNames[GCP_CASE_NAME] = caseNameString(); - if (m_nameConfig->addAxisVariables()) componentNames[GCP_AXIS_VARIABLES] = axisVariableString(); - if (m_nameConfig->addTimestep()) componentNames[GCP_TIME_STEP] = timeStepString(); - if (m_nameConfig->addGrouping()) componentNames[GCP_GROUP_NAME] = groupTitle(); + if ( m_nameConfig->addCaseName() ) componentNames[GCP_CASE_NAME] = caseNameString(); + if ( m_nameConfig->addAxisVariables() ) componentNames[GCP_AXIS_VARIABLES] = axisVariableString(); + if ( m_nameConfig->addTimestep() ) componentNames[GCP_TIME_STEP] = timeStepString(); + if ( m_nameConfig->addGrouping() ) componentNames[GCP_GROUP_NAME] = groupTitle(); return componentNames; } @@ -413,77 +413,82 @@ std::map RimGridCrossPlotDataS //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::initAfterRead() { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase ) { - m_xAxisProperty->setEclipseCase(eclipseCase); - m_yAxisProperty->setEclipseCase(eclipseCase); - m_groupingProperty->setEclipseCase(eclipseCase); - m_plotCellFilterCollection->setCase(eclipseCase); + m_xAxisProperty->setEclipseCase( eclipseCase ); + m_yAxisProperty->setEclipseCase( eclipseCase ); + m_groupingProperty->setEclipseCase( eclipseCase ); + m_plotCellFilterCollection->setCase( eclipseCase ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::onLoadDataAndUpdate(bool updateParentPlot) +void RimGridCrossPlotDataSet::onLoadDataAndUpdate( bool updateParentPlot ) { updateDataSetName(); - if (m_case() == nullptr) + if ( m_case() == nullptr ) { return; } - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); - if (eclipseCase == nullptr) + if ( eclipseCase == nullptr ) { return; } - if (!eclipseCase->ensureReservoirCaseIsOpen()) + if ( !eclipseCase->ensureReservoirCaseIsOpen() ) { - RiaLogging::warning(QString("Failed to open eclipse grid file %1").arg(eclipseCase->gridFileName())); + RiaLogging::warning( QString( "Failed to open eclipse grid file %1" ).arg( eclipseCase->gridFileName() ) ); return; } - RigEclipseResultAddress xAddress(m_xAxisProperty->resultType(), m_xAxisProperty->resultVariable()); - RigEclipseResultAddress yAddress(m_yAxisProperty->resultType(), m_yAxisProperty->resultVariable()); - RigEclipseResultAddress groupAddress(m_groupingProperty->resultType(), m_groupingProperty->resultVariable()); + RigEclipseResultAddress xAddress( m_xAxisProperty->resultType(), m_xAxisProperty->resultVariable() ); + RigEclipseResultAddress yAddress( m_yAxisProperty->resultType(), m_yAxisProperty->resultVariable() ); + RigEclipseResultAddress groupAddress( m_groupingProperty->resultType(), m_groupingProperty->resultVariable() ); - std::map timeStepCellVisibilityMap = calculateCellVisibility(eclipseCase); + std::map timeStepCellVisibilityMap = calculateCellVisibility( eclipseCase ); updateLegendRange(); - RigEclipseCrossPlotResult result = RigEclipseCrossPlotDataExtractor::extract( - eclipseCase->eclipseCaseData(), m_timeStep(), xAddress, yAddress, m_grouping(), groupAddress, timeStepCellVisibilityMap); + RigEclipseCrossPlotResult result = RigEclipseCrossPlotDataExtractor::extract( eclipseCase->eclipseCaseData(), + m_timeStep(), + xAddress, + yAddress, + m_grouping(), + groupAddress, + timeStepCellVisibilityMap ); - if (isXAxisLogarithmic() || isYAxisLogarithmic()) + if ( isXAxisLogarithmic() || isYAxisLogarithmic() ) { - filterInvalidCurveValues(&result); + filterInvalidCurveValues( &result ); } - assignCurveDataGroups(result); + assignCurveDataGroups( result ); - if (m_crossPlotCurves.size() != m_groupedResults.size()) + if ( m_crossPlotCurves.size() != m_groupedResults.size() ) { destroyCurves(); } - if (m_crossPlotCurves.empty()) + if ( m_crossPlotCurves.empty() ) { - createCurves(result); + createCurves( result ); } else { - fillCurveDataInExistingCurves(result); + fillCurveDataInExistingCurves( result ); } updateLegendIcons(); - if (updateParentPlot) + if ( updateParentPlot ) { triggerPlotNameUpdateAndReplot(); } @@ -492,18 +497,17 @@ void RimGridCrossPlotDataSet::onLoadDataAndUpdate(bool updateParentPlot) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::assignCurveDataGroups(const RigEclipseCrossPlotResult& result) +void RimGridCrossPlotDataSet::assignCurveDataGroups( const RigEclipseCrossPlotResult& result ) { m_groupedResults.clear(); - if (groupingEnabled() && - (result.groupValuesContinuous.empty() && result.groupValuesDiscrete.empty())) + if ( groupingEnabled() && ( result.groupValuesContinuous.empty() && result.groupValuesDiscrete.empty() ) ) { // Basis for group determination (i.e. formation list) may have been deleted since the grouping was assigned. m_grouping = NO_GROUPING; } - if (!groupingEnabled()) + if ( !groupingEnabled() ) { m_groupedResults[0] = result; } @@ -511,36 +515,38 @@ void RimGridCrossPlotDataSet::assignCurveDataGroups(const RigEclipseCrossPlotRes { std::vector tickValues; - if (groupingByCategoryResult()) + if ( groupingByCategoryResult() ) { - for (size_t i = 0; i < result.xValues.size(); ++i) + for ( size_t i = 0; i < result.xValues.size(); ++i ) { - int categoryNum = m_grouping == GROUP_BY_RESULT ? static_cast(result.groupValuesContinuous[i]) + int categoryNum = m_grouping == GROUP_BY_RESULT ? static_cast( result.groupValuesContinuous[i] ) : result.groupValuesDiscrete[i]; - m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]); - m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]); - if (!result.groupValuesContinuous.empty()) - m_groupedResults[categoryNum].groupValuesContinuous.push_back(result.groupValuesContinuous[i]); - if (!result.groupValuesDiscrete.empty()) - m_groupedResults[categoryNum].groupValuesDiscrete.push_back(result.groupValuesDiscrete[i]); + m_groupedResults[categoryNum].xValues.push_back( result.xValues[i] ); + m_groupedResults[categoryNum].yValues.push_back( result.yValues[i] ); + if ( !result.groupValuesContinuous.empty() ) + m_groupedResults[categoryNum].groupValuesContinuous.push_back( result.groupValuesContinuous[i] ); + if ( !result.groupValuesDiscrete.empty() ) + m_groupedResults[categoryNum].groupValuesDiscrete.push_back( result.groupValuesDiscrete[i] ); } } else { - legendConfig()->scalarMapper()->majorTickValues(&tickValues); + legendConfig()->scalarMapper()->majorTickValues( &tickValues ); - for (size_t i = 0; i < result.xValues.size(); ++i) + for ( size_t i = 0; i < result.xValues.size(); ++i ) { - auto upperBoundIt = std::lower_bound(tickValues.begin(), tickValues.end(), result.groupValuesContinuous[i]); - int upperBoundIndex = static_cast(upperBoundIt - tickValues.begin()); - int categoryNum = std::min((int)tickValues.size() - 2, std::max(0, upperBoundIndex - 1)); - m_groupedResults[categoryNum].xValues.push_back(result.xValues[i]); - m_groupedResults[categoryNum].yValues.push_back(result.yValues[i]); - if (!result.groupValuesContinuous.empty()) - m_groupedResults[categoryNum].groupValuesContinuous.push_back(result.groupValuesContinuous[i]); - if (!result.groupValuesDiscrete.empty()) - m_groupedResults[categoryNum].groupValuesDiscrete.push_back(result.groupValuesDiscrete[i]); + auto upperBoundIt = std::lower_bound( tickValues.begin(), + tickValues.end(), + result.groupValuesContinuous[i] ); + int upperBoundIndex = static_cast( upperBoundIt - tickValues.begin() ); + int categoryNum = std::min( (int)tickValues.size() - 2, std::max( 0, upperBoundIndex - 1 ) ); + m_groupedResults[categoryNum].xValues.push_back( result.xValues[i] ); + m_groupedResults[categoryNum].yValues.push_back( result.yValues[i] ); + if ( !result.groupValuesContinuous.empty() ) + m_groupedResults[categoryNum].groupValuesContinuous.push_back( result.groupValuesContinuous[i] ); + if ( !result.groupValuesDiscrete.empty() ) + m_groupedResults[categoryNum].groupValuesDiscrete.push_back( result.groupValuesDiscrete[i] ); } } } @@ -549,57 +555,57 @@ void RimGridCrossPlotDataSet::assignCurveDataGroups(const RigEclipseCrossPlotRes //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::createCurves(const RigEclipseCrossPlotResult& result) +void RimGridCrossPlotDataSet::createCurves( const RigEclipseCrossPlotResult& result ) { - if (!groupingEnabled()) + if ( !groupingEnabled() ) { RimGridCrossPlotCurve* curve = new RimGridCrossPlotCurve(); - if (m_useCustomColor) + if ( m_useCustomColor ) { - curve->setColor(m_customColor()); + curve->setColor( m_customColor() ); } else { const caf::ColorTable& colors = RiaColorTables::contrastCategoryPaletteColors(); int colorIndex = indexInPlot(); - curve->setColor(colors.cycledColor3f(colorIndex)); + curve->setColor( colors.cycledColor3f( colorIndex ) ); } - curve->setSymbolEdgeColor(curve->color()); - curve->setGroupingInformation(indexInPlot(), 0); - curve->setSamples(result.xValues, result.yValues); + curve->setSymbolEdgeColor( curve->color() ); + curve->setGroupingInformation( indexInPlot(), 0 ); + curve->setSamples( result.xValues, result.yValues ); curve->setCurveAutoAppearance(); curve->updateUiIconFromPlotSymbol(); - m_crossPlotCurves.push_back(curve); + m_crossPlotCurves.push_back( curve ); } else { std::vector tickValues; - if (!groupingByCategoryResult()) + if ( !groupingByCategoryResult() ) { - legendConfig()->scalarMapper()->majorTickValues(&tickValues); + legendConfig()->scalarMapper()->majorTickValues( &tickValues ); } // NB : Make sure iteration of curve and groups are syncronized with createCurves() - for (auto it = m_groupedResults.rbegin(); it != m_groupedResults.rend(); ++it) + for ( auto it = m_groupedResults.rbegin(); it != m_groupedResults.rend(); ++it ) { RimGridCrossPlotCurve* curve = new RimGridCrossPlotCurve(); - curve->setGroupingInformation(indexInPlot(), it->first); - if (groupingByCategoryResult()) + curve->setGroupingInformation( indexInPlot(), it->first ); + if ( groupingByCategoryResult() ) { - curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(it->first))); + curve->setColor( cvf::Color3f( legendConfig()->scalarMapper()->mapToColor( it->first ) ) ); } else { - curve->setColor(cvf::Color3f(legendConfig()->scalarMapper()->mapToColor(tickValues[it->first]))); + curve->setColor( cvf::Color3f( legendConfig()->scalarMapper()->mapToColor( tickValues[it->first] ) ) ); } - curve->setSymbolEdgeColor(curve->color()); - curve->setSamples(it->second.xValues, it->second.yValues); - curve->showLegend(m_crossPlotCurves.empty()); - curve->setLegendEntryText(createAutoName()); + curve->setSymbolEdgeColor( curve->color() ); + curve->setSamples( it->second.xValues, it->second.yValues ); + curve->showLegend( m_crossPlotCurves.empty() ); + curve->setLegendEntryText( createAutoName() ); curve->setCurveAutoAppearance(); curve->updateUiIconFromPlotSymbol(); - m_crossPlotCurves.push_back(curve); + m_crossPlotCurves.push_back( curve ); } } } @@ -607,14 +613,14 @@ void RimGridCrossPlotDataSet::createCurves(const RigEclipseCrossPlotResult& resu //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves(const RigEclipseCrossPlotResult& result) +void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves( const RigEclipseCrossPlotResult& result ) { - if (!groupingEnabled()) + if ( !groupingEnabled() ) { - CVF_ASSERT(m_crossPlotCurves.size() == 1u); + CVF_ASSERT( m_crossPlotCurves.size() == 1u ); RimGridCrossPlotCurve* curve = m_crossPlotCurves[0]; - curve->setSamples(result.xValues, result.yValues); - curve->setGroupingInformation(indexInPlot(), 0); + curve->setSamples( result.xValues, result.yValues ); + curve->setGroupingInformation( indexInPlot(), 0 ); curve->updateCurveAppearance(); curve->updateUiIconFromPlotSymbol(); } @@ -623,11 +629,11 @@ void RimGridCrossPlotDataSet::fillCurveDataInExistingCurves(const RigEclipseCros // NB : Make sure iteration of curve and groups are syncronized with fillCurveDataInExistingCurves() auto curveIt = m_crossPlotCurves.begin(); auto groupIt = m_groupedResults.rbegin(); - for (; curveIt != m_crossPlotCurves.end() && groupIt != m_groupedResults.rend(); ++curveIt, ++groupIt) + for ( ; curveIt != m_crossPlotCurves.end() && groupIt != m_groupedResults.rend(); ++curveIt, ++groupIt ) { RimGridCrossPlotCurve* curve = *curveIt; - curve->setSamples(groupIt->second.xValues, groupIt->second.yValues); - curve->setGroupingInformation(indexInPlot(), groupIt->first); + curve->setSamples( groupIt->second.xValues, groupIt->second.yValues ); + curve->setGroupingInformation( indexInPlot(), groupIt->first ); curve->updateCurveAppearance(); curve->updateUiIconFromPlotSymbol(); } @@ -649,9 +655,9 @@ void RimGridCrossPlotDataSet::destroyCurves() size_t RimGridCrossPlotDataSet::visibleCurveCount() const { size_t visibleCurves = 0; - for (auto curve : m_crossPlotCurves) + for ( auto curve : m_crossPlotCurves ) { - if (curve && curve->isCurveVisible()) visibleCurves++; + if ( curve && curve->isCurveVisible() ) visibleCurves++; } return visibleCurves; } @@ -662,9 +668,9 @@ size_t RimGridCrossPlotDataSet::visibleCurveCount() const size_t RimGridCrossPlotDataSet::sampleCount() const { size_t sampleCount = 0; - for (auto curve : m_crossPlotCurves) + for ( auto curve : m_crossPlotCurves ) { - if (curve && curve->isCurveVisible()) sampleCount += curve->sampleCount(); + if ( curve && curve->isCurveVisible() ) sampleCount += curve->sampleCount(); } return sampleCount; } @@ -672,85 +678,85 @@ size_t RimGridCrossPlotDataSet::sampleCount() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QString RimGridCrossPlotDataSet::createGroupName(size_t groupIndex) const +QString RimGridCrossPlotDataSet::createGroupName( size_t groupIndex ) const { - if (groupingByCategoryResult()) + if ( groupingByCategoryResult() ) { - return legendConfig()->categoryNameFromCategoryValue(groupIndex); + return legendConfig()->categoryNameFromCategoryValue( groupIndex ); } else { std::vector tickValues; - legendConfig()->scalarMapper()->majorTickValues(&tickValues); + legendConfig()->scalarMapper()->majorTickValues( &tickValues ); double lowerLimit = tickValues[groupIndex]; - double upperLimit = - groupIndex + 1u < tickValues.size() ? tickValues[groupIndex + 1u] : std::numeric_limits::infinity(); - return QString("%1 [%2, %3]").arg(groupParameter()).arg(lowerLimit).arg(upperLimit); + double upperLimit = groupIndex + 1u < tickValues.size() ? tickValues[groupIndex + 1u] + : std::numeric_limits::infinity(); + return QString( "%1 [%2, %3]" ).arg( groupParameter() ).arg( lowerLimit ).arg( upperLimit ); } } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::map RimGridCrossPlotDataSet::calculateCellVisibility(RimEclipseCase* eclipseCase) const +std::map RimGridCrossPlotDataSet::calculateCellVisibility( RimEclipseCase* eclipseCase ) const { std::map timeStepCellVisibilityMap; - if (m_cellFilterView) + if ( m_cellFilterView ) { - RimEclipseView* eclipseView = dynamic_cast(m_cellFilterView()); - if (eclipseView) + RimEclipseView* eclipseView = dynamic_cast( m_cellFilterView() ); + if ( eclipseView ) { std::set timeSteps; - if (m_timeStep() == -1) + if ( m_timeStep() == -1 ) { - for (int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i) + for ( int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i ) { - timeSteps.insert(i); + timeSteps.insert( i ); } } else { - timeSteps.insert(m_timeStep()); + timeSteps.insert( m_timeStep() ); } - for (int i : timeSteps) + for ( int i : timeSteps ) { - eclipseView->calculateCurrentTotalCellVisibility(&timeStepCellVisibilityMap[i], i); + eclipseView->calculateCurrentTotalCellVisibility( &timeStepCellVisibilityMap[i], i ); } } } - else if (m_plotCellFilterCollection->cellFilterCount() > 0) + else if ( m_plotCellFilterCollection->cellFilterCount() > 0 ) { std::set timeSteps; - if (m_timeStep() == -1) + if ( m_timeStep() == -1 ) { - for (int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i) + for ( int i = 0; i < (int)eclipseCase->timeStepDates().size(); ++i ) { - timeSteps.insert(i); + timeSteps.insert( i ); } } else { - timeSteps.insert(m_timeStep()); + timeSteps.insert( m_timeStep() ); } RigEclipseCaseData* eclipseCaseData = eclipseCase->eclipseCaseData(); - if (eclipseCaseData) + if ( eclipseCaseData ) { RiaDefines::PorosityModelType porosityModel = RiaDefines::MATRIX_MODEL; - RigCaseCellResultsData* cellResultsData = eclipseCaseData->results(porosityModel); - if (cellResultsData) + RigCaseCellResultsData* cellResultsData = eclipseCaseData->results( porosityModel ); + if ( cellResultsData ) { const RigActiveCellInfo* actCellInfo = cellResultsData->activeCellInfo(); size_t cellCount = actCellInfo->reservoirCellCount(); - for (int i : timeSteps) + for ( int i : timeSteps ) { cvf::UByteArray* cellVisibility = &timeStepCellVisibilityMap[i]; - cellVisibility->resize(cellCount); - cellVisibility->setAll(true); + cellVisibility->resize( cellCount ); + cellVisibility->setAll( true ); - m_plotCellFilterCollection->computeCellVisibilityFromFilter(i, cellVisibility); + m_plotCellFilterCollection->computeCellVisibilityFromFilter( i, cellVisibility ); } } } @@ -762,111 +768,113 @@ std::map RimGridCrossPlotDataSet::calculateCellVisibility( //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimGridCrossPlotDataSet::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add(&m_case); - if (m_case) + uiOrdering.add( &m_case ); + if ( m_case ) { - uiOrdering.add(&m_timeStep); - uiOrdering.add(&m_cellFilterView); - uiOrdering.add(&m_grouping); + uiOrdering.add( &m_timeStep ); + uiOrdering.add( &m_cellFilterView ); + uiOrdering.add( &m_grouping ); - CVF_ASSERT(m_xAxisProperty && m_yAxisProperty && m_groupingProperty && "All property objects should always be created"); + CVF_ASSERT( m_xAxisProperty && m_yAxisProperty && m_groupingProperty && + "All property objects should always be created" ); - if (m_grouping() == GROUP_BY_TIME && !(m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult())) + if ( m_grouping() == GROUP_BY_TIME && + !( m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult() ) ) { m_grouping = NO_GROUPING; } - if (m_grouping() == GROUP_BY_RESULT) + if ( m_grouping() == GROUP_BY_RESULT ) { - caf::PdmUiGroup* dataGroupingGroup = uiOrdering.addNewGroup("Data Grouping Property"); - m_groupingProperty->uiOrdering("AddLegendLevels", *dataGroupingGroup); + caf::PdmUiGroup* dataGroupingGroup = uiOrdering.addNewGroup( "Data Grouping Property" ); + m_groupingProperty->uiOrdering( "AddLegendLevels", *dataGroupingGroup ); } - caf::PdmUiGroup* invisibleFullWidthGroup = uiOrdering.addNewGroup("Property Group"); - invisibleFullWidthGroup->setEnableFrame(false); + caf::PdmUiGroup* invisibleFullWidthGroup = uiOrdering.addNewGroup( "Property Group" ); + invisibleFullWidthGroup->setEnableFrame( false ); - caf::PdmUiGroup* xAxisGroup = invisibleFullWidthGroup->addNewGroup("X-Axis Property"); - m_xAxisProperty->uiOrdering(uiConfigName, *xAxisGroup); + caf::PdmUiGroup* xAxisGroup = invisibleFullWidthGroup->addNewGroup( "X-Axis Property" ); + m_xAxisProperty->uiOrdering( uiConfigName, *xAxisGroup ); - caf::PdmUiGroup* yAxisGroup = invisibleFullWidthGroup->addNewGroup("Y-Axis Property", false); - m_yAxisProperty->uiOrdering(uiConfigName, *yAxisGroup); + caf::PdmUiGroup* yAxisGroup = invisibleFullWidthGroup->addNewGroup( "Y-Axis Property", false ); + m_yAxisProperty->uiOrdering( uiConfigName, *yAxisGroup ); } - caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Name Configuration"); - m_nameConfig->uiOrdering(uiConfigName, *nameGroup); + caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Name Configuration" ); + m_nameConfig->uiOrdering( uiConfigName, *nameGroup ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::fieldChangedByUi(const caf::PdmFieldHandle* changedField, +void RimGridCrossPlotDataSet::fieldChangedByUi( const caf::PdmFieldHandle* changedField, const QVariant& oldValue, - const QVariant& newValue) + const QVariant& newValue ) { - if (changedField == &m_case) + if ( changedField == &m_case ) { - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); + if ( eclipseCase ) { - m_xAxisProperty->setEclipseCase(eclipseCase); - m_yAxisProperty->setEclipseCase(eclipseCase); - m_groupingProperty->setEclipseCase(eclipseCase); + m_xAxisProperty->setEclipseCase( eclipseCase ); + m_yAxisProperty->setEclipseCase( eclipseCase ); + m_groupingProperty->setEclipseCase( eclipseCase ); // TODO: Do we need all these?? m_xAxisProperty->updateConnectedEditors(); m_yAxisProperty->updateConnectedEditors(); m_groupingProperty->updateConnectedEditors(); - if (m_grouping == GROUP_BY_FORMATION && !eclipseCase->activeFormationNames()) + if ( m_grouping == GROUP_BY_FORMATION && !eclipseCase->activeFormationNames() ) { m_grouping = NO_GROUPING; } destroyCurves(); - loadDataAndUpdate(true); + loadDataAndUpdate( true ); } } - else if (changedField == &m_timeStep) + else if ( changedField == &m_timeStep ) { - if (m_timeStep != -1 && m_grouping == GROUP_BY_TIME) + if ( m_timeStep != -1 && m_grouping == GROUP_BY_TIME ) { m_grouping = NO_GROUPING; } destroyCurves(); - loadDataAndUpdate(true); + loadDataAndUpdate( true ); } - else if (changedField == &m_grouping) + else if ( changedField == &m_grouping ) { - if (m_grouping == GROUP_BY_TIME) + if ( m_grouping == GROUP_BY_TIME ) { - legendConfig()->setColorRange(RimRegularLegendConfig::NORMAL); - legendConfig()->setMappingMode(RimRegularLegendConfig::CATEGORY_INTEGER); + legendConfig()->setColorRange( RimRegularLegendConfig::NORMAL ); + legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER ); } - else if (groupingByCategoryResult()) + else if ( groupingByCategoryResult() ) { - legendConfig()->setColorRange(RimRegularLegendConfig::CATEGORY); - legendConfig()->setMappingMode(RimRegularLegendConfig::CATEGORY_INTEGER); + legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY ); + legendConfig()->setMappingMode( RimRegularLegendConfig::CATEGORY_INTEGER ); } else { - legendConfig()->setColorRange(RimRegularLegendConfig::NORMAL); - legendConfig()->setMappingMode(RimRegularLegendConfig::LINEAR_DISCRETE); + legendConfig()->setColorRange( RimRegularLegendConfig::NORMAL ); + legendConfig()->setMappingMode( RimRegularLegendConfig::LINEAR_DISCRETE ); } destroyCurves(); - loadDataAndUpdate(true); + loadDataAndUpdate( true ); } - else if (changedField == &m_cellFilterView) + else if ( changedField == &m_cellFilterView ) { - m_groupingProperty->setReservoirView(dynamic_cast(m_cellFilterView())); + m_groupingProperty->setReservoirView( dynamic_cast( m_cellFilterView() ) ); - loadDataAndUpdate(true); + loadDataAndUpdate( true ); } - else if (changedField == &m_isChecked) + else if ( changedField == &m_isChecked ) { updateLegendRange(); triggerPlotNameUpdateAndReplot(); @@ -876,15 +884,15 @@ void RimGridCrossPlotDataSet::fieldChangedByUi(const caf::PdmFieldHandle* change //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::childFieldChangedByUi(const caf::PdmFieldHandle* changedChildField) +void RimGridCrossPlotDataSet::childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) { - if (changedChildField == &m_yAxisProperty) + if ( changedChildField == &m_yAxisProperty ) { - if (m_yAxisProperty->resultVariable() == "DEPTH") + if ( m_yAxisProperty->resultVariable() == "DEPTH" ) { RimGridCrossPlot* plot; - this->firstAncestorOrThisOfTypeAsserted(plot); - plot->setYAxisInverted(true); + this->firstAncestorOrThisOfTypeAsserted( plot ); + plot->setYAxisInverted( true ); triggerPlotNameUpdateAndReplot(); } } @@ -893,63 +901,66 @@ void RimGridCrossPlotDataSet::childFieldChangedByUi(const caf::PdmFieldHandle* c //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList RimGridCrossPlotDataSet::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList + RimGridCrossPlotDataSet::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) { QList options; - if (fieldNeedingOptions == &m_case) + if ( fieldNeedingOptions == &m_case ) { - RimTools::eclipseCaseOptionItems(&options); - if (options.empty()) + RimTools::eclipseCaseOptionItems( &options ); + if ( options.empty() ) { - 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; - if (m_case) + if ( m_case ) { timeStepNames = m_case->timeStepStrings(); } - options.push_back(caf::PdmOptionItemInfo("All Time Steps", -1)); - for (int i = 0; i < timeStepNames.size(); i++) + options.push_back( caf::PdmOptionItemInfo( "All Time Steps", -1 ) ); + 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_cellFilterView) + else if ( fieldNeedingOptions == &m_cellFilterView ) { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase ) { - options.push_back(caf::PdmOptionItemInfo("Disabled", nullptr)); - for (RimEclipseView* view : eclipseCase->reservoirViews.childObjects()) + options.push_back( caf::PdmOptionItemInfo( "Disabled", nullptr ) ); + for ( RimEclipseView* view : eclipseCase->reservoirViews.childObjects() ) { - CVF_ASSERT(view && "Really always should have a valid view pointer in ReservoirViews"); - options.push_back(caf::PdmOptionItemInfo(view->name(), view, false, view->uiIconProvider())); + CVF_ASSERT( view && "Really always should have a valid view pointer in ReservoirViews" ); + options.push_back( caf::PdmOptionItemInfo( view->name(), view, false, view->uiIconProvider() ) ); } } } - else if (fieldNeedingOptions == &m_grouping) + else if ( fieldNeedingOptions == &m_grouping ) { - std::set validOptions = {NO_GROUPING, GROUP_BY_TIME, GROUP_BY_FORMATION, GROUP_BY_RESULT}; - if (!hasMultipleTimeSteps()) + std::set validOptions = {NO_GROUPING, + GROUP_BY_TIME, + GROUP_BY_FORMATION, + GROUP_BY_RESULT}; + if ( !hasMultipleTimeSteps() ) { - validOptions.erase(GROUP_BY_TIME); + validOptions.erase( GROUP_BY_TIME ); } { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - if (!(eclipseCase && eclipseCase->activeFormationNames())) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + if ( !( eclipseCase && eclipseCase->activeFormationNames() ) ) { - validOptions.erase(GROUP_BY_FORMATION); + validOptions.erase( GROUP_BY_FORMATION ); } } - for (auto optionItem : validOptions) + for ( auto optionItem : validOptions ) { - options.push_back(caf::PdmOptionItemInfo(CurveGroupingEnum::uiText(optionItem), optionItem)); + options.push_back( caf::PdmOptionItemInfo( CurveGroupingEnum::uiText( optionItem ), optionItem ) ); } } @@ -961,59 +972,59 @@ QList RimGridCrossPlotDataSet::calculateValueOptions(con //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::updateLegendRange() { - legendConfig()->setTitle(groupParameter()); - legendConfig()->disableAllTimeStepsRange(!hasMultipleTimeSteps()); + legendConfig()->setTitle( groupParameter() ); + legendConfig()->disableAllTimeStepsRange( !hasMultipleTimeSteps() ); RimGridCrossPlot* parent; - this->firstAncestorOrThisOfTypeAsserted(parent); - if (parent->qwtPlot()) + this->firstAncestorOrThisOfTypeAsserted( parent ); + if ( parent->qwtPlot() ) { - if (groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend()) + if ( groupingEnabled() && m_case() && isChecked() && legendConfig()->showLegend() ) { - if (m_grouping() == GROUP_BY_FORMATION) + if ( m_grouping() == GROUP_BY_FORMATION ) { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase ) { RigFormationNames* formationNames = eclipseCase->eclipseCaseData()->activeFormationNames(); - if (formationNames) + if ( formationNames ) { const std::vector& categoryNames = formationNames->formationNames(); - if (!categoryNames.empty()) + if ( !categoryNames.empty() ) { - legendConfig()->setNamedCategoriesInverse(categoryNames); - legendConfig()->setAutomaticRanges(0, categoryNames.size() - 1, 0, categoryNames.size() - 1); + legendConfig()->setNamedCategoriesInverse( categoryNames ); + legendConfig()->setAutomaticRanges( 0, categoryNames.size() - 1, 0, categoryNames.size() - 1 ); } } } } - else if (m_grouping() == GROUP_BY_TIME) + else if ( m_grouping() == GROUP_BY_TIME ) { QStringList timeStepNames = m_case->timeStepStrings(); std::vector categoryNames; - for (auto name : timeStepNames) + for ( auto name : timeStepNames ) { - categoryNames.push_back(name); + categoryNames.push_back( name ); } - if (!categoryNames.empty()) + if ( !categoryNames.empty() ) { - legendConfig()->setNamedCategories(categoryNames); - legendConfig()->setAutomaticRanges(0, categoryNames.size() - 1, 0, categoryNames.size() - 1); + legendConfig()->setNamedCategories( categoryNames ); + legendConfig()->setAutomaticRanges( 0, categoryNames.size() - 1, 0, categoryNames.size() - 1 ); } } - else if (m_groupingProperty->eclipseResultAddress().isValid()) + else if ( m_groupingProperty->eclipseResultAddress().isValid() ) { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + if ( eclipseCase ) { - m_groupingProperty->updateLegendData(eclipseCase, m_timeStep()); + m_groupingProperty->updateLegendData( eclipseCase, m_timeStep() ); } } - parent->qwtPlot()->addOrUpdateDataSetLegend(this); + parent->qwtPlot()->addOrUpdateDataSetLegend( this ); } else { - parent->qwtPlot()->removeDataSetLegend(this); + parent->qwtPlot()->removeDataSetLegend( this ); } } } @@ -1023,10 +1034,10 @@ void RimGridCrossPlotDataSet::updateLegendRange() //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::updateLegendIcons() { - for (auto curve : m_crossPlotCurves) + for ( auto curve : m_crossPlotCurves ) { curve->determineLegendIcon(); - curve->setBlackAndWhiteLegendIcons(groupingEnabled()); + curve->setBlackAndWhiteLegendIcons( groupingEnabled() ); } } @@ -1035,11 +1046,11 @@ void RimGridCrossPlotDataSet::updateLegendIcons() //-------------------------------------------------------------------------------------------------- bool RimGridCrossPlotDataSet::groupingByCategoryResult() const { - if (m_grouping == GROUP_BY_FORMATION || m_grouping == GROUP_BY_TIME) + if ( m_grouping == GROUP_BY_FORMATION || m_grouping == GROUP_BY_TIME ) { return true; } - else if (m_grouping == GROUP_BY_RESULT) + else if ( m_grouping == GROUP_BY_RESULT ) { return m_groupingProperty->hasCategoryResult(); } @@ -1051,9 +1062,9 @@ bool RimGridCrossPlotDataSet::groupingByCategoryResult() const //-------------------------------------------------------------------------------------------------- bool RimGridCrossPlotDataSet::groupingEnabled() const { - if (m_grouping != NO_GROUPING) + if ( m_grouping != NO_GROUPING ) { - if (m_grouping == GROUP_BY_RESULT && !m_groupingProperty->eclipseResultAddress().isValid()) + if ( m_grouping == GROUP_BY_RESULT && !m_groupingProperty->eclipseResultAddress().isValid() ) { return false; } @@ -1065,67 +1076,68 @@ bool RimGridCrossPlotDataSet::groupingEnabled() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::swapAxisProperties(bool updatePlot) +void RimGridCrossPlotDataSet::swapAxisProperties( bool updatePlot ) { RimEclipseResultDefinition* xAxisProperties = m_xAxisProperty(); RimEclipseResultDefinition* yAxisProperties = m_yAxisProperty(); - m_xAxisProperty.removeChildObject(xAxisProperties); - m_yAxisProperty.removeChildObject(yAxisProperties); + m_xAxisProperty.removeChildObject( xAxisProperties ); + m_yAxisProperty.removeChildObject( yAxisProperties ); m_yAxisProperty = xAxisProperties; m_xAxisProperty = yAxisProperties; updateConnectedEditors(); - loadDataAndUpdate(updatePlot); + loadDataAndUpdate( updatePlot ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::exportFormattedData(RifEclipseDataTableFormatter& formatter) const +void RimGridCrossPlotDataSet::exportFormattedData( RifEclipseDataTableFormatter& formatter ) const { - if (m_groupedResults.empty()) return; + if ( m_groupedResults.empty() ) return; - QString xTitle = QString("%1").arg(m_xAxisProperty->resultVariableUiShortName()); - QString yTitle = QString("%1").arg(m_yAxisProperty->resultVariableUiShortName()); + QString xTitle = QString( "%1" ).arg( m_xAxisProperty->resultVariableUiShortName() ); + QString yTitle = QString( "%1" ).arg( m_yAxisProperty->resultVariableUiShortName() ); - if (m_grouping != NO_GROUPING) + if ( m_grouping != NO_GROUPING ) { - std::vector header = {RifEclipseOutputTableColumn(xTitle), - RifEclipseOutputTableColumn(yTitle), - RifEclipseOutputTableColumn("Group Index"), - RifEclipseOutputTableColumn("Group Description")}; + std::vector header = {RifEclipseOutputTableColumn( xTitle ), + RifEclipseOutputTableColumn( yTitle ), + RifEclipseOutputTableColumn( "Group Index" ), + RifEclipseOutputTableColumn( "Group Description" )}; - formatter.header(header); + formatter.header( header ); } else { - std::vector header = {RifEclipseOutputTableColumn(xTitle), RifEclipseOutputTableColumn(yTitle)}; - formatter.header(header); + std::vector header = {RifEclipseOutputTableColumn( xTitle ), + RifEclipseOutputTableColumn( yTitle )}; + formatter.header( header ); } - caf::ProgressInfo progress(m_groupedResults.size(), "Gathering Data Points"); - for (auto it = m_groupedResults.begin(); it != m_groupedResults.end(); ++it) + caf::ProgressInfo progress( m_groupedResults.size(), "Gathering Data Points" ); + for ( auto it = m_groupedResults.begin(); it != m_groupedResults.end(); ++it ) { - auto task = progress.task(QString("Exporting Group %1").arg(it->first)); + auto task = progress.task( QString( "Exporting Group %1" ).arg( it->first ) ); RigEclipseCrossPlotResult res = it->second; - for (size_t i = 0; i < it->second.xValues.size(); ++i) + for ( size_t i = 0; i < it->second.xValues.size(); ++i ) { - if (m_grouping() == NO_GROUPING) + if ( m_grouping() == NO_GROUPING ) { - formatter.add(res.xValues[i]); - formatter.add(res.yValues[i]); + formatter.add( res.xValues[i] ); + formatter.add( res.yValues[i] ); } else { int groupIndex = it->first; - QString groupName = createGroupName(groupIndex); - formatter.add(res.xValues[i]); - formatter.add(res.yValues[i]); - formatter.add(groupIndex); - formatter.add(groupName); + QString groupName = createGroupName( groupIndex ); + formatter.add( res.xValues[i] ); + formatter.add( res.yValues[i] ); + formatter.add( groupIndex ); + formatter.add( groupName ); } formatter.rowCompleted(); } @@ -1138,7 +1150,7 @@ void RimGridCrossPlotDataSet::exportFormattedData(RifEclipseDataTableFormatter& bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const { RimGridCrossPlot* parent = nullptr; - firstAncestorOrThisOfTypeAsserted(parent); + firstAncestorOrThisOfTypeAsserted( parent ); return parent->isXAxisLogarithmic(); } @@ -1148,29 +1160,29 @@ bool RimGridCrossPlotDataSet::isXAxisLogarithmic() const bool RimGridCrossPlotDataSet::isYAxisLogarithmic() const { RimGridCrossPlot* parent = nullptr; - firstAncestorOrThisOfTypeAsserted(parent); + firstAncestorOrThisOfTypeAsserted( parent ); return parent->isYAxisLogarithmic(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::configureForPressureSaturationCurves(RimEclipseResultCase* eclipseCase, - const QString& dynamicResultName) +void RimGridCrossPlotDataSet::configureForPressureSaturationCurves( RimEclipseResultCase* eclipseCase, + const QString& dynamicResultName ) { m_case = eclipseCase; - m_xAxisProperty->setEclipseCase(eclipseCase); - m_xAxisProperty->setResultType(RiaDefines::DYNAMIC_NATIVE); - m_xAxisProperty->setResultVariable(dynamicResultName); + m_xAxisProperty->setEclipseCase( eclipseCase ); + m_xAxisProperty->setResultType( RiaDefines::DYNAMIC_NATIVE ); + m_xAxisProperty->setResultVariable( dynamicResultName ); - m_yAxisProperty->setEclipseCase(eclipseCase); - m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE); - m_yAxisProperty->setResultVariable("DEPTH"); + m_yAxisProperty->setEclipseCase( eclipseCase ); + m_yAxisProperty->setResultType( RiaDefines::STATIC_NATIVE ); + m_yAxisProperty->setResultVariable( "DEPTH" ); m_grouping = NO_GROUPING; - m_nameConfig->setCustomName(dynamicResultName); + m_nameConfig->setCustomName( dynamicResultName ); m_nameConfig->addCaseName = false; m_nameConfig->addAxisVariables = false; @@ -1181,15 +1193,15 @@ void RimGridCrossPlotDataSet::configureForPressureSaturationCurves(RimEclipseRes //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::addCellFilter(RimPlotCellFilter* cellFilter) +void RimGridCrossPlotDataSet::addCellFilter( RimPlotCellFilter* cellFilter ) { - m_plotCellFilterCollection->addCellFilter(cellFilter); + m_plotCellFilterCollection->addCellFilter( cellFilter ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::setCustomColor(const cvf::Color3f color) +void RimGridCrossPlotDataSet::setCustomColor( const cvf::Color3f color ) { m_useCustomColor = true; m_customColor = color; @@ -1201,8 +1213,8 @@ void RimGridCrossPlotDataSet::setCustomColor(const cvf::Color3f color) void RimGridCrossPlotDataSet::triggerPlotNameUpdateAndReplot() { RimGridCrossPlot* parent; - this->firstAncestorOrThisOfType(parent); - if (parent) + this->firstAncestorOrThisOfType( parent ); + if ( parent ) { parent->updateCurveNamesAndPlotTitle(); parent->reattachCurvesToQwtAndReplot(); @@ -1213,29 +1225,29 @@ void RimGridCrossPlotDataSet::triggerPlotNameUpdateAndReplot() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::updateCurveNames(size_t dataSetIndex, size_t dataSetCount) +void RimGridCrossPlotDataSet::updateCurveNames( size_t dataSetIndex, size_t dataSetCount ) { - for (size_t i = 0; i < m_crossPlotCurves.size(); ++i) + for ( size_t i = 0; i < m_crossPlotCurves.size(); ++i ) { QString dataSetName = createAutoName(); - if (dataSetName.isEmpty()) + if ( dataSetName.isEmpty() ) { - if (dataSetCount > 1u) - dataSetName = QString("DataSet #%1").arg(dataSetIndex + 1); + if ( dataSetCount > 1u ) + dataSetName = QString( "DataSet #%1" ).arg( dataSetIndex + 1 ); else dataSetName = "Data Set"; } auto curve = m_crossPlotCurves[i]; - if (groupingEnabled()) + if ( groupingEnabled() ) { - QString curveGroupName = createGroupName(curve->groupIndex()); - curve->setCustomName(curveGroupName); - curve->setLegendEntryText(dataSetName); + QString curveGroupName = createGroupName( curve->groupIndex() ); + curve->setCustomName( curveGroupName ); + curve->setLegendEntryText( dataSetName ); } else { - curve->setCustomName(dataSetName); + curve->setCustomName( dataSetName ); } curve->updateCurveNameAndUpdatePlotLegendAndTitle(); } @@ -1246,7 +1258,7 @@ void RimGridCrossPlotDataSet::updateCurveNames(size_t dataSetIndex, size_t dataS //-------------------------------------------------------------------------------------------------- void RimGridCrossPlotDataSet::updateDataSetName() { - this->setName(createAutoName()); + this->setName( createAutoName() ); } //-------------------------------------------------------------------------------------------------- @@ -1264,27 +1276,27 @@ void RimGridCrossPlotDataSet::performAutoNameUpdate() void RimGridCrossPlotDataSet::setDefaults() { RimProject* project = RiaApplication::instance()->project(); - if (project) + if ( project ) { - if (!project->eclipseCases().empty()) + if ( !project->eclipseCases().empty() ) { RimEclipseCase* eclipseCase = project->eclipseCases().front(); m_case = eclipseCase; - m_xAxisProperty->setEclipseCase(eclipseCase); - m_yAxisProperty->setEclipseCase(eclipseCase); - m_groupingProperty->setEclipseCase(eclipseCase); + m_xAxisProperty->setEclipseCase( eclipseCase ); + m_yAxisProperty->setEclipseCase( eclipseCase ); + m_groupingProperty->setEclipseCase( eclipseCase ); - m_xAxisProperty->setResultType(RiaDefines::STATIC_NATIVE); - m_xAxisProperty->setResultVariable("PORO"); + m_xAxisProperty->setResultType( RiaDefines::STATIC_NATIVE ); + m_xAxisProperty->setResultVariable( "PORO" ); - m_yAxisProperty->setResultType(RiaDefines::STATIC_NATIVE); - m_yAxisProperty->setResultVariable("PERMX"); + m_yAxisProperty->setResultType( RiaDefines::STATIC_NATIVE ); + m_yAxisProperty->setResultVariable( "PERMX" ); m_grouping = NO_GROUPING; - if (eclipseCase->activeFormationNames()) + if ( eclipseCase->activeFormationNames() ) { m_grouping = GROUP_BY_FORMATION; - m_groupingProperty->legendConfig()->setColorRange(RimRegularLegendConfig::CATEGORY); + m_groupingProperty->legendConfig()->setColorRange( RimRegularLegendConfig::CATEGORY ); } } } @@ -1293,30 +1305,31 @@ void RimGridCrossPlotDataSet::setDefaults() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::defineEditorAttribute(const caf::PdmFieldHandle* field, +void RimGridCrossPlotDataSet::defineEditorAttribute( const caf::PdmFieldHandle* field, QString uiConfigName, - caf::PdmUiEditorAttribute* attribute) + caf::PdmUiEditorAttribute* attribute ) { } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTreeOrdering, QString uiConfigName /*= ""*/) +void RimGridCrossPlotDataSet::defineUiTreeOrdering( caf::PdmUiTreeOrdering& uiTreeOrdering, + QString uiConfigName /*= ""*/ ) { - if (groupingEnabled()) + if ( groupingEnabled() ) { - m_groupingProperty->uiTreeOrdering(uiTreeOrdering, uiConfigName); + m_groupingProperty->uiTreeOrdering( uiTreeOrdering, uiConfigName ); } - for (auto curve : m_crossPlotCurves()) + for ( auto curve : m_crossPlotCurves() ) { - uiTreeOrdering.add(curve); + uiTreeOrdering.add( curve ); } - uiTreeOrdering.add(&m_plotCellFilterCollection); + uiTreeOrdering.add( &m_plotCellFilterCollection ); - uiTreeOrdering.skipRemainingChildren(true); + uiTreeOrdering.skipRemainingChildren( true ); } //-------------------------------------------------------------------------------------------------- @@ -1324,36 +1337,36 @@ void RimGridCrossPlotDataSet::defineUiTreeOrdering(caf::PdmUiTreeOrdering& uiTre //-------------------------------------------------------------------------------------------------- bool RimGridCrossPlotDataSet::hasMultipleTimeSteps() const { - return m_timeStep() == -1 && (m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult()); + return m_timeStep() == -1 && ( m_xAxisProperty->hasDynamicResult() || m_yAxisProperty->hasDynamicResult() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSet::filterInvalidCurveValues(RigEclipseCrossPlotResult* result) +void RimGridCrossPlotDataSet::filterInvalidCurveValues( RigEclipseCrossPlotResult* result ) { bool xLog = isXAxisLogarithmic(); bool yLog = isYAxisLogarithmic(); - if (xLog || yLog) + if ( xLog || yLog ) { RigEclipseCrossPlotResult validResult; - for (size_t i = 0; i < result->xValues.size(); ++i) + for ( size_t i = 0; i < result->xValues.size(); ++i ) { double xValue = result->xValues[i]; double yValue = result->yValues[i]; - bool invalid = (xLog && xValue <= 0.0) || (yLog && yValue <= 0.0); - if (!invalid) + bool invalid = ( xLog && xValue <= 0.0 ) || ( yLog && yValue <= 0.0 ); + if ( !invalid ) { - validResult.xValues.push_back(xValue); - validResult.yValues.push_back(yValue); - if (i < result->groupValuesContinuous.size()) + validResult.xValues.push_back( xValue ); + validResult.yValues.push_back( yValue ); + if ( i < result->groupValuesContinuous.size() ) { - validResult.groupValuesContinuous.push_back(result->groupValuesContinuous[i]); + validResult.groupValuesContinuous.push_back( result->groupValuesContinuous[i] ); } - if (i < result->groupValuesDiscrete.size()) + if ( i < result->groupValuesDiscrete.size() ) { - validResult.groupValuesDiscrete.push_back(result->groupValuesDiscrete[i]); + validResult.groupValuesDiscrete.push_back( result->groupValuesDiscrete[i] ); } } } @@ -1362,7 +1375,7 @@ void RimGridCrossPlotDataSet::filterInvalidCurveValues(RigEclipseCrossPlotResult } } -CAF_PDM_SOURCE_INIT(RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSetNameConfig"); +CAF_PDM_SOURCE_INIT( RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSetNameConfig" ); //-------------------------------------------------------------------------------------------------- /// @@ -1370,23 +1383,23 @@ CAF_PDM_SOURCE_INIT(RimGridCrossPlotDataSetNameConfig, "RimGridCrossPlotCurveSet RimGridCrossPlotDataSetNameConfig::RimGridCrossPlotDataSetNameConfig() : RimNameConfig() { - CAF_PDM_InitObject("Cross Plot Data Set NameGenerator", "", "", ""); + CAF_PDM_InitObject( "Cross Plot Data Set NameGenerator", "", "", "" ); - CAF_PDM_InitField(&addCaseName, "AddCaseName", true, "Add Case Name", "", "", ""); - CAF_PDM_InitField(&addAxisVariables, "AddAxisVariables", true, "Add Axis Variables", "", "", ""); - CAF_PDM_InitField(&addTimestep, "AddTimeStep", true, "Add Time Step", "", "", ""); - CAF_PDM_InitField(&addGrouping, "AddGrouping", true, "Add Data Group", "", "", ""); + CAF_PDM_InitField( &addCaseName, "AddCaseName", true, "Add Case Name", "", "", "" ); + CAF_PDM_InitField( &addAxisVariables, "AddAxisVariables", true, "Add Axis Variables", "", "", "" ); + CAF_PDM_InitField( &addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" ); + CAF_PDM_InitField( &addGrouping, "AddGrouping", true, "Add Data Group", "", "", "" ); - setCustomName(""); + setCustomName( "" ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimGridCrossPlotDataSetNameConfig::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimGridCrossPlotDataSetNameConfig::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add(&addCaseName); - uiOrdering.add(&addAxisVariables); - uiOrdering.add(&addTimestep); - uiOrdering.add(&addGrouping); + uiOrdering.add( &addCaseName ); + uiOrdering.add( &addAxisVariables ); + uiOrdering.add( &addTimestep ); + uiOrdering.add( &addGrouping ); } diff --git a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h index 296c5e9bc0..68cab15177 100644 --- a/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h +++ b/ApplicationCode/ProjectDataModel/GridCrossPlots/RimGridCrossPlotDataSet.h @@ -17,8 +17,8 @@ ///////////////////////////////////////////////////////////////////////////////// #pragma once -#include "RigGridCrossPlotCurveGrouping.h" #include "RigEclipseCrossPlotDataExtractor.h" +#include "RigGridCrossPlotCurveGrouping.h" #include "RimCheckableNamedObject.h" #include "RimNameConfig.h" @@ -31,7 +31,7 @@ #include "cafPdmPtrField.h" // Include to make Pdm work for cvf::Color -#include "cafPdmFieldCvfColor.h" +#include "cafPdmFieldCvfColor.h" #include @@ -66,7 +66,7 @@ public: caf::PdmField addGrouping; protected: - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; }; //================================================================================================== @@ -92,9 +92,9 @@ public: RimGridCrossPlotDataSet(); ~RimGridCrossPlotDataSet() = default; - void setCellFilterView(RimGridView* cellFilterView); - void loadDataAndUpdate(bool updateParentPlot); - void setParentQwtPlotNoReplot(QwtPlot* parent); + void setCellFilterView( RimGridView* cellFilterView ); + void loadDataAndUpdate( bool updateParentPlot ); + void setParentQwtPlotNoReplot( QwtPlot* parent ); QString xAxisName() const; QString yAxisName() const; QString infoText() const; @@ -105,66 +105,69 @@ public: QString groupParameter() const; void detachAllCurves(); void cellFilterViewUpdated(); - + RimRegularLegendConfig* legendConfig() const; - std::vector< RimGridCrossPlotCurve*> curves() const; + std::vector curves() const; - QString caseNameString() const; - QString axisVariableString() const; - QString timeStepString() const; + QString caseNameString() const; + QString axisVariableString() const; + QString timeStepString() const; std::map nameComponents() const; - void updateCurveNames(size_t dataSetIndex, size_t dataSetCount); + void updateCurveNames( size_t dataSetIndex, size_t dataSetCount ); void updateLegendRange(); void updateLegendIcons(); bool groupingByCategoryResult() const; bool groupingEnabled() const; - void swapAxisProperties(bool updatePlot); - void exportFormattedData(RifEclipseDataTableFormatter& formatter) const; + void swapAxisProperties( bool updatePlot ); + void exportFormattedData( RifEclipseDataTableFormatter& formatter ) const; bool isXAxisLogarithmic() const; bool isYAxisLogarithmic() const; - void configureForPressureSaturationCurves(RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName); - void addCellFilter(RimPlotCellFilter* cellFilter); - void setCustomColor(const cvf::Color3f color); + void configureForPressureSaturationCurves( RimEclipseResultCase* eclipseResultCase, const QString& dynamicResultName ); + void addCellFilter( RimPlotCellFilter* cellFilter ); + void setCustomColor( const cvf::Color3f color ); void destroyCurves(); size_t visibleCurveCount() const; - size_t sampleCount() const; + size_t sampleCount() const; protected: void initAfterRead() override; - void onLoadDataAndUpdate(bool updateParentPlot); + void onLoadDataAndUpdate( bool updateParentPlot ); - void assignCurveDataGroups(const RigEclipseCrossPlotResult& result); - void createCurves(const RigEclipseCrossPlotResult& result); - void fillCurveDataInExistingCurves(const RigEclipseCrossPlotResult& result); - QString createGroupName(size_t curveIndex) const; + void assignCurveDataGroups( const RigEclipseCrossPlotResult& result ); + void createCurves( const RigEclipseCrossPlotResult& result ); + void fillCurveDataInExistingCurves( const RigEclipseCrossPlotResult& result ); + QString createGroupName( size_t curveIndex ) const; - std::map calculateCellVisibility(RimEclipseCase* eclipseCase) const; + std::map calculateCellVisibility( RimEclipseCase* eclipseCase ) const; - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - void childFieldChangedByUi(const caf::PdmFieldHandle* changedChildField) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + void childFieldChangedByUi( const caf::PdmFieldHandle* changedChildField ) override; - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) override; - void triggerPlotNameUpdateAndReplot(); - void updateDataSetName(); - void performAutoNameUpdate() override; - void setDefaults(); - void defineEditorAttribute(const caf::PdmFieldHandle* field, QString uiConfigName, caf::PdmUiEditorAttribute* attribute) override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + void triggerPlotNameUpdateAndReplot(); + void updateDataSetName(); + void performAutoNameUpdate() override; + void setDefaults(); + 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; - void filterInvalidCurveValues(RigEclipseCrossPlotResult* result); + void filterInvalidCurveValues( RigEclipseCrossPlotResult* result ); private: - caf::PdmPtrField m_case; caf::PdmField m_timeStep; caf::PdmPtrField m_cellFilterView; @@ -177,10 +180,10 @@ private: caf::PdmChildArrayField m_crossPlotCurves; - std::map m_groupedResults; - - caf::PdmField m_useCustomColor; - caf::PdmField m_customColor; - caf::PdmChildField m_plotCellFilterCollection;; - + std::map m_groupedResults; + + caf::PdmField m_useCustomColor; + caf::PdmField m_customColor; + caf::PdmChildField m_plotCellFilterCollection; + ; }; diff --git a/ApplicationCode/ProjectDataModel/Rim3dView.cpp b/ApplicationCode/ProjectDataModel/Rim3dView.cpp index d9ca288a0f..40e7ebeafd 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dView.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dView.cpp @@ -2,25 +2,25 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// #include "Rim3dView.h" -#include "RiaGuiApplication.h" #include "RiaFieldHandleTools.h" +#include "RiaGuiApplication.h" #include "RiaPreferences.h" #include "RiaViewRedrawScheduler.h" @@ -28,24 +28,24 @@ #include "Rim3dWellLogCurve.h" #include "RimAnnotationInViewCollection.h" -#include "RimCase.h" +#include "RimCase.h" #include "RimGridView.h" #include "RimMainPlotCollection.h" +#include "RimMeasurement.h" #include "RimProject.h" #include "RimTools.h" #include "RimViewController.h" #include "RimViewLinker.h" -#include "RimWellPathCollection.h" #include "RimViewNameConfig.h" -#include "RimMeasurement.h" +#include "RimWellPathCollection.h" #include "RivAnnotationsPartMgr.h" -#include "RivWellPathsPartMgr.h" #include "RivMeasurementPartMgr.h" +#include "RivWellPathsPartMgr.h" #include "RiuMainWindow.h" -#include "RiuViewer.h" #include "RiuTimeStepChangedHandler.h" +#include "RiuViewer.h" #include "cafDisplayCoordTransform.h" #include "cafFrameAnimationControl.h" @@ -56,99 +56,103 @@ #include "cvfTransform.h" #include "cvfViewport.h" -#include #include "cvfScene.h" +#include - -namespace caf { - -template<> -void caf::AppEnum< Rim3dView::SurfaceModeType >::setUp() +namespace caf { - addItem(Rim3dView::SURFACE, "SURFACE", "All"); - addItem(Rim3dView::FAULTS, "FAULTS", "Faults only"); - addItem(Rim3dView::NO_SURFACE, "NO_SURFACE", "None"); - setDefault(Rim3dView::SURFACE); +template <> +void caf::AppEnum::setUp() +{ + addItem( Rim3dView::SURFACE, "SURFACE", "All" ); + addItem( Rim3dView::FAULTS, "FAULTS", "Faults only" ); + addItem( Rim3dView::NO_SURFACE, "NO_SURFACE", "None" ); + setDefault( Rim3dView::SURFACE ); } } // End namespace caf - -CAF_PDM_XML_ABSTRACT_SOURCE_INIT(Rim3dView, "GenericView"); // Do not use. Abstract class +CAF_PDM_XML_ABSTRACT_SOURCE_INIT( Rim3dView, "GenericView" ); // Do not use. Abstract class //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -Rim3dView::Rim3dView(void) +Rim3dView::Rim3dView( void ) { - RiaApplication* app = RiaApplication::instance(); + RiaApplication* app = RiaApplication::instance(); RiaPreferences* preferences = app->preferences(); - CVF_ASSERT(preferences); + CVF_ASSERT( preferences ); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); m_nameConfig = new RimViewNameConfig(); - CAF_PDM_InitField(&m_name_OBSOLETE, "UserDescription", QString(""), "Name", "", "", ""); - m_name_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField( &m_name_OBSOLETE, "UserDescription", QString( "" ), "Name", "", "", "" ); + m_name_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitField(&m_cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", ""); - m_cameraPosition.uiCapability()->setUiHidden(true); - - CAF_PDM_InitField(&m_cameraPointOfInterest, "CameraPointOfInterest", cvf::Vec3d::ZERO, "", "", "", ""); - m_cameraPointOfInterest.uiCapability()->setUiHidden(true); + CAF_PDM_InitField( &m_cameraPosition, "CameraPosition", cvf::Mat4d::IDENTITY, "", "", "", "" ); + m_cameraPosition.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField(&isPerspectiveView, "PerspectiveProjection", true, "Perspective Projection", "", "", ""); + CAF_PDM_InitField( &m_cameraPointOfInterest, "CameraPointOfInterest", cvf::Vec3d::ZERO, "", "", "", "" ); + m_cameraPointOfInterest.uiCapability()->setUiHidden( true ); + + CAF_PDM_InitField( &isPerspectiveView, "PerspectiveProjection", true, "Perspective Projection", "", "", "" ); double defaultScaleFactor = preferences->defaultScaleFactorZ; - CAF_PDM_InitField(&scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", ""); + CAF_PDM_InitField( &scaleZ, "GridZScale", defaultScaleFactor, "Z Scale", "", "Scales the scene in the Z direction", "" ); cvf::Color3f defBackgColor = preferences->defaultViewerBackgroundColor(); - RICF_InitField(&m_backgroundColor, "ViewBackgroundColor", defBackgColor, "Background", "", "", ""); + RICF_InitField( &m_backgroundColor, "ViewBackgroundColor", defBackgColor, "Background", "", "", "" ); - CAF_PDM_InitField(&maximumFrameRate, "MaximumFrameRate", 10, "Maximum Frame Rate", "", "", ""); - maximumFrameRate.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&hasUserRequestedAnimation, "AnimationMode", false, "Animation Mode", "", "", ""); - hasUserRequestedAnimation.uiCapability()->setUiHidden(true); + CAF_PDM_InitField( &maximumFrameRate, "MaximumFrameRate", 10, "Maximum Frame Rate", "", "", "" ); + maximumFrameRate.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &hasUserRequestedAnimation, "AnimationMode", false, "Animation Mode", "", "", "" ); + hasUserRequestedAnimation.uiCapability()->setUiHidden( true ); - CAF_PDM_InitField(&m_currentTimeStep, "CurrentTimeStep", 0, "Current Time Step", "", "", ""); - m_currentTimeStep.uiCapability()->setUiHidden(true); + CAF_PDM_InitField( &m_currentTimeStep, "CurrentTimeStep", 0, "Current Time Step", "", "", "" ); + m_currentTimeStep.uiCapability()->setUiHidden( true ); caf::AppEnum defaultMeshType = preferences->defaultMeshModeType(); - CAF_PDM_InitField(&meshMode, "MeshMode", defaultMeshType, "Grid Lines", "", "", ""); - CAF_PDM_InitFieldNoDefault(&surfaceMode, "SurfaceMode", "Grid Surface", "", "", ""); + CAF_PDM_InitField( &meshMode, "MeshMode", defaultMeshType, "Grid Lines", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &surfaceMode, "SurfaceMode", "Grid Surface", "", "", "" ); - RICF_InitField(&m_showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", ""); - - CAF_PDM_InitField(&m_disableLighting, "DisableLighting", false, "Disable Results Lighting", "", "Disable light model for scalar result colors", ""); + RICF_InitField( &m_showGridBox, "ShowGridBox", true, "Show Grid Box", "", "", "" ); - CAF_PDM_InitField(&m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", ""); - - RICF_InitField(&m_viewId, "ViewId", -1, "View ID", "", "", ""); - m_viewId.uiCapability()->setUiReadOnly(true); - m_viewId.capability()->setIOWriteable(false); + CAF_PDM_InitField( &m_disableLighting, + "DisableLighting", + false, + "Disable Results Lighting", + "", + "Disable light model for scalar result colors", + "" ); + + CAF_PDM_InitField( &m_showZScaleLabel, "ShowZScale", true, "Show Z Scale Label", "", "", "" ); + + RICF_InitField( &m_viewId, "ViewId", -1, "View ID", "", "", "" ); + m_viewId.uiCapability()->setUiReadOnly( true ); + m_viewId.capability()->setIOWriteable( false ); m_crossSectionVizModel = new cvf::ModelBasicList; - m_crossSectionVizModel->setName("CrossSectionModel"); + m_crossSectionVizModel->setName( "CrossSectionModel" ); m_highlightVizModel = new cvf::ModelBasicList; - m_highlightVizModel->setName("HighlightModel"); + m_highlightVizModel->setName( "HighlightModel" ); m_wellPathPipeVizModel = new cvf::ModelBasicList; - m_wellPathPipeVizModel->setName("WellPathPipeModel"); + m_wellPathPipeVizModel->setName( "WellPathPipeModel" ); - m_wellPathsPartManager = new RivWellPathsPartMgr(this); - m_annotationsPartManager = new RivAnnotationsPartMgr(this); + m_wellPathsPartManager = new RivWellPathsPartMgr( this ); + m_annotationsPartManager = new RivAnnotationsPartMgr( this ); - m_measurementPartManager = new RivMeasurementPartMgr(this); + m_measurementPartManager = new RivMeasurementPartMgr( this ); this->setAs3DViewMdiWindow(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -Rim3dView::~Rim3dView(void) +Rim3dView::~Rim3dView( void ) { - if (m_viewer) + if ( m_viewer ) { m_viewer->clearRimView(); } @@ -158,7 +162,7 @@ Rim3dView::~Rim3dView(void) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RiuViewer* Rim3dView::viewer() const { @@ -166,15 +170,15 @@ RiuViewer* Rim3dView::viewer() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setName(const QString& name) +void Rim3dView::setName( const QString& name ) { - m_nameConfig->setCustomName(name); + m_nameConfig->setCustomName( name ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString Rim3dView::name() const { @@ -192,50 +196,50 @@ int Rim3dView::id() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setId(int id) +void Rim3dView::setId( int id ) { m_viewId = id; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QWidget* Rim3dView::createViewWidget(QWidget* mainWindowParent) +QWidget* Rim3dView::createViewWidget( QWidget* mainWindowParent ) { QGLFormat glFormat; - glFormat.setDirectRendering(RiaGuiApplication::instance()->useShaders()); + glFormat.setDirectRendering( RiaGuiApplication::instance()->useShaders() ); - m_viewer = new RiuViewer(glFormat, mainWindowParent); - m_viewer->setOwnerReservoirView(this); + m_viewer = new RiuViewer( glFormat, mainWindowParent ); + m_viewer->setOwnerReservoirView( this ); cvf::String xLabel; cvf::String yLabel; cvf::String zLabel; - this->axisLabels(&xLabel, &yLabel, &zLabel); - m_viewer->setAxisLabels(xLabel, yLabel, zLabel); + this->axisLabels( &xLabel, &yLabel, &zLabel ); + m_viewer->setAxisLabels( xLabel, yLabel, zLabel ); updateZScaleLabel(); return m_viewer->layoutWidget(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateViewWidgetAfterCreation() { - m_viewer->setDefaultPerspectiveNearPlaneDistance(10); + m_viewer->setDefaultPerspectiveNearPlaneDistance( 10 ); this->resetLegendsInViewer(); m_viewer->updateNavigationPolicy(); - m_viewer->enablePerfInfoHud(RiaGuiApplication::instance()->showPerformanceInfo()); + m_viewer->enablePerfInfoHud( RiaGuiApplication::instance()->showPerformanceInfo() ); - m_viewer->mainCamera()->setViewMatrix(m_cameraPosition); - m_viewer->setPointOfInterest(m_cameraPointOfInterest()); - m_viewer->enableParallelProjection(!isPerspectiveView()); + m_viewer->mainCamera()->setViewMatrix( m_cameraPosition ); + m_viewer->setPointOfInterest( m_cameraPointOfInterest() ); + m_viewer->enableParallelProjection( !isPerspectiveView() ); - m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor())); + m_viewer->mainCamera()->viewport()->setClearColor( cvf::Color4f( backgroundColor() ) ); this->updateGridBoxData(); this->updateAnnotationItems(); @@ -251,79 +255,79 @@ void Rim3dView::initAfterRead() { RimViewWindow::initAfterRead(); - if (!m_name_OBSOLETE().isEmpty()) + if ( !m_name_OBSOLETE().isEmpty() ) { - nameConfig()->setCustomName(m_name_OBSOLETE()); - nameConfig()->setAddCaseName(false); - nameConfig()->setAddAggregationType(false); - nameConfig()->setAddProperty(false); - nameConfig()->setAddSampleSpacing(false); + nameConfig()->setCustomName( m_name_OBSOLETE() ); + nameConfig()->setAddCaseName( false ); + nameConfig()->setAddAggregationType( false ); + nameConfig()->setAddProperty( false ); + nameConfig()->setAddSampleSpacing( false ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateMdiWindowTitle() { - if (m_viewer) + if ( m_viewer ) { QString windowTitle; - if (ownerCase()) + if ( ownerCase() ) { - windowTitle = QString("%1 - %2").arg(ownerCase()->caseUserDescription()).arg(name()); + windowTitle = QString( "%1 - %2" ).arg( ownerCase()->caseUserDescription() ).arg( name() ); } else { windowTitle = name(); } - m_viewer->layoutWidget()->setWindowTitle(windowTitle); + m_viewer->layoutWidget()->setWindowTitle( windowTitle ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::deleteViewWidget() { - // Earlier implementations has used m_viewer->deleteLater(). This caused issues triggered by 3D editors and interaction with - // the event processing. deleteLater() will not be handeled by processEvents() if we are in the state of processing UI events, - // ie in the process of handling a QAction - + // Earlier implementations has used m_viewer->deleteLater(). This caused issues triggered by 3D editors and + // interaction with the event processing. deleteLater() will not be handeled by processEvents() if we are in the + // state of processing UI events, ie in the process of handling a QAction + delete m_viewer; m_viewer = nullptr; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void Rim3dView::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - uiOrdering.add(&m_viewId); + uiOrdering.add( &m_viewId ); - caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroupWithKeyword("Viewer", "ViewGroup"); + caf::PdmUiGroup* viewGroup = uiOrdering.addNewGroupWithKeyword( "Viewer", "ViewGroup" ); - viewGroup->add(&m_backgroundColor); - viewGroup->add(&m_showZScaleLabel); - viewGroup->add(&m_showGridBox); - viewGroup->add(&isPerspectiveView); - viewGroup->add(&m_disableLighting); + viewGroup->add( &m_backgroundColor ); + viewGroup->add( &m_showZScaleLabel ); + viewGroup->add( &m_showGridBox ); + viewGroup->add( &isPerspectiveView ); + viewGroup->add( &m_disableLighting ); - caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Grid Appearance"); - gridGroup->add(&scaleZ); - gridGroup->add(&meshMode); - gridGroup->add(&surfaceMode); + caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Grid Appearance" ); + gridGroup->add( &scaleZ ); + gridGroup->add( &meshMode ); + gridGroup->add( &surfaceMode ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QImage Rim3dView::snapshotWindowContent() { - if (m_viewer) + if ( m_viewer ) { // Force update of scheduled display models before snapshotting RiaViewRedrawScheduler::instance()->updateAndRedrawScheduledViews(); @@ -337,15 +341,15 @@ QImage Rim3dView::snapshotWindowContent() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::scheduleCreateDisplayModelAndRedraw() { - RiaViewRedrawScheduler::instance()->scheduleDisplayModelUpdateAndRedraw(this); - if (this->isMasterView()) + RiaViewRedrawScheduler::instance()->scheduleDisplayModelUpdateAndRedraw( this ); + if ( this->isMasterView() ) { RimViewLinker* viewLinker = this->assosiatedViewLinker(); - if (viewLinker) + if ( viewLinker ) { viewLinker->scheduleCreateDisplayModelAndRedrawForDependentViews(); } @@ -353,16 +357,16 @@ void Rim3dView::scheduleCreateDisplayModelAndRedraw() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setCurrentTimeStepAndUpdate(int frameIndex) +void Rim3dView::setCurrentTimeStepAndUpdate( int frameIndex ) { - setCurrentTimeStep(frameIndex); + setCurrentTimeStep( frameIndex ); this->updateCurrentTimeStep(); RimProject* project; - firstAncestorOrThisOfTypeAsserted(project); + firstAncestorOrThisOfTypeAsserted( project ); project->mainPlotCollection()->updateCurrentTimeStepInPlots(); appendAnnotationsToModel(); @@ -370,53 +374,52 @@ void Rim3dView::setCurrentTimeStepAndUpdate(int frameIndex) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QString Rim3dView::timeStepName(int frameIdx) const +QString Rim3dView::timeStepName( int frameIdx ) const { - return this->ownerCase()->timeStepName(frameIdx); + return this->ownerCase()->timeStepName( frameIdx ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setCurrentTimeStep(int frameIndex) +void Rim3dView::setCurrentTimeStep( int frameIndex ) { const int oldTimeStep = m_currentTimeStep; m_currentTimeStep = frameIndex; clampCurrentTimestep(); - if (m_currentTimeStep != oldTimeStep) + if ( m_currentTimeStep != oldTimeStep ) { - RiuTimeStepChangedHandler::instance()->handleTimeStepChanged(this); + RiuTimeStepChangedHandler::instance()->handleTimeStepChanged( this ); this->onTimeStepChanged(); } this->hasUserRequestedAnimation = true; - } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateCurrentTimeStepAndRedraw() { this->updateCurrentTimeStep(); RimProject* project; - firstAncestorOrThisOfTypeAsserted(project); + firstAncestorOrThisOfTypeAsserted( project ); project->mainPlotCollection()->updateCurrentTimeStepInPlots(); - if (m_viewer) m_viewer->update(); + if ( m_viewer ) m_viewer->update(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::createDisplayModelAndRedraw() { - if (m_viewer) + if ( m_viewer ) { this->clampCurrentTimestep(); @@ -424,53 +427,53 @@ void Rim3dView::createDisplayModelAndRedraw() createHighlightAndGridBoxDisplayModel(); updateDisplayModelVisibility(); - if (m_cameraPosition().isIdentity()) + if ( m_cameraPosition().isIdentity() ) { setDefaultView(); - m_cameraPosition = m_viewer->mainCamera()->viewMatrix(); + m_cameraPosition = m_viewer->mainCamera()->viewMatrix(); m_cameraPointOfInterest = m_viewer->pointOfInterest(); } } - if (RiuMainWindow::instance()) + if ( RiuMainWindow::instance() ) { RiuMainWindow::instance()->refreshAnimationActions(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::removeModelByName(cvf::Scene* scene, const cvf::String& modelName) +void Rim3dView::removeModelByName( cvf::Scene* scene, const cvf::String& modelName ) { std::vector modelsToBeRemoved; - for (cvf::uint i = 0; i < scene->modelCount(); i++) + for ( cvf::uint i = 0; i < scene->modelCount(); i++ ) { - if (scene->model(i)->name() == modelName) + if ( scene->model( i )->name() == modelName ) { - modelsToBeRemoved.push_back(scene->model(i)); + modelsToBeRemoved.push_back( scene->model( i ) ); } } - for (size_t i = 0; i < modelsToBeRemoved.size(); i++) + for ( size_t i = 0; i < modelsToBeRemoved.size(); i++ ) { - scene->removeModel(modelsToBeRemoved[i]); + scene->removeModel( modelsToBeRemoved[i] ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setDefaultView() { - if (m_viewer) + if ( m_viewer ) { m_viewer->setDefaultView(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::endAnimation() { @@ -479,7 +482,7 @@ void Rim3dView::endAnimation() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellPathCollection* Rim3dView::wellPathCollection() const { @@ -487,17 +490,17 @@ RimWellPathCollection* Rim3dView::wellPathCollection() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool Rim3dView::hasVisibleTimeStepDependent3dWellLogCurves() const { - if (wellPathCollection()) + if ( wellPathCollection() ) { std::vector wellLogCurves; - wellPathCollection()->descendantsIncludingThisOfType(wellLogCurves); - for (const Rim3dWellLogCurve* curve : wellLogCurves) + wellPathCollection()->descendantsIncludingThisOfType( wellLogCurves ); + for ( const Rim3dWellLogCurve* curve : wellLogCurves ) { - if (curve->showInView(this) && curve->isShowingTimeDependentResult()) + if ( curve->showInView( this ) && curve->isShowingTimeDependentResult() ) { return true; } @@ -508,66 +511,68 @@ bool Rim3dView::hasVisibleTimeStepDependent3dWellLogCurves() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setupBeforeSave() { - if (m_viewer) + if ( m_viewer ) { - hasUserRequestedAnimation = m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, and store the user intentions. But I guess that in practice... - m_cameraPosition = m_viewer->mainCamera()->viewMatrix(); + hasUserRequestedAnimation = + m_viewer->isAnimationActive(); // JJS: This is not conceptually correct. The variable is updated as we go, + // and store the user intentions. But I guess that in practice... + m_cameraPosition = m_viewer->mainCamera()->viewMatrix(); m_cameraPointOfInterest = m_viewer->pointOfInterest(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setMeshOnlyDrawstyle() { - meshMode.setValueWithFieldChanged(RiaDefines::FULL_MESH); - surfaceMode.setValueWithFieldChanged(NO_SURFACE); + meshMode.setValueWithFieldChanged( RiaDefines::FULL_MESH ); + surfaceMode.setValueWithFieldChanged( NO_SURFACE ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setMeshSurfDrawstyle() { - surfaceMode.setValueWithFieldChanged(SURFACE); - meshMode.setValueWithFieldChanged(RiaDefines::FULL_MESH); + surfaceMode.setValueWithFieldChanged( SURFACE ); + meshMode.setValueWithFieldChanged( RiaDefines::FULL_MESH ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setFaultMeshSurfDrawstyle() { - surfaceMode.setValueWithFieldChanged(SURFACE); - meshMode.setValueWithFieldChanged(RiaDefines::FAULTS_MESH); + surfaceMode.setValueWithFieldChanged( SURFACE ); + meshMode.setValueWithFieldChanged( RiaDefines::FAULTS_MESH ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setSurfOnlyDrawstyle() { - surfaceMode.setValueWithFieldChanged(SURFACE); - meshMode.setValueWithFieldChanged(RiaDefines::NO_MESH); + surfaceMode.setValueWithFieldChanged( SURFACE ); + meshMode.setValueWithFieldChanged( RiaDefines::NO_MESH ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::setSurfaceDrawstyle() { - if (surfaceMode() != NO_SURFACE) surfaceMode.setValueWithFieldChanged(SURFACE); + if ( surfaceMode() != NO_SURFACE ) surfaceMode.setValueWithFieldChanged( SURFACE ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::disableLighting(bool disable) +void Rim3dView::disableLighting( bool disable ) { m_disableLighting = disable; updateCurrentTimeStepAndRedraw(); @@ -575,7 +580,7 @@ void Rim3dView::disableLighting(bool disable) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool Rim3dView::isLightingDisabled() const { @@ -591,126 +596,108 @@ caf::PdmFieldHandle* Rim3dView::userDescriptionField() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void Rim3dView::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue); + RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue ); - if (changedField == &meshMode) + if ( changedField == &meshMode ) { createDisplayModel(); updateDisplayModelVisibility(); RiuMainWindow::instance()->refreshDrawStyleActions(); RiuMainWindow::instance()->refreshAnimationActions(); } - else if (changedField == &isPerspectiveView) + else if ( changedField == &isPerspectiveView ) { - if (m_viewer) m_viewer->enableParallelProjection(!isPerspectiveView()); + if ( m_viewer ) m_viewer->enableParallelProjection( !isPerspectiveView() ); } - else if (changedField == &scaleZ) + else if ( changedField == &scaleZ ) { updateScaling(); RiuMainWindow::instance()->updateScaleValue(); } - else if (changedField == &surfaceMode) + else if ( changedField == &surfaceMode ) { createDisplayModel(); updateDisplayModelVisibility(); RiuMainWindow::instance()->refreshDrawStyleActions(); RiuMainWindow::instance()->refreshAnimationActions(); } - else if (changedField == &m_showGridBox) + else if ( changedField == &m_showGridBox ) { createHighlightAndGridBoxDisplayModelWithRedraw(); } - else if (changedField == &m_disableLighting) + else if ( changedField == &m_disableLighting ) { createDisplayModel(); RiuMainWindow::instance()->refreshDrawStyleActions(); RiuMainWindow::instance()->refreshAnimationActions(); } - else if (changedField == m_nameConfig->nameField()) + else if ( changedField == m_nameConfig->nameField() ) { updateMdiWindowTitle(); - if (viewController()) + if ( viewController() ) { viewController()->updateDisplayNameAndIcon(); viewController()->updateConnectedEditors(); } else { - if (isMasterView()) + if ( isMasterView() ) { assosiatedViewLinker()->updateUiNameAndIcon(); assosiatedViewLinker()->updateConnectedEditors(); } } } - else if (changedField == &m_currentTimeStep) + else if ( changedField == &m_currentTimeStep ) { - if (m_viewer) + if ( m_viewer ) { m_viewer->update(); - - } } - else if (changedField == &m_backgroundColor) + else if ( changedField == &m_backgroundColor ) { this->applyBackgroundColorAndFontChanges(); } - else if (changedField == &maximumFrameRate) + else if ( changedField == &maximumFrameRate ) { // !! Use cvf::UNDEFINED_INT or something if we end up with frame rate 0? // !! Should be able to specify legal range for number properties - if (m_viewer) + if ( m_viewer ) { - m_viewer->animationControl()->setTimeout(maximumFrameRate != 0 ? 1000/maximumFrameRate : std::numeric_limits::max()); + m_viewer->animationControl()->setTimeout( maximumFrameRate != 0 ? 1000 / maximumFrameRate + : std::numeric_limits::max() ); } } - else if (changedField == &m_showZScaleLabel) + else if ( changedField == &m_showZScaleLabel ) { - m_viewer->showZScaleLabel(m_showZScaleLabel()); + m_viewer->showZScaleLabel( m_showZScaleLabel() ); m_viewer->update(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::addWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, - const cvf::BoundingBox& wellPathClipBoundingBox) +void Rim3dView::addWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox ) { - if (!this->ownerCase()) return; + if ( !this->ownerCase() ) return; cvf::ref transForm = displayCoordTransform(); - m_wellPathsPartManager->appendStaticGeometryPartsToModel(wellPathModelBasicList, - transForm.p(), - this->ownerCase()->characteristicCellSize(), - wellPathClipBoundingBox); - - wellPathModelBasicList->updateBoundingBoxesRecursive(); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void Rim3dView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBasicList, const cvf::BoundingBox& wellPathClipBoundingBox) -{ - if (!this->ownerCase()) return; - - cvf::ref transForm = displayCoordTransform(); - - size_t timeStepIndex = currentTimeStep(); - m_wellPathsPartManager->appendDynamicGeometryPartsToModel(wellPathModelBasicList, - timeStepIndex, + m_wellPathsPartManager->appendStaticGeometryPartsToModel( wellPathModelBasicList, transForm.p(), this->ownerCase()->characteristicCellSize(), - wellPathClipBoundingBox); + wellPathClipBoundingBox ); wellPathModelBasicList->updateBoundingBoxesRecursive(); } @@ -718,21 +705,43 @@ void Rim3dView::addDynamicWellPathsToModel(cvf::ModelBasicList* wellPathModelBas //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicList) +void Rim3dView::addDynamicWellPathsToModel( cvf::ModelBasicList* wellPathModelBasicList, + const cvf::BoundingBox& wellPathClipBoundingBox ) { - if (!this->ownerCase()) return; + if ( !this->ownerCase() ) return; + + cvf::ref transForm = displayCoordTransform(); + + size_t timeStepIndex = currentTimeStep(); + m_wellPathsPartManager->appendDynamicGeometryPartsToModel( wellPathModelBasicList, + timeStepIndex, + transForm.p(), + this->ownerCase()->characteristicCellSize(), + wellPathClipBoundingBox ); + + wellPathModelBasicList->updateBoundingBoxesRecursive(); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::addAnnotationsToModel( cvf::ModelBasicList* wellPathModelBasicList ) +{ + if ( !this->ownerCase() ) return; std::vector annotationCollections; - descendantsIncludingThisOfType(annotationCollections); + descendantsIncludingThisOfType( annotationCollections ); - if (annotationCollections.empty() || !annotationCollections.front()->isActive()) + if ( annotationCollections.empty() || !annotationCollections.front()->isActive() ) { m_annotationsPartManager->clearGeometryCache(); } else { cvf::ref transForm = displayCoordTransform(); - m_annotationsPartManager->appendGeometryPartsToModel(wellPathModelBasicList, transForm.p(), ownerCase()->allCellsBoundingBox()); + m_annotationsPartManager->appendGeometryPartsToModel( wellPathModelBasicList, + transForm.p(), + ownerCase()->allCellsBoundingBox() ); } wellPathModelBasicList->updateBoundingBoxesRecursive(); @@ -741,30 +750,32 @@ void Rim3dView::addAnnotationsToModel(cvf::ModelBasicList* wellPathModelBasicLis //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::addMeasurementToModel(cvf::ModelBasicList* wellPathModelBasicList) +void Rim3dView::addMeasurementToModel( cvf::ModelBasicList* wellPathModelBasicList ) { - if (!this->ownerCase()) return; + if ( !this->ownerCase() ) return; RimMeasurement* measurement = RiaApplication::instance()->project()->measurement(); - if (!measurement || measurement->pointsInDomainCoords().empty()) + if ( !measurement || measurement->pointsInDomainCoords().empty() ) { m_measurementPartManager->clearGeometryCache(); } else { cvf::ref transForm = displayCoordTransform(); - m_measurementPartManager->appendGeometryPartsToModel(m_viewer->mainCamera(), - wellPathModelBasicList, transForm.p(), ownerCase()->allCellsBoundingBox()); + m_measurementPartManager->appendGeometryPartsToModel( m_viewer->mainCamera(), + wellPathModelBasicList, + transForm.p(), + ownerCase()->allCellsBoundingBox() ); } wellPathModelBasicList->updateBoundingBoxesRecursive(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setScaleZAndUpdate(double scalingFactor) +void Rim3dView::setScaleZAndUpdate( double scalingFactor ) { this->scaleZ = scalingFactor; updateScaleTransform(); @@ -775,12 +786,12 @@ void Rim3dView::setScaleZAndUpdate(double scalingFactor) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool Rim3dView::isMasterView() const { RimViewLinker* viewLinker = this->assosiatedViewLinker(); - if (viewLinker && this == viewLinker->masterView()) + if ( viewLinker && this == viewLinker->masterView() ) { return true; } @@ -789,27 +800,26 @@ bool Rim3dView::isMasterView() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateGridBoxData() { - if (m_viewer && ownerCase()) + if ( m_viewer && ownerCase() ) { - m_viewer->updateGridBoxData(scaleZ(), - ownerCase()->displayModelOffset(), - backgroundColor(), - showActiveCellsOnly() ? ownerCase()->activeCellsBoundingBox() - : ownerCase()->allCellsBoundingBox() - ); + m_viewer->updateGridBoxData( scaleZ(), + ownerCase()->displayModelOffset(), + backgroundColor(), + showActiveCellsOnly() ? ownerCase()->activeCellsBoundingBox() + : ownerCase()->allCellsBoundingBox() ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateAnnotationItems() { - if (m_viewer) + if ( m_viewer ) { m_viewer->updateAnnotationItems(); } @@ -820,11 +830,11 @@ void Rim3dView::updateAnnotationItems() //-------------------------------------------------------------------------------------------------- void Rim3dView::updateScaling() { - if (scaleZ < 1) scaleZ = 1; + if ( scaleZ < 1 ) scaleZ = 1; this->updateGridBoxData(); - if (m_viewer) + if ( m_viewer ) { cvf::Vec3d poi = m_viewer->pointOfInterest(); cvf::Vec3d eye, dir, up; @@ -832,11 +842,11 @@ void Rim3dView::updateScaling() dir = m_viewer->mainCamera()->direction(); up = m_viewer->mainCamera()->up(); - eye[2] = poi[2] * scaleZ() / this->scaleTransform()->worldTransform()(2, 2) + (eye[2] - poi[2]); - poi[2] = poi[2] * scaleZ() / this->scaleTransform()->worldTransform()(2, 2); + eye[2] = poi[2] * scaleZ() / this->scaleTransform()->worldTransform()( 2, 2 ) + ( eye[2] - poi[2] ); + poi[2] = poi[2] * scaleZ() / this->scaleTransform()->worldTransform()( 2, 2 ); - m_viewer->mainCamera()->setFromLookAt(eye, eye + dir, up); - m_viewer->setPointOfInterest(poi); + m_viewer->mainCamera()->setFromLookAt( eye, eye + dir, up ); + m_viewer->setPointOfInterest( poi ); updateScaleTransform(); createDisplayModelAndRedraw(); @@ -853,8 +863,8 @@ void Rim3dView::updateScaling() void Rim3dView::updateZScaleLabel() { // Update Z scale label - int scale = static_cast(scaleZ()); - m_viewer->setZScale(scale); + int scale = static_cast( scaleZ() ); + m_viewer->setZScale( scale ); } //-------------------------------------------------------------------------------------------------- @@ -862,7 +872,7 @@ void Rim3dView::updateZScaleLabel() //-------------------------------------------------------------------------------------------------- void Rim3dView::updateMeasurement() { - if (m_viewer) + if ( m_viewer ) { appendMeasurementToModel(); m_viewer->update(); @@ -870,67 +880,67 @@ void Rim3dView::updateMeasurement() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::createHighlightAndGridBoxDisplayModelWithRedraw() { createHighlightAndGridBoxDisplayModel(); - if (m_viewer) + if ( m_viewer ) { m_viewer->update(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::createHighlightAndGridBoxDisplayModel() { - m_viewer->removeStaticModel(m_highlightVizModel.p()); + m_viewer->removeStaticModel( m_highlightVizModel.p() ); m_highlightVizModel->removeAllParts(); cvf::Collection parts; - createPartCollectionFromSelection(&parts); - if (parts.size() > 0) + createPartCollectionFromSelection( &parts ); + if ( parts.size() > 0 ) { - for (size_t i = 0; i < parts.size(); i++) + for ( size_t i = 0; i < parts.size(); i++ ) { - m_highlightVizModel->addPart(parts[i].p()); + m_highlightVizModel->addPart( parts[i].p() ); } m_highlightVizModel->updateBoundingBoxesRecursive(); - m_viewer->addStaticModelOnce(m_highlightVizModel.p()); + m_viewer->addStaticModelOnce( m_highlightVizModel.p() ); } - m_viewer->showGridBox(m_showGridBox()); -} - -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void Rim3dView::setBackgroundColor(const cvf::Color3f& newBackgroundColor) -{ - m_backgroundColor = newBackgroundColor; + m_viewer->showGridBox( m_showGridBox() ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setShowGridBox(bool showGridBox) +void Rim3dView::setBackgroundColor( const cvf::Color3f& newBackgroundColor ) +{ + m_backgroundColor = newBackgroundColor; +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void Rim3dView::setShowGridBox( bool showGridBox ) { m_showGridBox = showGridBox; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::applyBackgroundColorAndFontChanges() { - if (m_viewer != nullptr) + if ( m_viewer != nullptr ) { - m_viewer->mainCamera()->viewport()->setClearColor(cvf::Color4f(backgroundColor())); + m_viewer->mainCamera()->viewport()->setClearColor( cvf::Color4f( backgroundColor() ) ); m_viewer->updateFonts(); } updateGridBoxData(); @@ -947,64 +957,57 @@ void Rim3dView::performAutoNameUpdate() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::updateDisplayModelVisibility() { - if (m_viewer.isNull()) return; + if ( m_viewer.isNull() ) return; - const cvf::uint uintSurfaceBit = surfaceBit; - const cvf::uint uintMeshSurfaceBit = meshSurfaceBit; - const cvf::uint uintFaultBit = faultBit; - const cvf::uint uintMeshFaultBit = meshFaultBit; - const cvf::uint uintIntersectionCellFaceBit = intersectionCellFaceBit; - const cvf::uint uintIntersectionCellMeshBit = intersectionCellMeshBit; - const cvf::uint uintIntersectionFaultMeshBit = intersectionFaultMeshBit; + const cvf::uint uintSurfaceBit = surfaceBit; + const cvf::uint uintMeshSurfaceBit = meshSurfaceBit; + const cvf::uint uintFaultBit = faultBit; + const cvf::uint uintMeshFaultBit = meshFaultBit; + const cvf::uint uintIntersectionCellFaceBit = intersectionCellFaceBit; + const cvf::uint uintIntersectionCellMeshBit = intersectionCellMeshBit; + const cvf::uint uintIntersectionFaultMeshBit = intersectionFaultMeshBit; // Initialize the mask to show everything except the the bits controlled here - unsigned int mask = - 0xffffffff - & ~uintSurfaceBit - & ~uintFaultBit - & ~uintMeshSurfaceBit - & ~uintMeshFaultBit - & ~intersectionCellFaceBit - & ~intersectionCellMeshBit - & ~intersectionFaultMeshBit; + unsigned int mask = 0xffffffff & ~uintSurfaceBit & ~uintFaultBit & ~uintMeshSurfaceBit & ~uintMeshFaultBit & + ~intersectionCellFaceBit & ~intersectionCellMeshBit & ~intersectionFaultMeshBit; // Then turn the appropriate bits on according to the user settings - if (surfaceMode == SURFACE) + if ( surfaceMode == SURFACE ) { mask |= uintSurfaceBit; mask |= uintFaultBit; mask |= intersectionCellFaceBit; } - else if (surfaceMode == FAULTS) + else if ( surfaceMode == FAULTS ) { mask |= uintFaultBit; mask |= intersectionCellFaceBit; } - if (meshMode == RiaDefines::FULL_MESH) + if ( meshMode == RiaDefines::FULL_MESH ) { mask |= uintMeshSurfaceBit; mask |= uintMeshFaultBit; mask |= intersectionCellMeshBit; mask |= intersectionFaultMeshBit; } - else if (meshMode == RiaDefines::FAULTS_MESH) + else if ( meshMode == RiaDefines::FAULTS_MESH ) { mask |= uintMeshFaultBit; mask |= intersectionFaultMeshBit; } - m_viewer->setEnableMask(mask); + m_viewer->setEnableMask( mask ); m_viewer->update(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool Rim3dView::showActiveCellsOnly() { @@ -1012,30 +1015,30 @@ bool Rim3dView::showActiveCellsOnly() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::zoomAll() { - if (m_viewer) + if ( m_viewer ) { m_viewer->zoomAll(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- cvf::ref Rim3dView::displayCoordTransform() const { cvf::ref coordTrans = new caf::DisplayCoordTransform; - cvf::Vec3d scale(1.0, 1.0, scaleZ); - coordTrans->setScale(scale); + cvf::Vec3d scale( 1.0, 1.0, scaleZ ); + coordTrans->setScale( scale ); RimCase* rimCase = ownerCase(); - if (rimCase) + if ( rimCase ) { - coordTrans->setTranslation(rimCase->displayModelOffset()); + coordTrans->setTranslation( rimCase->displayModelOffset() ); } return coordTrans; @@ -1044,7 +1047,7 @@ cvf::ref Rim3dView::displayCoordTransform() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool Rim3dView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, int defaultFontSize) const +bool Rim3dView::hasCustomFontSizes( RiaDefines::FontSettingType fontSettingType, int defaultFontSize ) const { return false; } @@ -1052,9 +1055,12 @@ bool Rim3dView::hasCustomFontSizes(RiaDefines::FontSettingType fontSettingType, //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -bool Rim3dView::applyFontSize(RiaDefines::FontSettingType fontSettingType, int oldFontSize, int fontSize, bool forceChange /*= false*/) +bool Rim3dView::applyFontSize( RiaDefines::FontSettingType fontSettingType, + int oldFontSize, + int fontSize, + bool forceChange /*= false*/ ) { - if (fontSettingType == RiaDefines::SCENE_FONT) + if ( fontSettingType == RiaDefines::SCENE_FONT ) { applyBackgroundColorAndFontChanges(); return true; @@ -1063,7 +1069,7 @@ bool Rim3dView::applyFontSize(RiaDefines::FontSettingType fontSettingType, int o } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- cvf::Mat4d Rim3dView::cameraPosition() const { @@ -1071,7 +1077,7 @@ cvf::Mat4d Rim3dView::cameraPosition() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- cvf::Vec3d Rim3dView::cameraPointOfInterest() const { @@ -1087,44 +1093,46 @@ RimViewNameConfig* Rim3dView::nameConfig() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QWidget* Rim3dView::viewWidget() { - if ( m_viewer ) return m_viewer->layoutWidget(); - else return nullptr; + if ( m_viewer ) + return m_viewer->layoutWidget(); + else + return nullptr; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::forceShowWindowOn() { - m_showWindow.setValueWithFieldChanged(true); + m_showWindow.setValueWithFieldChanged( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::disableGridBoxField() { m_showGridBox = false; - RiaFieldhandleTools::disableWriteAndSetFieldHidden(&m_showGridBox); + RiaFieldhandleTools::disableWriteAndSetFieldHidden( &m_showGridBox ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::disablePerspectiveProjectionField() { isPerspectiveView = false; - RiaFieldhandleTools::disableWriteAndSetFieldHidden(&isPerspectiveView); + RiaFieldhandleTools::disableWriteAndSetFieldHidden( &isPerspectiveView ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dView::handleMdiWindowClosed() { @@ -1132,11 +1140,11 @@ void Rim3dView::handleMdiWindowClosed() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dView::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) +void Rim3dView::setMdiWindowGeometry( const RimMdiWindowGeometry& windowGeometry ) { - RimViewWindow::setMdiWindowGeometry(windowGeometry); + RimViewWindow::setMdiWindowGeometry( windowGeometry ); } //-------------------------------------------------------------------------------------------------- @@ -1144,20 +1152,20 @@ void Rim3dView::setMdiWindowGeometry(const RimMdiWindowGeometry& windowGeometry) //-------------------------------------------------------------------------------------------------- void Rim3dView::appendAnnotationsToModel() { - if (!m_viewer) return; + if ( !m_viewer ) return; - cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); - if (frameScene) + cvf::Scene* frameScene = m_viewer->frame( m_currentTimeStep ); + if ( frameScene ) { cvf::String name = "Annotations"; - this->removeModelByName(frameScene, name); + this->removeModelByName( frameScene, name ); cvf::ref model = new cvf::ModelBasicList; - model->setName(name); + model->setName( name ); - addAnnotationsToModel(model.p()); + addAnnotationsToModel( model.p() ); - frameScene->addModel(model.p()); + frameScene->addModel( model.p() ); } } @@ -1166,19 +1174,19 @@ void Rim3dView::appendAnnotationsToModel() //-------------------------------------------------------------------------------------------------- void Rim3dView::appendMeasurementToModel() { - if (!m_viewer) return; + if ( !m_viewer ) return; - cvf::Scene* frameScene = m_viewer->frame(m_currentTimeStep); - if (frameScene) + cvf::Scene* frameScene = m_viewer->frame( m_currentTimeStep ); + if ( frameScene ) { cvf::String name = "Measurement"; - this->removeModelByName(frameScene, name); + this->removeModelByName( frameScene, name ); cvf::ref model = new cvf::ModelBasicList; - model->setName(name); + model->setName( name ); - addMeasurementToModel(model.p()); + addMeasurementToModel( model.p() ); - frameScene->addModel(model.p()); + frameScene->addModel( model.p() ); } } diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp index 200a9841df..2f10e1d552 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogExtractionCurve.cpp @@ -20,20 +20,17 @@ #include "RigWellLogFile.h" -#include "RiaExtractionTools.h" #include "RiaCurveDataTools.h" +#include "RiaExtractionTools.h" +#include "RigCaseCellResultsData.h" #include "RigEclipseCaseData.h" -#include "RigGeoMechCaseData.h" #include "RigEclipseWellLogExtractor.h" +#include "RigFemPartResultsCollection.h" +#include "RigGeoMechCaseData.h" #include "RigGeoMechWellLogExtractor.h" #include "RigResultAccessorFactory.h" -#include "RigCaseCellResultsData.h" -#include "RigFemPartResultsCollection.h" #include "RigWellPath.h" -#include "RimEclipseCase.h" -#include "RimGeoMechCase.h" #include "Rim3dView.h" -#include "RimWellLogExtractionCurveNameConfig.h" #include "RimCase.h" #include "RimEclipseCase.h" #include "RimEclipseCellColors.h" @@ -43,9 +40,10 @@ #include "RimGeoMechResultDefinition.h" #include "RimGeoMechView.h" #include "RimTools.h" +#include "RimWellLogExtractionCurve.h" +#include "RimWellLogExtractionCurveNameConfig.h" #include "RimWellLogFile.h" #include "RimWellLogFileChannel.h" -#include "RimWellLogExtractionCurve.h" #include "RimWellPath.h" #include "cafUtils.h" @@ -59,41 +57,41 @@ /// //================================================================================================== -CAF_PDM_SOURCE_INIT(Rim3dWellLogExtractionCurve, "Rim3dWellLogExtractionCurve"); +CAF_PDM_SOURCE_INIT( 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", "", "", ""); - m_case.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_case, "CurveCase", "Case", "", "", "" ); + m_case.uiCapability()->setUiTreeChildrenHidden( true ); 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", "", "", "", ""); - m_eclipseResultDefinition.uiCapability()->setUiHidden(true); - m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultDefinition, "CurveEclipseResult", "", "", "", "" ); + m_eclipseResultDefinition.uiCapability()->setUiHidden( true ); + m_eclipseResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); 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", "", "", "", ""); - m_geomResultDefinition.uiCapability()->setUiHidden(true); - m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_geomResultDefinition, "CurveGeomechResult", "", "", "", "" ); + m_geomResultDefinition.uiCapability()->setUiHidden( true ); + m_geomResultDefinition.uiCapability()->setUiTreeChildrenHidden( true ); m_geomResultDefinition = new RimGeoMechResultDefinition; - m_geomResultDefinition->setAddWellPathDerivedResults(true); + m_geomResultDefinition->setAddWellPathDerivedResults( true ); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); - m_nameConfig = new RimWellLogExtractionCurveNameConfig(); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); + m_nameConfig = new RimWellLogExtractionCurveNameConfig(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve() +Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve() { delete m_geomResultDefinition; delete m_eclipseResultDefinition; @@ -101,29 +99,29 @@ Rim3dWellLogExtractionCurve::~Rim3dWellLogExtractionCurve() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogExtractionCurve::setPropertiesFromView(Rim3dView* view) +void Rim3dWellLogExtractionCurve::setPropertiesFromView( Rim3dView* view ) { - if (!view) return; + if ( !view ) return; m_case = view->ownerCase(); - RimGeoMechCase* geomCase = dynamic_cast(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); - m_eclipseResultDefinition->setEclipseCase(eclipseCase); - m_geomResultDefinition->setGeoMechCase(geomCase); + RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); + m_eclipseResultDefinition->setEclipseCase( eclipseCase ); + m_geomResultDefinition->setGeoMechCase( geomCase ); - RimEclipseView* eclipseView = dynamic_cast(view); - if (eclipseView) + RimEclipseView* eclipseView = dynamic_cast( view ); + if ( eclipseView ) { - m_eclipseResultDefinition->simpleCopy(eclipseView->cellResult()); + m_eclipseResultDefinition->simpleCopy( eclipseView->cellResult() ); } - RimGeoMechView* geoMechView = dynamic_cast(view); - if (geoMechView) + RimGeoMechView* geoMechView = dynamic_cast( view ); + 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 { - RimGeoMechCase* geoMechCase = dynamic_cast(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimGeoMechCase* geoMechCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); 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(); - if (resCompName.isEmpty()) + if ( resCompName.isEmpty() ) { name = m_geomResultDefinition->resultFieldUiName(); } @@ -167,66 +165,70 @@ bool Rim3dWellLogExtractionCurve::followAnimationTimeStep() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogExtractionCurve::curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const +void Rim3dWellLogExtractionCurve::curveValuesAndMds( std::vector* values, + std::vector* 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* values, std::vector* measuredDepthValues, int timeStep) const +void Rim3dWellLogExtractionCurve::curveValuesAndMdsAtTimeStep( std::vector* values, + std::vector* measuredDepthValues, + int timeStep ) const { - CAF_ASSERT(values != nullptr); - CAF_ASSERT(measuredDepthValues != nullptr); + CAF_ASSERT( values != nullptr ); + CAF_ASSERT( measuredDepthValues != nullptr ); cvf::ref eclExtractor; cvf::ref geomExtractor; RimWellPath* wellPath; - firstAncestorOrThisOfType(wellPath); + firstAncestorOrThisOfType( wellPath ); - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); - if (eclipseCase) + if ( eclipseCase ) { - eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase(wellPath, eclipseCase); + eclExtractor = RiaExtractionTools::wellLogExtractorEclipseCase( wellPath, eclipseCase ); } else { - RimGeoMechCase* geomCase = dynamic_cast(m_case()); - if (geomCase) + RimGeoMechCase* geomCase = dynamic_cast( m_case() ); + if ( geomCase ) { - geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase(wellPath, geomCase); + geomExtractor = RiaExtractionTools::wellLogExtractorGeoMechCase( wellPath, geomCase ); } } - if (eclExtractor.notNull() && eclipseCase) + if ( eclExtractor.notNull() && eclipseCase ) { *measuredDepthValues = eclExtractor->cellIntersectionMDs(); m_eclipseResultDefinition->loadResult(); - cvf::ref resAcc = RigResultAccessorFactory::createFromResultDefinition(eclipseCase->eclipseCaseData(), - 0, - timeStep, - m_eclipseResultDefinition); - if (resAcc.notNull()) + cvf::ref resAcc = + RigResultAccessorFactory::createFromResultDefinition( eclipseCase->eclipseCaseData(), + 0, + timeStep, + 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(); - RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles(wellPath, geomExtractor.p()); + RimWellLogExtractionCurve::findAndLoadWbsParametersFromLasFiles( wellPath, geomExtractor.p() ); m_geomResultDefinition->loadResult(); - geomExtractor->setRkbDiff(rkbDiff()); - geomExtractor->curveData(m_geomResultDefinition->resultAddress(), timeStep, values); + geomExtractor->setRkbDiff( rkbDiff() ); + geomExtractor->curveData( m_geomResultDefinition->resultAddress(), timeStep, values ); } } @@ -237,39 +239,39 @@ std::pair Rim3dWellLogExtractionCurve::findCurveValueRange() { double foundMinValue = std::numeric_limits::infinity(); double foundMaxValue = -std::numeric_limits::infinity(); - if (m_case()) + if ( m_case() ) { std::set timeStepsToCheck; - if (followAnimationTimeStep()) + if ( followAnimationTimeStep() ) { // 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 { - timeStepsToCheck.insert(m_timeStep()); + timeStepsToCheck.insert( m_timeStep() ); } - for (int timeStep : timeStepsToCheck) + for ( int timeStep : timeStepsToCheck ) { std::vector values; std::vector 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); - foundMaxValue = std::max(foundMaxValue, value); + foundMinValue = std::min( foundMinValue, value ); + foundMaxValue = std::max( foundMaxValue, value ); } } } } - return std::make_pair(foundMinValue, foundMaxValue); + return std::make_pair( foundMinValue, foundMaxValue ); } QString Rim3dWellLogExtractionCurve::name() const @@ -282,91 +284,91 @@ QString Rim3dWellLogExtractionCurve::name() const //-------------------------------------------------------------------------------------------------- QString Rim3dWellLogExtractionCurve::createAutoName() const { - RimGeoMechCase* geomCase = dynamic_cast(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); 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; - if (m_nameConfig->addWellName()) + if ( m_nameConfig->addWellName() ) { RimWellPath* wellPath; - this->firstAncestorOrThisOfTypeAsserted(wellPath); - if (!wellPath->name().isEmpty()) + this->firstAncestorOrThisOfTypeAsserted( wellPath ); + if ( !wellPath->name().isEmpty() ) { 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; - if (eclipseCase) + if ( eclipseCase ) { addTimeStep = addTimeStep && m_eclipseResultDefinition->resultType() != RiaDefines::STATIC_NATIVE; 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(); - if (data) + if ( data ) { maxTimeStep = data->femPartResults()->frameCount(); } } - if (m_nameConfig->addDate()) + if ( m_nameConfig->addDate() ) { 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( ": " ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- double Rim3dWellLogExtractionCurve::rkbDiff() const { RimWellPath* wellPath; - firstAncestorOrThisOfType(wellPath); + firstAncestorOrThisOfType( wellPath ); - if (wellPath && wellPath->wellPathGeometry()) + if ( wellPath && wellPath->wellPathGeometry() ) { return wellPath->wellPathGeometry()->rkbDiff(); } @@ -374,17 +376,16 @@ double Rim3dWellLogExtractionCurve::rkbDiff() const return HUGE_VAL; } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- bool Rim3dWellLogExtractionCurve::isShowingTimeDependentResult() const { - if (dynamic_cast(m_case())) + if ( dynamic_cast( m_case() ) ) { return m_eclipseResultDefinition->hasDynamicResult(); } - else if (dynamic_cast(m_case())) + else if ( dynamic_cast( m_case() ) ) { 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(m_case())) + if ( dynamic_cast( m_case() ) ) { - return dynamic_cast(gridView) != nullptr; + return dynamic_cast( gridView ) != nullptr; } - else if (dynamic_cast(m_case())) + else if ( dynamic_cast( m_case() ) ) { - return dynamic_cast(gridView) != nullptr; + return dynamic_cast( gridView ) != nullptr; } } return false; @@ -421,58 +422,61 @@ caf::PdmFieldHandle* Rim3dWellLogExtractionCurve::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogExtractionCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) -{ - if (changedField == &m_case) +void Rim3dWellLogExtractionCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) +{ + if ( changedField == &m_case ) { - RimEclipseCase* eclipseCase = dynamic_cast(m_case()); - RimGeoMechCase* geoMechCase = dynamic_cast(m_case()); - if (eclipseCase) + RimEclipseCase* eclipseCase = dynamic_cast( m_case() ); + RimGeoMechCase* geoMechCase = dynamic_cast( m_case() ); + 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(); } - else if (changedField == &m_timeStep) + else if ( changedField == &m_timeStep ) { this->resetMinMaxValuesAndUpdateUI(); } - Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); + Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList Rim3dWellLogExtractionCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList + Rim3dWellLogExtractionCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { QList 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; - if (m_case) + if ( m_case ) { timeStepNames = m_case->timeStepStrings(); } - options.push_back(caf::PdmOptionItemInfo(QString("Follow Animation Time Step"), -1)); - for (int i = 0; i < timeStepNames.size(); i++) + options.push_back( caf::PdmOptionItemInfo( QString( "Follow Animation Time Step" ), -1 ) ); + 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,81 +486,80 @@ QList 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(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( 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()) - || geomCase) + if ( ( eclipseCase && m_eclipseResultDefinition->hasDynamicResult() ) || geomCase ) { - curveDataGroup->add(&m_timeStep); + curveDataGroup->add( &m_timeStep ); } - Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); + Rim3dWellLogCurve::configurationUiOrdering( uiOrdering ); - caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); - m_nameConfig->uiOrdering(uiConfigName, *nameGroup); + caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" ); + m_nameConfig->uiOrdering( uiConfigName, *nameGroup ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void Rim3dWellLogExtractionCurve::initAfterRead() { - RimGeoMechCase* geomCase = dynamic_cast(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); - m_eclipseResultDefinition->setEclipseCase(eclipseCase); - m_geomResultDefinition->setGeoMechCase(geomCase); + m_eclipseResultDefinition->setEclipseCase( eclipseCase ); + m_geomResultDefinition->setGeoMechCase( geomCase ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString Rim3dWellLogExtractionCurve::wellDate() const { - RimGeoMechCase* geomCase = dynamic_cast(m_case.value()); - RimEclipseCase* eclipseCase = dynamic_cast(m_case.value()); + RimGeoMechCase* geomCase = dynamic_cast( m_case.value() ); + RimEclipseCase* eclipseCase = dynamic_cast( m_case.value() ); QStringList timeStepNames; - if (eclipseCase) + if ( eclipseCase ) { - if (m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE) + if ( m_eclipseResultDefinition->resultType() == RiaDefines::STATIC_NATIVE ) { return QString(); } - if (eclipseCase->eclipseCaseData()) + if ( eclipseCase->eclipseCaseData() ) { timeStepNames = eclipseCase->timeStepStrings(); } } - else if (geomCase) + else if ( geomCase ) { - if (geomCase->geoMechData()) + if ( geomCase->geoMechData() ) { 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] : ""; } diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp index 86f6b6be2e..cfd65e55b2 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogFileCurve.cpp @@ -20,9 +20,9 @@ #include "RigWellLogFile.h" -#include "RimWellLogFileCurveNameConfig.h" #include "RimWellLogFile.h" #include "RimWellLogFileChannel.h" +#include "RimWellLogFileCurveNameConfig.h" #include "RimWellPath.h" #include @@ -32,29 +32,27 @@ /// //================================================================================================== -CAF_PDM_SOURCE_INIT(Rim3dWellLogFileCurve, "Rim3dWellLogFileCurve"); +CAF_PDM_SOURCE_INIT( 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(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() -{ -} +Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() {} //-------------------------------------------------------------------------------------------------- /// @@ -62,18 +60,18 @@ Rim3dWellLogFileCurve::~Rim3dWellLogFileCurve() void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo() { RimWellPath* wellPath = nullptr; - firstAncestorOrThisOfType(wellPath); + firstAncestorOrThisOfType( wellPath ); - if (wellPath && !wellPath->wellLogFiles().empty()) + if ( wellPath && !wellPath->wellLogFiles().empty() ) { m_wellLogFile = wellPath->wellLogFiles()[0]; } - if (m_wellLogFile) + if ( m_wellLogFile ) { std::vector fileLogs = m_wellLogFile->wellLogChannels(); - if (!fileLogs.empty()) + if ( !fileLogs.empty() ) { m_wellLogChannelName = fileLogs[0]->name(); } @@ -83,17 +81,17 @@ void Rim3dWellLogFileCurve::setDefaultFileCurveDataInfo() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogFileCurve::curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const +void Rim3dWellLogFileCurve::curveValuesAndMds( std::vector* values, std::vector* measuredDepthValues ) const { - CAF_ASSERT(values != nullptr); - CAF_ASSERT(measuredDepthValues != nullptr); + CAF_ASSERT( values != nullptr ); + CAF_ASSERT( measuredDepthValues != nullptr ); - if (m_wellLogFile) + if ( m_wellLogFile ) { RigWellLogFile* wellLogFile = m_wellLogFile->wellLogFileData(); - if (wellLogFile) + if ( wellLogFile ) { - *values = wellLogFile->values(m_wellLogChannelName); + *values = wellLogFile->values( m_wellLogChannelName ); *measuredDepthValues = wellLogFile->depthValues(); } } @@ -121,49 +119,48 @@ QString Rim3dWellLogFileCurve::name() const QString Rim3dWellLogFileCurve::createAutoName() const { QStringList name; - QString unit; - bool channelNameAvailable = false; + QString unit; + bool channelNameAvailable = false; RimWellPath* wellPath; - this->firstAncestorOrThisOfType(wellPath); + this->firstAncestorOrThisOfType( wellPath ); - if (wellPath) + if ( wellPath ) { - name.push_back(wellPath->name()); - name.push_back("LAS"); + name.push_back( wellPath->name() ); + name.push_back( "LAS" ); - if (!m_wellLogChannelName().isEmpty()) + if ( !m_wellLogChannelName().isEmpty() ) { - name.push_back(m_wellLogChannelName); + name.push_back( m_wellLogChannelName ); channelNameAvailable = true; } RigWellLogFile* wellLogFile = m_wellLogFile ? m_wellLogFile->wellLogFileData() : nullptr; - if (wellLogFile) + if ( wellLogFile ) { - if (channelNameAvailable) + if ( channelNameAvailable ) { - /* RimWellLogPlot* wellLogPlot; - firstAncestorOrThisOfType(wellLogPlot); - CVF_ASSERT(wellLogPlot); - QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit()); + /* RimWellLogPlot* wellLogPlot; + firstAncestorOrThisOfType(wellLogPlot); + CVF_ASSERT(wellLogPlot); + QString unitName = wellLogFile->wellLogChannelUnitString(m_wellLogChannelName, wellLogPlot->depthUnit()); - if (!unitName.isEmpty()) - { - name.back() += QString(" [%1]").arg(unitName); - } */ + if (!unitName.isEmpty()) + { + name.back() += QString(" [%1]").arg(unitName); + } */ } 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"; @@ -180,59 +177,59 @@ caf::PdmFieldHandle* Rim3dWellLogFileCurve::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogFileCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue) +void Rim3dWellLogFileCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - if (changedField == &m_wellLogFile || changedField == &m_wellLogChannelName) + if ( changedField == &m_wellLogFile || changedField == &m_wellLogChannelName ) { this->resetMinMaxValuesAndUpdateUI(); } - Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); + Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -QList Rim3dWellLogFileCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, - bool* useOptionsOnly) +QList + Rim3dWellLogFileCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly ) { QList 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 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(); - 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; - 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()); - options.push_back(caf::PdmOptionItemInfo(fileInfo.baseName(), wellLogFile)); + QFileInfo fileInfo( wellLogFile->fileName() ); + options.push_back( caf::PdmOptionItemInfo( fileInfo.baseName(), wellLogFile ) ); } } } @@ -243,16 +240,16 @@ QList 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"); - curveDataGroup->add(&m_wellLogFile); - curveDataGroup->add(&m_wellLogChannelName); + caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" ); + curveDataGroup->add( &m_wellLogFile ); + curveDataGroup->add( &m_wellLogChannelName ); - Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); + Rim3dWellLogCurve::configurationUiOrdering( uiOrdering ); - caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); - m_nameConfig->uiOrdering(uiConfigName, *nameGroup); + caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" ); + m_nameConfig->uiOrdering( uiConfigName, *nameGroup ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } diff --git a/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp b/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp index 795b010993..42fd129c08 100644 --- a/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp +++ b/ApplicationCode/ProjectDataModel/Rim3dWellLogRftCurve.cpp @@ -24,37 +24,37 @@ #include "RigWellLogCurveData.h" -#include "RimWellLogRftCurveNameConfig.h" #include "RimEclipseResultCase.h" #include "RimTools.h" -#include "RimWellPath.h" #include "RimWellLogCurve.h" +#include "RimWellLogRftCurveNameConfig.h" +#include "RimWellPath.h" //================================================================================================== /// /// //================================================================================================== -CAF_PDM_SOURCE_INIT(Rim3dWellLogRftCurve, "Rim3dWellLogRftCurve"); +CAF_PDM_SOURCE_INIT( 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_timeStep, "timeStep", "", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_eclipseResultCase, "eclipseResultCase", "", "", "", "" ); + 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.xmlCapability()->disableIO(); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); m_nameConfig = new RimWellLogRftCurveNameConfig(); } @@ -67,19 +67,19 @@ Rim3dWellLogRftCurve::~Rim3dWellLogRftCurve() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector* values, std::vector* measuredDepthValues) const +void Rim3dWellLogRftCurve::curveValuesAndMds( std::vector* values, std::vector* 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(); - //These values are for a simulation well - *values = curveData->xValues(); + // These values are for a simulation well + *values = curveData->xValues(); *measuredDepthValues = curveData->measuredDepths(); } @@ -88,7 +88,7 @@ void Rim3dWellLogRftCurve::curveValuesAndMds(std::vector* values, std::v //-------------------------------------------------------------------------------------------------- QString Rim3dWellLogRftCurve::resultPropertyString() const { - return caf::AppEnum::uiText(m_wellLogChannelName()); + return caf::AppEnum::uiText( m_wellLogChannelName() ); } //-------------------------------------------------------------------------------------------------- @@ -106,28 +106,29 @@ QString Rim3dWellLogRftCurve::createAutoName() const { 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::text(RifEclipseRftAddress::NONE)) + if ( m_wellLogChannelName().text() != + caf::AppEnum::text( RifEclipseRftAddress::NONE ) ) { RifEclipseRftAddress::RftWellLogChannelType channelNameEnum = m_wellLogChannelName(); - name.push_back(caf::AppEnum::uiText(channelNameEnum)); + name.push_back( caf::AppEnum::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,96 +142,104 @@ caf::PdmFieldHandle* Rim3dWellLogRftCurve::userDescriptionField() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogRftCurve::fieldChangedByUi(const caf::PdmFieldHandle* changedField, - const QVariant& oldValue, - const QVariant& newValue) +void Rim3dWellLogRftCurve::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - if (changedField == &m_wellLogChannelName || changedField == &m_timeStep) + if ( changedField == &m_wellLogChannelName || changedField == &m_timeStep ) { this->resetMinMaxValuesAndUpdateUI(); } - Rim3dWellLogCurve::fieldChangedByUi(changedField, oldValue, newValue); + Rim3dWellLogCurve::fieldChangedByUi( changedField, oldValue, newValue ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QList Rim3dWellLogRftCurve::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) +QList Rim3dWellLogRftCurve::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { QList 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(); - 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::uiText(channelName), channelName)); + options.push_back( + caf::PdmOptionItemInfo( caf::AppEnum::uiText( + channelName ), + channelName ) ); } } - if (options.empty()) + if ( options.empty() ) { - options.push_back(caf::PdmOptionItemInfo(caf::AppEnum::uiText(RifEclipseRftAddress::NONE), RifEclipseRftAddress::NONE)); + options.push_back( + caf::PdmOptionItemInfo( caf::AppEnum::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(); - if (reader) + if ( reader ) { - QString dateFormat = "dd MMM yyyy"; - std::set timeStamps = reader->availableTimeSteps(wellName(), m_wellLogChannelName()); - for (const QDateTime& dt : timeStamps) + QString dateFormat = "dd MMM yyyy"; + std::set timeStamps = reader->availableTimeSteps( wellName(), m_wellLogChannelName() ); + 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; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void Rim3dWellLogRftCurve::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void Rim3dWellLogRftCurve::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup("Curve Data"); - curveDataGroup->add(&m_eclipseResultCase); - curveDataGroup->add(&m_wellLogChannelName); - curveDataGroup->add(&m_timeStep); + caf::PdmUiGroup* curveDataGroup = uiOrdering.addNewGroup( "Curve Data" ); + curveDataGroup->add( &m_eclipseResultCase ); + curveDataGroup->add( &m_wellLogChannelName ); + curveDataGroup->add( &m_timeStep ); - Rim3dWellLogCurve::configurationUiOrdering(uiOrdering); + Rim3dWellLogCurve::configurationUiOrdering( uiOrdering ); - caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup("Curve Name"); - m_nameConfig->uiOrdering(uiConfigName, *nameGroup); + caf::PdmUiGroup* nameGroup = uiOrdering.addNewGroup( "Curve Name" ); + m_nameConfig->uiOrdering( uiConfigName, *nameGroup ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString Rim3dWellLogRftCurve::wellName() const { RimWellPath* wellPath = nullptr; - firstAncestorOrThisOfType(wellPath); + firstAncestorOrThisOfType( wellPath ); return wellPath->name(); } diff --git a/ApplicationCode/ProjectDataModel/RimNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimNameConfig.cpp index 6fe4d63a76..f4d6217a49 100644 --- a/ApplicationCode/ProjectDataModel/RimNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimNameConfig.cpp @@ -1,7 +1,7 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2018- Equinor ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or @@ -11,45 +11,43 @@ // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// -#include "RimProject.h" #include "RimNameConfig.h" #include "Rim3dWellLogCurve.h" +#include "RimProject.h" //================================================================================================== -/// -/// +/// +/// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimNameConfig, "RimCurveNameConfig"); +CAF_PDM_SOURCE_INIT( RimNameConfig, "RimCurveNameConfig" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- 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_InitFieldNoDefault(&m_customName, "CustomCurveName", "Custom Name Part", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_autoName, "AutoCurveName", "Full Name", "", "", ""); - m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable(false); - m_autoName.registerGetMethod(this, &RimNameConfig::autoName); + 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_autoName, "AutoCurveName", "Full Name", "", "", "" ); + m_isUsingAutoName_OBSOLETE.xmlCapability()->setIOWritable( false ); + m_autoName.registerGetMethod( this, &RimNameConfig::autoName ); m_autoName.xmlCapability()->disableIO(); - m_autoName.uiCapability()->setUiReadOnly(true); + m_autoName.uiCapability()->setUiReadOnly( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RimNameConfig::~RimNameConfig() -{ -} +RimNameConfig::~RimNameConfig() {} //-------------------------------------------------------------------------------------------------- /// @@ -60,7 +58,7 @@ QString RimNameConfig::customName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- caf::PdmFieldHandle* RimNameConfig::nameField() { @@ -68,58 +66,60 @@ caf::PdmFieldHandle* RimNameConfig::nameField() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimNameConfig::name() const { - return m_autoName(); + return m_autoName(); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -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_autoName); + uiOrdering.add( &m_customName ); + 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(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimNameConfig::autoName() const { RimNameConfigHolderInterface* plotHolder; - this->firstAncestorOrThisOfTypeAsserted(plotHolder); + this->firstAncestorOrThisOfTypeAsserted( plotHolder ); return plotHolder->createAutoName(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimNameConfig::setCustomName(const QString& name) +void RimNameConfig::setCustomName( const QString& name ) { m_customName = name; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimNameConfig::updateAllSettings() { @@ -127,12 +127,12 @@ void RimNameConfig::updateAllSettings() m_customName.uiCapability()->updateConnectedEditors(); RimNameConfigHolderInterface* holder; - this->firstAncestorOrThisOfTypeAsserted(holder); + this->firstAncestorOrThisOfTypeAsserted( holder ); holder->updateHolder(); - caf::PdmObject* pdmObject = dynamic_cast(holder); - if (pdmObject) + caf::PdmObject* pdmObject = dynamic_cast( holder ); + if ( pdmObject ) { - pdmObject->updateConnectedEditors(); + pdmObject->updateConnectedEditors(); } } @@ -142,8 +142,8 @@ void RimNameConfig::updateAllSettings() void RimNameConfig::initAfterRead() { // Now we just switch them all individually. - if (!m_isUsingAutoName_OBSOLETE()) + if ( !m_isUsingAutoName_OBSOLETE() ) { - enableAllAutoNameTags(false); + enableAllAutoNameTags( false ); } } diff --git a/ApplicationCode/ProjectDataModel/RimNameConfig.h b/ApplicationCode/ProjectDataModel/RimNameConfig.h index c4e8a62dc1..c413174427 100644 --- a/ApplicationCode/ProjectDataModel/RimNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimNameConfig.h @@ -30,7 +30,11 @@ class RimNameConfigHolderInterface { public: virtual QString createAutoName() const = 0; - void updateHolder() { performAutoNameUpdate(); } + void updateHolder() + { + performAutoNameUpdate(); + } + protected: virtual void performAutoNameUpdate() {} }; @@ -47,26 +51,25 @@ public: RimNameConfig(); ~RimNameConfig() override; - QString customName() const; - void setCustomName(const QString& name); - virtual void enableAllAutoNameTags(bool enable) {} + QString customName() const; + void setCustomName( const QString& name ); + virtual void enableAllAutoNameTags( bool enable ) {} - caf::PdmFieldHandle* nameField(); - QString name() const; - void uiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering); + caf::PdmFieldHandle* nameField(); + QString name() const; + void uiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ); protected: - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - QString autoName() const; - virtual void updateAllSettings(); - void initAfterRead() override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + QString autoName() const; + virtual void updateAllSettings(); + void initAfterRead() override; protected: caf::PdmField m_isUsingAutoName_OBSOLETE; caf::PdmField m_customName; caf::PdmProxyValueField m_autoName; - }; - - diff --git a/ApplicationCode/ProjectDataModel/RimViewNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimViewNameConfig.cpp index 99cebb3b47..25df2185c6 100644 --- a/ApplicationCode/ProjectDataModel/RimViewNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimViewNameConfig.cpp @@ -23,24 +23,24 @@ /// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimViewNameConfig, "RimViewNameConfig"); +CAF_PDM_SOURCE_INIT( RimViewNameConfig, "RimViewNameConfig" ); //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- RimViewNameConfig::RimViewNameConfig() : RimNameConfig() - , m_hideCaseNameField(false) - , m_hideAggregationTypeField(false) - , m_hidePropertyField(false) - , m_hideSampleSpacingField(false) + , m_hideCaseNameField( false ) + , m_hideAggregationTypeField( false ) + , m_hidePropertyField( 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_addAggregationType, "AddAggregationType", true, "Add Aggregation 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_addCaseName, "AddCaseName", false, "Add Case Name", "", "", "" ); + CAF_PDM_InitField( &m_addAggregationType, "AddAggregationType", true, "Add Aggregation Type", "", "", "" ); + CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" ); + CAF_PDM_InitField( &m_addSampleSpacing, "AddSampleSpacing", false, "Add Sample Spacing", "", "", "" ); m_customName = ""; } @@ -48,7 +48,7 @@ RimViewNameConfig::RimViewNameConfig() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewNameConfig::setAddCaseName(bool add) +void RimViewNameConfig::setAddCaseName( bool 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; } @@ -80,7 +80,7 @@ bool RimViewNameConfig::addAggregationType() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewNameConfig::setAddProperty(bool add) +void RimViewNameConfig::setAddProperty( bool 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; } @@ -112,7 +112,7 @@ bool RimViewNameConfig::addSampleSpacing() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewNameConfig::enableAllAutoNameTags(bool enable) +void RimViewNameConfig::enableAllAutoNameTags( bool enable ) { m_addCaseName = 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; } @@ -131,7 +131,7 @@ void RimViewNameConfig::hideCaseNameField(bool hide) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewNameConfig::hideAggregationTypeField(bool hide) +void RimViewNameConfig::hideAggregationTypeField( bool 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; } @@ -147,7 +147,7 @@ void RimViewNameConfig::hidePropertyField(bool hide) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimViewNameConfig::hideSampleSpacingField(bool hide) +void RimViewNameConfig::hideSampleSpacingField( bool 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); - if (!m_hideCaseNameField) uiOrdering.add(&m_addCaseName); - if (!m_hideAggregationTypeField) uiOrdering.add(&m_addAggregationType); - if (!m_hidePropertyField) uiOrdering.add(&m_addProperty); - if (!m_hideSampleSpacingField) uiOrdering.add(&m_addSampleSpacing); + RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering ); + if ( !m_hideCaseNameField ) uiOrdering.add( &m_addCaseName ); + if ( !m_hideAggregationTypeField ) uiOrdering.add( &m_addAggregationType ); + if ( !m_hidePropertyField ) uiOrdering.add( &m_addProperty ); + if ( !m_hideSampleSpacingField ) uiOrdering.add( &m_addSampleSpacing ); } diff --git a/ApplicationCode/ProjectDataModel/RimViewNameConfig.h b/ApplicationCode/ProjectDataModel/RimViewNameConfig.h index 4d5d6d4b14..0e6ae66607 100644 --- a/ApplicationCode/ProjectDataModel/RimViewNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimViewNameConfig.h @@ -31,35 +31,33 @@ class RimViewNameConfig : public RimNameConfig public: explicit RimViewNameConfig(); - void setAddCaseName(bool add); - bool addCaseName() const; - void setAddAggregationType(bool add); - bool addAggregationType() const; - void setAddProperty(bool add); - bool addProperty() const; - void setAddSampleSpacing(bool add); - bool addSampleSpacing() const; + void setAddCaseName( bool add ); + bool addCaseName() const; + void setAddAggregationType( bool add ); + bool addAggregationType() const; + void setAddProperty( bool add ); + bool addProperty() const; + void setAddSampleSpacing( bool add ); + bool addSampleSpacing() const; - void enableAllAutoNameTags(bool enable) override; + void enableAllAutoNameTags( bool enable ) override; - void hideCaseNameField(bool hide); - void hideAggregationTypeField(bool hide); - void hidePropertyField(bool hide); - void hideSampleSpacingField(bool hide); + void hideCaseNameField( bool hide ); + void hideAggregationTypeField( bool hide ); + void hidePropertyField( bool hide ); + void hideSampleSpacingField( bool hide ); protected: - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: - caf::PdmField m_addCaseName; - caf::PdmField m_addAggregationType; - caf::PdmField m_addProperty; - caf::PdmField m_addSampleSpacing; + caf::PdmField m_addCaseName; + caf::PdmField m_addAggregationType; + caf::PdmField m_addProperty; + caf::PdmField m_addSampleSpacing; - bool m_hideCaseNameField; - bool m_hideAggregationTypeField; - bool m_hidePropertyField; - bool m_hideSampleSpacingField; + bool m_hideCaseNameField; + bool m_hideAggregationTypeField; + bool m_hidePropertyField; + bool m_hideSampleSpacingField; }; - - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.cpp index aa555fe29f..d1737dedf6 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.cpp @@ -19,31 +19,31 @@ #include "RimWellLogExtractionCurveNameConfig.h" //================================================================================================== -/// -/// +/// +/// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig"); +CAF_PDM_SOURCE_INIT( RimWellLogExtractionCurveNameConfig, "RimWellLogExtractionCurveNameConfig" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogExtractionCurveNameConfig::RimWellLogExtractionCurveNameConfig() : 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_addProperty, "AddProperty", true, "Add Property Type", "", "", ""); - CAF_PDM_InitField(&m_addWellName, "AddWellName", true, "Add Well Name", "", "", ""); - CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", ""); - CAF_PDM_InitField(&m_addDate, "AddDate", true, "Add Date", "", "", ""); + CAF_PDM_InitField( &m_addCaseName, "AddCaseName", true, "Add Case Name", "", "", "" ); + CAF_PDM_InitField( &m_addProperty, "AddProperty", true, "Add Property Type", "", "", "" ); + CAF_PDM_InitField( &m_addWellName, "AddWellName", true, "Add Well Name", "", "", "" ); + CAF_PDM_InitField( &m_addTimestep, "AddTimeStep", true, "Add Time Step", "", "", "" ); + CAF_PDM_InitField( &m_addDate, "AddDate", true, "Add Date", "", "", "" ); m_customName = "Log Extraction"; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogExtractionCurveNameConfig::addCaseName() const { @@ -51,7 +51,7 @@ bool RimWellLogExtractionCurveNameConfig::addCaseName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogExtractionCurveNameConfig::addProperty() const { @@ -59,7 +59,7 @@ bool RimWellLogExtractionCurveNameConfig::addProperty() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogExtractionCurveNameConfig::addWellName() const { @@ -67,7 +67,7 @@ bool RimWellLogExtractionCurveNameConfig::addWellName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogExtractionCurveNameConfig::addTimeStep() const { @@ -75,7 +75,7 @@ bool RimWellLogExtractionCurveNameConfig::addTimeStep() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogExtractionCurveNameConfig::addDate() const { @@ -85,7 +85,7 @@ bool RimWellLogExtractionCurveNameConfig::addDate() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags(bool enable) +void RimWellLogExtractionCurveNameConfig::enableAllAutoNameTags( bool enable ) { m_addCaseName = 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); - uiOrdering.add(&m_addCaseName); - uiOrdering.add(&m_addProperty); - uiOrdering.add(&m_addWellName); - uiOrdering.add(&m_addTimestep); - uiOrdering.add(&m_addDate); + RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering ); + uiOrdering.add( &m_addCaseName ); + uiOrdering.add( &m_addProperty ); + uiOrdering.add( &m_addWellName ); + uiOrdering.add( &m_addTimestep ); + uiOrdering.add( &m_addDate ); } diff --git a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.h b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.h index 0b86ca3b1a..16570b66d7 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogExtractionCurveNameConfig.h @@ -31,23 +31,21 @@ class RimWellLogExtractionCurveNameConfig : public RimNameConfig public: RimWellLogExtractionCurveNameConfig(); - bool addCaseName() const; - bool addProperty() const; - bool addWellName() const; - bool addTimeStep() const; - bool addDate() const; + bool addCaseName() const; + bool addProperty() const; + bool addWellName() const; + bool addTimeStep() const; + bool addDate() const; - void enableAllAutoNameTags(bool enable) override; + void enableAllAutoNameTags( bool enable ) override; protected: - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: - caf::PdmField m_addCaseName; - caf::PdmField m_addProperty; - caf::PdmField m_addWellName; - caf::PdmField m_addTimestep; - caf::PdmField m_addDate; + caf::PdmField m_addCaseName; + caf::PdmField m_addProperty; + caf::PdmField m_addWellName; + caf::PdmField m_addTimestep; + caf::PdmField m_addDate; }; - - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.cpp index 23fe5484df..3b3a6e2272 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.cpp @@ -19,19 +19,18 @@ #include "RimWellLogFileCurveNameConfig.h" //================================================================================================== -/// -/// +/// +/// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig"); +CAF_PDM_SOURCE_INIT( RimWellLogFileCurveNameConfig, "RimWellLogFileCurveNameConfig" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogFileCurveNameConfig::RimWellLogFileCurveNameConfig() : RimNameConfig() { - CAF_PDM_InitObject("Well Log File Curve Name Generator", "", "", ""); + CAF_PDM_InitObject( "Well Log File Curve Name Generator", "", "", "" ); m_customName = "Las Curve"; } - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.h b/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.h index d3352c9912..e8e96e944c 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogFileCurveNameConfig.h @@ -31,4 +31,3 @@ class RimWellLogFileCurveNameConfig : public RimNameConfig public: RimWellLogFileCurveNameConfig(); }; - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp index 1c8c129113..62a8726cbd 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.cpp @@ -2,17 +2,17 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -24,8 +24,8 @@ #include "RigWellLogCurveData.h" #include "RigWellPath.h" -#include "RimGeoMechCase.h" #include "RimEclipseCase.h" +#include "RimGeoMechCase.h" #include "RimWellLogCurve.h" #include "RimWellLogCurveCommonDataSource.h" #include "RimWellLogTrack.h" @@ -44,72 +44,76 @@ #define RI_LOGPLOT_MINDEPTH_DEFAULT 0.0 #define RI_LOGPLOT_MAXDEPTH_DEFAULT 1000.0 -namespace caf { +namespace caf +{ +template <> +void caf::AppEnum::setUp() +{ + addItem( RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth" ); + addItem( RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)" ); + addItem( RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length" ); + addItem( RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number" ); + setDefault( RimWellLogPlot::MEASURED_DEPTH ); +} - template<> - void caf::AppEnum< RimWellLogPlot::DepthTypeEnum >::setUp() - { - addItem(RimWellLogPlot::MEASURED_DEPTH, "MEASURED_DEPTH", "Measured Depth"); - addItem(RimWellLogPlot::TRUE_VERTICAL_DEPTH, "TRUE_VERTICAL_DEPTH", "True Vertical Depth (MSL)"); - addItem(RimWellLogPlot::PSEUDO_LENGTH, "PSEUDO_LENGTH", "Pseudo Length"); - addItem(RimWellLogPlot::CONNECTION_NUMBER, "CONNECTION_NUMBER", "Connection Number"); - setDefault(RimWellLogPlot::MEASURED_DEPTH); - } - - template<> - void RimWellLogPlot::AxisGridEnum::setUp() - { - addItem(RimWellLogPlot::AXIS_GRID_NONE, "GRID_X_NONE", "No Grid Lines"); - addItem(RimWellLogPlot::AXIS_GRID_MAJOR, "GRID_X_MAJOR", "Major Only"); - addItem(RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR, "GRID_X_MAJOR_AND_MINOR", "Major and Minor"); - setDefault(RimWellLogPlot::AXIS_GRID_MAJOR); - } +template <> +void RimWellLogPlot::AxisGridEnum::setUp() +{ + addItem( RimWellLogPlot::AXIS_GRID_NONE, "GRID_X_NONE", "No Grid Lines" ); + addItem( RimWellLogPlot::AXIS_GRID_MAJOR, "GRID_X_MAJOR", "Major Only" ); + addItem( RimWellLogPlot::AXIS_GRID_MAJOR_AND_MINOR, "GRID_X_MAJOR_AND_MINOR", "Major and Minor" ); + setDefault( RimWellLogPlot::AXIS_GRID_MAJOR ); +} } // End namespace caf - -CAF_PDM_SOURCE_INIT(RimWellLogPlot, "WellLogPlot"); +CAF_PDM_SOURCE_INIT( RimWellLogPlot, "WellLogPlot" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogPlot::RimWellLogPlot() { - CAF_PDM_InitObject("Well Log Plot", ":/WellLogPlot16x16.png", "", ""); + CAF_PDM_InitObject( "Well Log Plot", ":/WellLogPlot16x16.png", "", "" ); m_viewer = nullptr; - CAF_PDM_InitField(&m_userName_OBSOLETE, "PlotDescription", QString(""), "Name", "", "", ""); - m_userName_OBSOLETE.xmlCapability()->setIOWritable(false); + CAF_PDM_InitField( &m_userName_OBSOLETE, "PlotDescription", QString( "" ), "Name", "", "", "" ); + m_userName_OBSOLETE.xmlCapability()->setIOWritable( false ); - CAF_PDM_InitFieldNoDefault(&m_commonDataSource, "CommonDataSource", "Data Source", "", "Change the Data Source of All Curves in the Plot", ""); - m_commonDataSource.uiCapability()->setUiTreeHidden(true); - m_commonDataSource.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_commonDataSource, + "CommonDataSource", + "Data Source", + "", + "Change the Data Source of All Curves in the Plot", + "" ); + m_commonDataSource.uiCapability()->setUiTreeHidden( true ); + m_commonDataSource.uiCapability()->setUiTreeChildrenHidden( true ); m_commonDataSource.xmlCapability()->disableIO(); m_commonDataSource = new RimWellLogCurveCommonDataSource; - caf::AppEnum< RimWellLogPlot::DepthTypeEnum > depthType = MEASURED_DEPTH; - CAF_PDM_InitField(&m_depthType, "DepthType", depthType, "Type", "", "", ""); + caf::AppEnum depthType = MEASURED_DEPTH; + CAF_PDM_InitField( &m_depthType, "DepthType", depthType, "Type", "", "", "" ); - caf::AppEnum< RiaDefines::DepthUnitType > depthUnit = RiaDefines::UNIT_METER; - CAF_PDM_InitField(&m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", ""); + caf::AppEnum depthUnit = RiaDefines::UNIT_METER; + CAF_PDM_InitField( &m_depthUnit, "DepthUnit", depthUnit, "Unit", "", "", "" ); - CAF_PDM_InitField(&m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", ""); - CAF_PDM_InitField(&m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", ""); - CAF_PDM_InitFieldNoDefault(&m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", ""); - CAF_PDM_InitField(&m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", ""); - m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden(true); - CAF_PDM_InitField(&m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", ""); - CAF_PDM_InitField(&m_showTrackLegends, "ShowTrackLegends", true, "Show Legends", "", "", ""); - CAF_PDM_InitField(&m_trackLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", ""); - m_trackLegendsHorizontal.uiCapability()->setUiEditorTypeName(caf::PdmUiComboBoxEditor::uiEditorTypeName()); + CAF_PDM_InitField( &m_minVisibleDepth, "MinimumDepth", 0.0, "Min", "", "", "" ); + CAF_PDM_InitField( &m_maxVisibleDepth, "MaximumDepth", 1000.0, "Max", "", "", "" ); + CAF_PDM_InitFieldNoDefault( &m_depthAxisGridVisibility, "ShowDepthGridLines", "Show Grid Lines", "", "", "" ); + CAF_PDM_InitField( &m_isAutoScaleDepthEnabled, "AutoScaleDepthEnabled", true, "Auto Scale", "", "", "" ); + m_isAutoScaleDepthEnabled.uiCapability()->setUiHidden( true ); + CAF_PDM_InitField( &m_showTitleInPlot, "ShowTitleInPlot", false, "Show Title", "", "", "" ); + CAF_PDM_InitField( &m_showTrackLegends, "ShowTrackLegends", true, "Show Legends", "", "", "" ); + CAF_PDM_InitField( &m_trackLegendsHorizontal, "TrackLegendsHorizontal", false, "Legend Orientation", "", "", "" ); + m_trackLegendsHorizontal.uiCapability()->setUiEditorTypeName( caf::PdmUiComboBoxEditor::uiEditorTypeName() ); - CAF_PDM_InitFieldNoDefault(&m_tracks, "Tracks", "", "", "", ""); - m_tracks.uiCapability()->setUiHidden(true); + CAF_PDM_InitFieldNoDefault( &m_tracks, "Tracks", "", "", "", "" ); + m_tracks.uiCapability()->setUiHidden( true ); - CAF_PDM_InitFieldNoDefault(&m_nameConfig, "NameConfig", "", "", "", ""); - m_nameConfig.uiCapability()->setUiTreeHidden(true); - m_nameConfig.uiCapability()->setUiTreeChildrenHidden(true); + CAF_PDM_InitFieldNoDefault( &m_nameConfig, "NameConfig", "", "", "", "" ); + m_nameConfig.uiCapability()->setUiTreeHidden( true ); + m_nameConfig.uiCapability()->setUiTreeChildrenHidden( true ); m_nameConfig = new RimWellLogPlotNameConfig(); m_minAvailableDepth = HUGE_VAL; @@ -119,35 +123,35 @@ RimWellLogPlot::RimWellLogPlot() //-------------------------------------------------------------------------------------------------- /// Move-assignment operator. Argument has to be passed with std::move() //-------------------------------------------------------------------------------------------------- -RimWellLogPlot& RimWellLogPlot::operator=(RimWellLogPlot&& rhs) +RimWellLogPlot& RimWellLogPlot::operator=( RimWellLogPlot&& rhs ) { // Don't copy the obsoleted m_userName_OBSOLETE // It had its own implementation in the RFT/PLT/WAP plots auto dataSource = rhs.m_commonDataSource(); - rhs.m_commonDataSource.removeChildObject(dataSource); - m_commonDataSource = dataSource; + rhs.m_commonDataSource.removeChildObject( dataSource ); + m_commonDataSource = dataSource; - m_depthType = rhs.m_depthType(); - m_depthUnit = rhs.m_depthUnit(); - m_minVisibleDepth = rhs.m_minVisibleDepth(); - m_maxVisibleDepth = rhs.m_maxVisibleDepth(); + m_depthType = rhs.m_depthType(); + m_depthUnit = rhs.m_depthUnit(); + m_minVisibleDepth = rhs.m_minVisibleDepth(); + m_maxVisibleDepth = rhs.m_maxVisibleDepth(); m_depthAxisGridVisibility = rhs.m_depthAxisGridVisibility(); m_isAutoScaleDepthEnabled = rhs.m_isAutoScaleDepthEnabled(); - m_showTitleInPlot = rhs.m_showTitleInPlot(); - m_showTrackLegends = rhs.m_showTrackLegends(); - m_trackLegendsHorizontal = rhs.m_trackLegendsHorizontal(); - + m_showTitleInPlot = rhs.m_showTitleInPlot(); + m_showTrackLegends = rhs.m_showTrackLegends(); + m_trackLegendsHorizontal = rhs.m_trackLegendsHorizontal(); + // Move all tracks std::vector tracks = rhs.m_tracks.childObjects(); rhs.m_tracks.clear(); - for (RimWellLogTrack* track : tracks) + for ( RimWellLogTrack* track : tracks ) { - m_tracks.push_back(track); + m_tracks.push_back( track ); } auto nameConfig = rhs.m_nameConfig(); - rhs.m_nameConfig.removeChildObject(nameConfig); + rhs.m_nameConfig.removeChildObject( nameConfig ); m_nameConfig = nameConfig; m_minAvailableDepth = rhs.m_minAvailableDepth; @@ -156,12 +160,12 @@ RimWellLogPlot& RimWellLogPlot::operator=(RimWellLogPlot&& rhs) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogPlot::~RimWellLogPlot() { removeMdiWindowFromMdiArea(); - + m_tracks.deleteAllChildObjects(); deleteViewWidget(); @@ -174,11 +178,11 @@ RimWellLogPlot::~RimWellLogPlot() //-------------------------------------------------------------------------------------------------- QWidget* RimWellLogPlot::createPlotWidget() { - return createViewWidget(nullptr); + return createViewWidget( nullptr ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QWidget* RimWellLogPlot::viewWidget() { @@ -186,37 +190,37 @@ QWidget* RimWellLogPlot::viewWidget() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) +void RimWellLogPlot::fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) { - RimViewWindow::fieldChangedByUi(changedField, oldValue, newValue); + RimViewWindow::fieldChangedByUi( changedField, oldValue, newValue ); - if (changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth) + if ( changedField == &m_minVisibleDepth || changedField == &m_maxVisibleDepth ) { applyDepthZoomFromVisibleDepth(); m_isAutoScaleDepthEnabled = false; } - else if (changedField == &m_showTitleInPlot || - changedField == &m_showTrackLegends || - changedField == &m_trackLegendsHorizontal || - changedField == &m_depthAxisGridVisibility) + else if ( changedField == &m_showTitleInPlot || changedField == &m_showTrackLegends || + changedField == &m_trackLegendsHorizontal || changedField == &m_depthAxisGridVisibility ) { updateTracks(); - if (m_viewer) m_viewer->updateChildrenLayout(); + if ( m_viewer ) m_viewer->updateChildrenLayout(); } - else if (changedField == &m_isAutoScaleDepthEnabled) + else if ( changedField == &m_isAutoScaleDepthEnabled ) { updateDepthZoom(); } - else if ( changedField == &m_depthType ) + else if ( changedField == &m_depthType ) { onDepthTypeChanged(); updateTracks(); updateDepthZoom(); } - else if ( changedField == &m_depthUnit) + else if ( changedField == &m_depthUnit ) { updateTracks(); updateDepthZoom(); @@ -226,104 +230,105 @@ void RimWellLogPlot::fieldChangedByUi(const caf::PdmFieldHandle* changedField, c } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QList RimWellLogPlot::calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) +QList RimWellLogPlot::calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) { - QList options; + QList options; - if (fieldNeedingOptions == &m_depthType ) + if ( fieldNeedingOptions == &m_depthType ) { - using DepthAppEnum = caf::AppEnum< DepthTypeEnum >; - for (size_t i = 0; i < DepthAppEnum::size(); ++i) + using DepthAppEnum = caf::AppEnum; + for ( size_t i = 0; i < DepthAppEnum::size(); ++i ) { - DepthTypeEnum enumVal = DepthAppEnum::fromIndex(i); + DepthTypeEnum enumVal = DepthAppEnum::fromIndex( i ); - if (availableDepthTypes().count(enumVal)) + if ( availableDepthTypes().count( enumVal ) ) { - options.push_back(caf::PdmOptionItemInfo(DepthAppEnum::uiText(enumVal), enumVal)); + options.push_back( caf::PdmOptionItemInfo( DepthAppEnum::uiText( enumVal ), enumVal ) ); } - } - } - else if ( fieldNeedingOptions == &m_depthUnit) - { - using UnitAppEnum = caf::AppEnum< RiaDefines::DepthUnitType >; - for (auto depthUnit : availableDepthUnits()) - { - options.push_back(caf::PdmOptionItemInfo(UnitAppEnum::uiText(depthUnit), depthUnit)); } } - else if (fieldNeedingOptions == &m_trackLegendsHorizontal) + else if ( fieldNeedingOptions == &m_depthUnit ) { - options.push_back(caf::PdmOptionItemInfo("Vertical", QVariant::fromValue(false))); - options.push_back(caf::PdmOptionItemInfo("Horizontal", QVariant::fromValue(true))); + using UnitAppEnum = caf::AppEnum; + for ( auto depthUnit : availableDepthUnits() ) + { + options.push_back( caf::PdmOptionItemInfo( UnitAppEnum::uiText( depthUnit ), depthUnit ) ); + } + } + else if ( fieldNeedingOptions == &m_trackLegendsHorizontal ) + { + options.push_back( caf::PdmOptionItemInfo( "Vertical", QVariant::fromValue( false ) ) ); + options.push_back( caf::PdmOptionItemInfo( "Horizontal", QVariant::fromValue( true ) ) ); } - (*useOptionsOnly) = true; + ( *useOptionsOnly ) = true; return options; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QImage RimWellLogPlot::snapshotWindowContent() { QImage image; - if (m_viewer) + if ( m_viewer ) { - QPixmap pix = QPixmap::grabWidget(m_viewer); - image = pix.toImage(); + QPixmap pix = QPixmap::grabWidget( m_viewer ); + image = pix.toImage(); } return image; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::addTrack(RimWellLogTrack* track) +void RimWellLogPlot::addTrack( RimWellLogTrack* track ) { - m_tracks.push_back(track); - if (m_viewer) + m_tracks.push_back( track ); + if ( m_viewer ) { track->recreateViewer(); - m_viewer->addTrackPlot(track->viewer()); + m_viewer->addTrackPlot( track->viewer() ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::insertTrack(RimWellLogTrack* track, size_t index) +void RimWellLogPlot::insertTrack( RimWellLogTrack* track, size_t index ) { - m_tracks.insert(index, track); + m_tracks.insert( index, track ); - if (m_viewer) + if ( m_viewer ) { track->recreateViewer(); - m_viewer->insertTrackPlot(track->viewer(), index); + m_viewer->insertTrackPlot( track->viewer(), index ); } updateTrackNames(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::removeTrack(RimWellLogTrack* track) +void RimWellLogPlot::removeTrack( RimWellLogTrack* track ) { - if (track) + if ( track ) { - if (m_viewer) m_viewer->removeTrackPlot(track->viewer()); - m_tracks.removeChildObject(track); + if ( m_viewer ) m_viewer->removeTrackPlot( track->viewer() ); + m_tracks.removeChildObject( track ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RimWellLogTrack* RimWellLogPlot::trackByIndex(size_t index) const +RimWellLogTrack* RimWellLogPlot::trackByIndex( size_t index ) const { return m_tracks[index]; } @@ -333,9 +338,9 @@ RimWellLogTrack* RimWellLogPlot::trackByIndex(size_t index) const //-------------------------------------------------------------------------------------------------- size_t RimWellLogPlot::firstVisibleTrackIndex() const { - for (size_t i = 0; i < m_tracks.size(); ++i) + for ( size_t i = 0; i < m_tracks.size(); ++i ) { - if (m_tracks[i]->isVisible()) + if ( m_tracks[i]->isVisible() ) { return i; } @@ -352,31 +357,31 @@ std::vector RimWellLogPlot::tracks() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter) +void RimWellLogPlot::setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter ) { - double newMinimum = zoomCenter - (zoomCenter - m_minVisibleDepth)*zoomFactor; - double newMaximum = zoomCenter + (m_maxVisibleDepth - zoomCenter)*zoomFactor; + double newMinimum = zoomCenter - ( zoomCenter - m_minVisibleDepth ) * zoomFactor; + double newMaximum = zoomCenter + ( m_maxVisibleDepth - zoomCenter ) * zoomFactor; - setDepthZoomMinMax(newMinimum, newMaximum); - setDepthAutoZoom(false); + setDepthZoomMinMax( newMinimum, newMaximum ); + setDepthAutoZoom( false ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::panDepth(double panFactor) +void RimWellLogPlot::panDepth( double panFactor ) { - double delta = panFactor*(m_maxVisibleDepth - m_minVisibleDepth); - setDepthZoomMinMax(m_minVisibleDepth + delta, m_maxVisibleDepth + delta); - setDepthAutoZoom(false); + double delta = panFactor * ( m_maxVisibleDepth - m_minVisibleDepth ); + setDepthZoomMinMax( m_minVisibleDepth + delta, m_maxVisibleDepth + delta ); + setDepthAutoZoom( false ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDepthZoomMinMax(double minimumDepth, double maximumDepth) +void RimWellLogPlot::setDepthZoomMinMax( double minimumDepth, double maximumDepth ) { m_minVisibleDepth = minimumDepth; m_maxVisibleDepth = maximumDepth; @@ -388,28 +393,28 @@ void RimWellLogPlot::setDepthZoomMinMax(double minimumDepth, double maximumDepth } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::calculateAvailableDepthRange() { double minDepth = HUGE_VAL; double maxDepth = -HUGE_VAL; - for (size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++) + for ( size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++ ) { double minTrackDepth = HUGE_VAL; double maxTrackDepth = -HUGE_VAL; - if (m_tracks[tIdx]->isVisible()) + if ( m_tracks[tIdx]->isVisible() ) { - m_tracks[tIdx]->availableDepthRange(&minTrackDepth, &maxTrackDepth); + m_tracks[tIdx]->availableDepthRange( &minTrackDepth, &maxTrackDepth ); - if (minTrackDepth < minDepth) + if ( minTrackDepth < minDepth ) { minDepth = minTrackDepth; } - if (maxTrackDepth > maxDepth) + if ( maxTrackDepth > maxDepth ) { maxDepth = maxTrackDepth; } @@ -421,11 +426,11 @@ void RimWellLogPlot::calculateAvailableDepthRange() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::availableDepthRange(double* minimumDepth, double* maximumDepth) const +void RimWellLogPlot::availableDepthRange( double* minimumDepth, double* maximumDepth ) const { - if (hasAvailableDepthRange()) + if ( hasAvailableDepthRange() ) { *minimumDepth = m_minAvailableDepth; *maximumDepth = m_maxAvailableDepth; @@ -437,9 +442,8 @@ void RimWellLogPlot::availableDepthRange(double* minimumDepth, double* maximumDe } } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogPlot::hasAvailableDepthRange() const { @@ -447,19 +451,19 @@ bool RimWellLogPlot::hasAvailableDepthRange() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::zoomAll() { - setDepthAutoZoom(true); + setDepthAutoZoom( true ); updateDepthZoom(); - updateTracks(true); + updateTracks( true ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDepthAutoZoom(bool on) +void RimWellLogPlot::setDepthAutoZoom( bool on ) { m_isAutoScaleDepthEnabled = on; m_isAutoScaleDepthEnabled.uiCapability()->updateConnectedEditors(); @@ -468,127 +472,129 @@ void RimWellLogPlot::setDepthAutoZoom(bool on) //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::enableAllAutoNameTags(bool enable) +void RimWellLogPlot::enableAllAutoNameTags( bool enable ) { - m_nameConfig->enableAllAutoNameTags(enable); + m_nameConfig->enableAllAutoNameTags( enable ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimWellLogPlot::asciiDataForPlotExport() const { QString out = description() + "\n"; - for (RimWellLogTrack* track : m_tracks) + for ( RimWellLogTrack* track : m_tracks ) { - if (!track->isVisible()) continue; + if ( !track->isVisible() ) continue; out += "\n" + track->description() + "\n"; - std::vector curves = track->curvesVector(); + std::vector curves = track->curvesVector(); - std::vector curveNames; - std::vector curveDepths; - std::vector > curvesPlotXValues; + std::vector curveNames; + std::vector curveDepths; + std::vector> curvesPlotXValues; - - for (RimWellLogCurve* curve : curves) + for ( RimWellLogCurve* curve : curves ) { - if (!curve->isCurveVisible()) continue; + if ( !curve->isCurveVisible() ) continue; const RigWellLogCurveData* curveData = curve->curveData(); - if (!curveData) continue; - curveNames.push_back(curve->curveName()); + if ( !curveData ) continue; + curveNames.push_back( curve->curveName() ); - if (curveNames.size() == 1) + if ( curveNames.size() == 1 ) { - if (depthType() == TRUE_VERTICAL_DEPTH) + if ( depthType() == TRUE_VERTICAL_DEPTH ) { - curveDepths = curveData->trueDepthPlotValues(depthUnit()); + curveDepths = curveData->trueDepthPlotValues( depthUnit() ); } else { - curveDepths = curveData->measuredDepthPlotValues(depthUnit()); + curveDepths = curveData->measuredDepthPlotValues( depthUnit() ); } } std::vector xPlotValues = curveData->xPlotValues(); - if (curveDepths.size() != xPlotValues.size() || xPlotValues.empty()) + if ( curveDepths.size() != xPlotValues.size() || xPlotValues.empty() ) { curveNames.pop_back(); - if (curveNames.empty()) + if ( curveNames.empty() ) { curveDepths.clear(); } continue; } - curvesPlotXValues.push_back(xPlotValues); + curvesPlotXValues.push_back( xPlotValues ); } - - for (size_t i = 0; i < curveDepths.size(); ++i) + for ( size_t i = 0; i < curveDepths.size(); ++i ) { - if (i == 0) + if ( i == 0 ) { - if (depthType() == CONNECTION_NUMBER) out += "Connection"; - else if (depthType() == MEASURED_DEPTH) out += "MD "; - else if (depthType() == PSEUDO_LENGTH) out += "PL "; - else if (depthType() == TRUE_VERTICAL_DEPTH) out += "TVD "; - for (QString name : curveNames) out += " \t" + name; + if ( depthType() == CONNECTION_NUMBER ) + out += "Connection"; + else if ( depthType() == MEASURED_DEPTH ) + out += "MD "; + else if ( depthType() == PSEUDO_LENGTH ) + out += "PL "; + else if ( depthType() == TRUE_VERTICAL_DEPTH ) + out += "TVD "; + for ( QString name : curveNames ) + out += " \t" + name; out += "\n"; } - else if (curveDepths[i] == curveDepths[i-1]) + else if ( curveDepths[i] == curveDepths[i - 1] ) { continue; } - out += QString::number(curveDepths[i], 'f', 3); - for (std::vector plotVector : curvesPlotXValues) + out += QString::number( curveDepths[i], 'f', 3 ); + for ( std::vector plotVector : curvesPlotXValues ) { - out += " \t" + QString::number(plotVector[i], 'g'); + out += " \t" + QString::number( plotVector[i], 'g' ); } out += "\n"; } - } return out; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::uiOrderingForDepthAxis(caf::PdmUiOrdering& uiOrdering) +void RimWellLogPlot::uiOrderingForDepthAxis( caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup("Depth Axis"); - - if (availableDepthTypes().size() > 1u) + caf::PdmUiGroup* gridGroup = uiOrdering.addNewGroup( "Depth Axis" ); + + if ( availableDepthTypes().size() > 1u ) { - gridGroup->add(&m_depthType); + gridGroup->add( &m_depthType ); } - if (availableDepthUnits().size() > 1u) + if ( availableDepthUnits().size() > 1u ) { - gridGroup->add(&m_depthUnit); + gridGroup->add( &m_depthUnit ); } - gridGroup->add(&m_minVisibleDepth); - gridGroup->add(&m_maxVisibleDepth); - gridGroup->add(&m_depthAxisGridVisibility); + gridGroup->add( &m_minVisibleDepth ); + gridGroup->add( &m_maxVisibleDepth ); + gridGroup->add( &m_depthAxisGridVisibility ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::uiOrderingForPlotSettings(caf::PdmUiOrdering& uiOrdering) +void RimWellLogPlot::uiOrderingForPlotSettings( caf::PdmUiOrdering& uiOrdering ) { - caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup("Title and Legends"); - titleAndLegendsGroup->add(&m_showTrackLegends); - titleAndLegendsGroup->add(&m_trackLegendsHorizontal); - titleAndLegendsGroup->add(&m_showTitleInPlot); - m_nameConfig->uiOrdering("", *titleAndLegendsGroup); + caf::PdmUiGroup* titleAndLegendsGroup = uiOrdering.addNewGroup( "Title and Legends" ); + titleAndLegendsGroup->add( &m_showTrackLegends ); + titleAndLegendsGroup->add( &m_trackLegendsHorizontal ); + titleAndLegendsGroup->add( &m_showTitleInPlot ); + m_nameConfig->uiOrdering( "", *titleAndLegendsGroup ); } //-------------------------------------------------------------------------------------------------- @@ -598,76 +604,75 @@ QString RimWellLogPlot::createAutoName() const { QStringList generatedCurveName; - if (!m_nameConfig->customName().isEmpty()) + if ( !m_nameConfig->customName().isEmpty() ) { - generatedCurveName.push_back(m_nameConfig->customName()); + generatedCurveName.push_back( m_nameConfig->customName() ); } - RimCase* commonCase = m_commonDataSource->caseToApply(); + RimCase* commonCase = m_commonDataSource->caseToApply(); RimWellPath* commonWellPath = m_commonDataSource->wellPathToApply(); QStringList generatedAutoTags; - if (m_nameConfig->addCaseName() && commonCase) + if ( m_nameConfig->addCaseName() && commonCase ) { - generatedAutoTags.push_back(commonCase->caseUserDescription()); + generatedAutoTags.push_back( commonCase->caseUserDescription() ); } - if (m_nameConfig->addWellName()) + if ( m_nameConfig->addWellName() ) { - - if (commonWellPath && !commonWellPath->name().isEmpty()) + if ( commonWellPath && !commonWellPath->name().isEmpty() ) { - generatedAutoTags.push_back(commonWellPath->name()); + generatedAutoTags.push_back( commonWellPath->name() ); } - else if (!m_commonDataSource->simWellNameToApply().isEmpty()) + else if ( !m_commonDataSource->simWellNameToApply().isEmpty() ) { - generatedAutoTags.push_back(m_commonDataSource->simWellNameToApply()); + generatedAutoTags.push_back( m_commonDataSource->simWellNameToApply() ); } } - if (m_nameConfig->addTimeStep()) + if ( m_nameConfig->addTimeStep() ) { - if (commonCase && m_commonDataSource->timeStepToApply() != -1) + if ( commonCase && m_commonDataSource->timeStepToApply() != -1 ) { - generatedAutoTags.push_back(commonCase->timeStepName(m_commonDataSource->timeStepToApply())); + generatedAutoTags.push_back( commonCase->timeStepName( m_commonDataSource->timeStepToApply() ) ); } } - if (m_nameConfig->addAirGap()) + if ( m_nameConfig->addAirGap() ) { - if (commonWellPath) + if ( commonWellPath ) { RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry(); - if (wellPathGeometry) + if ( wellPathGeometry ) { double rkb = wellPathGeometry->rkbDiff(); - generatedAutoTags.push_back(QString("Air Gap = %1 m").arg(rkb)); + generatedAutoTags.push_back( QString( "Air Gap = %1 m" ).arg( rkb ) ); } } } - if (m_nameConfig->addWaterDepth()) + if ( m_nameConfig->addWaterDepth() ) { - if (commonWellPath) + if ( commonWellPath ) { RigWellPath* wellPathGeometry = commonWellPath->wellPathGeometry(); - if (wellPathGeometry) + if ( wellPathGeometry ) { const std::vector& wellPathPoints = wellPathGeometry->wellPathPoints(); - if (!wellPathPoints.empty()) + if ( !wellPathPoints.empty() ) { - double tvdmsl = std::abs(wellPathPoints.front()[2]); - generatedAutoTags.push_back(QString("Water Depth = %1 m").arg(tvdmsl)); + double tvdmsl = std::abs( wellPathPoints.front()[2] ); + generatedAutoTags.push_back( QString( "Water Depth = %1 m" ).arg( tvdmsl ) ); } } } } - if (!generatedAutoTags.empty()) + if ( !generatedAutoTags.empty() ) { - generatedCurveName.push_back(generatedAutoTags.join(", ")); + generatedCurveName.push_back( generatedAutoTags.join( ", " ) ); } - return generatedCurveName.join(": "); + return generatedCurveName.join( ": " ); } //-------------------------------------------------------------------------------------------------- @@ -682,16 +687,16 @@ void RimWellLogPlot::performAutoNameUpdate() //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::handleKeyPressEvent(QKeyEvent* keyEvent) +void RimWellLogPlot::handleKeyPressEvent( QKeyEvent* keyEvent ) { - if (keyEvent->key() == Qt::Key_PageUp) + if ( keyEvent->key() == Qt::Key_PageUp ) { - if (keyEvent->modifiers() & Qt::ShiftModifier) + if ( keyEvent->modifiers() & Qt::ShiftModifier ) { m_commonDataSource->applyPrevCase(); keyEvent->accept(); } - else if (keyEvent->modifiers() & Qt::ControlModifier) + else if ( keyEvent->modifiers() & Qt::ControlModifier ) { m_commonDataSource->applyPrevWell(); keyEvent->accept(); @@ -702,14 +707,14 @@ void RimWellLogPlot::handleKeyPressEvent(QKeyEvent* keyEvent) keyEvent->accept(); } } - else if (keyEvent->key() == Qt::Key_PageDown) + else if ( keyEvent->key() == Qt::Key_PageDown ) { - if (keyEvent->modifiers() & Qt::ShiftModifier) + if ( keyEvent->modifiers() & Qt::ShiftModifier ) { m_commonDataSource->applyNextCase(); keyEvent->accept(); } - else if (keyEvent->modifiers() & Qt::ControlModifier) + else if ( keyEvent->modifiers() & Qt::ControlModifier ) { m_commonDataSource->applyNextWell(); keyEvent->accept(); @@ -731,28 +736,26 @@ RimWellLogCurveCommonDataSource* RimWellLogPlot::commonDataSource() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::depthZoomMinMax(double* minimumDepth, double* maximumDepth) const +void RimWellLogPlot::depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const { *minimumDepth = m_minVisibleDepth; *maximumDepth = m_maxVisibleDepth; } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) +void RimWellLogPlot::defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) { - m_commonDataSource->uiOrdering(uiConfigName, uiOrdering); - uiOrderingForDepthAxis(uiOrdering); - uiOrderingForPlotSettings(uiOrdering); + m_commonDataSource->uiOrdering( uiConfigName, uiOrdering ); + uiOrderingForDepthAxis( uiOrdering ); + uiOrderingForPlotSettings( uiOrdering ); - uiOrdering.skipRemainingFields(true); + uiOrdering.skipRemainingFields( true ); } - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- @@ -762,28 +765,28 @@ caf::PdmFieldHandle* RimWellLogPlot::userDescriptionField() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::onLoadDataAndUpdate() { updateMdiWindowVisibility(); updatePlotTitle(); - updateTracks(); + updateTracks(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::updateTracks(bool autoScaleXAxis) +void RimWellLogPlot::updateTracks( bool autoScaleXAxis ) { - if (m_showWindow) + if ( m_showWindow ) { - for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) + for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx ) { m_tracks[tIdx]->loadDataAndUpdate(); - if (autoScaleXAxis) + if ( autoScaleXAxis ) { - m_tracks[tIdx]->setAutoScaleXEnabled(true); + m_tracks[tIdx]->setAutoScaleXEnabled( true ); m_tracks[tIdx]->calculateXZoomRangeAndUpdateQwt(); m_tracks[tIdx]->updateAxisAndGridTickIntervals(); } @@ -795,22 +798,22 @@ void RimWellLogPlot::updateTracks(bool autoScaleXAxis) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::updateTrackNames() { - for (size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++) + for ( size_t tIdx = 0; tIdx < m_tracks.size(); tIdx++ ) { - m_tracks[tIdx]->setDescription(QString("Track %1").arg(tIdx + 1)); + m_tracks[tIdx]->setDescription( QString( "Track %1" ).arg( tIdx + 1 ) ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::updateDepthZoom() { - if (m_isAutoScaleDepthEnabled) + if ( m_isAutoScaleDepthEnabled ) { applyZoomAllDepths(); } @@ -821,71 +824,72 @@ void RimWellLogPlot::updateDepthZoom() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::applyDepthZoomFromVisibleDepth() { - if (m_viewer) + if ( m_viewer ) { double minDepth = m_minVisibleDepth < HUGE_VAL ? m_minVisibleDepth : RI_LOGPLOT_MINDEPTH_DEFAULT; double maxDepth = m_maxVisibleDepth > -HUGE_VAL ? m_maxVisibleDepth : RI_LOGPLOT_MAXDEPTH_DEFAULT; - m_viewer->setDepthZoomAndReplot(minDepth, maxDepth); + m_viewer->setDepthZoomAndReplot( minDepth, maxDepth ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::applyZoomAllDepths() { calculateAvailableDepthRange(); - if (hasAvailableDepthRange()) + if ( hasAvailableDepthRange() ) { - setDepthZoomMinMax(m_minAvailableDepth, m_maxAvailableDepth + 0.01*(m_maxAvailableDepth - m_minAvailableDepth)); + setDepthZoomMinMax( m_minAvailableDepth, + m_maxAvailableDepth + 0.01 * ( m_maxAvailableDepth - m_minAvailableDepth ) ); } else { - setDepthZoomMinMax(RI_LOGPLOT_MINDEPTH_DEFAULT, RI_LOGPLOT_MAXDEPTH_DEFAULT); + setDepthZoomMinMax( RI_LOGPLOT_MINDEPTH_DEFAULT, RI_LOGPLOT_MAXDEPTH_DEFAULT ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::recreateTrackPlots() { - CVF_ASSERT(m_viewer); + CVF_ASSERT( m_viewer ); - for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) + for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx ) { m_tracks[tIdx]->recreateViewer(); - m_viewer->addTrackPlot(m_tracks[tIdx]->viewer()); + m_viewer->addTrackPlot( m_tracks[tIdx]->viewer() ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::detachAllCurves() { - for (size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx) + for ( size_t tIdx = 0; tIdx < m_tracks.size(); ++tIdx ) { - m_tracks[tIdx]->detachAllCurves(); + m_tracks[tIdx]->detachAllCurves(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDescription(const QString& description) +void RimWellLogPlot::setDescription( const QString& description ) { - m_nameConfig->setCustomName(description); + m_nameConfig->setCustomName( description ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimWellLogPlot::description() const { @@ -893,27 +897,27 @@ QString RimWellLogPlot::description() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -QWidget* RimWellLogPlot::createViewWidget(QWidget* mainWindowParent) +QWidget* RimWellLogPlot::createViewWidget( QWidget* mainWindowParent ) { - m_viewer = new RiuWellLogPlot(this, mainWindowParent); + m_viewer = new RiuWellLogPlot( this, mainWindowParent ); recreateTrackPlots(); return m_viewer; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::deleteViewWidget() { detachAllCurves(); - if (m_viewer) - { - m_viewer->deleteLater(); - m_viewer = nullptr; - } + if ( m_viewer ) + { + m_viewer->deleteLater(); + m_viewer = nullptr; + } } //-------------------------------------------------------------------------------------------------- @@ -922,14 +926,14 @@ void RimWellLogPlot::deleteViewWidget() void RimWellLogPlot::initAfterRead() { m_commonDataSource->updateDefaultOptions(); - if (!m_userName_OBSOLETE().isEmpty()) + if ( !m_userName_OBSOLETE().isEmpty() ) { - m_nameConfig->setCustomName(m_userName_OBSOLETE()); + m_nameConfig->setCustomName( m_userName_OBSOLETE() ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const { @@ -937,15 +941,15 @@ RimWellLogPlot::DepthTypeEnum RimWellLogPlot::depthType() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDepthType(DepthTypeEnum depthType) +void RimWellLogPlot::setDepthType( DepthTypeEnum depthType ) { m_depthType = depthType; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RiaDefines::DepthUnitType RimWellLogPlot::depthUnit() const { @@ -953,42 +957,42 @@ RiaDefines::DepthUnitType RimWellLogPlot::depthUnit() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QString RimWellLogPlot::depthPlotTitle() const { QString depthTitle = "Depth"; - - switch (m_depthType.value()) + + switch ( m_depthType.value() ) { case MEASURED_DEPTH: - depthTitle = "MD"; - break; + depthTitle = "MD"; + break; case TRUE_VERTICAL_DEPTH: - depthTitle = "TVDMSL"; - break; + depthTitle = "TVDMSL"; + break; case PSEUDO_LENGTH: - depthTitle = "PL"; - break; + depthTitle = "PL"; + break; case CONNECTION_NUMBER: - depthTitle = "Connection"; - break; + depthTitle = "Connection"; + break; } - if (m_depthType() == CONNECTION_NUMBER) return depthTitle; + if ( m_depthType() == CONNECTION_NUMBER ) return depthTitle; - if (m_depthUnit == RiaDefines::UNIT_METER) + if ( m_depthUnit == RiaDefines::UNIT_METER ) { depthTitle += " [m]"; } - else if (m_depthUnit == RiaDefines::UNIT_FEET) + else if ( m_depthUnit == RiaDefines::UNIT_FEET ) { depthTitle += " [ft]"; } - else if (m_depthUnit == RiaDefines::UNIT_NONE) + else if ( m_depthUnit == RiaDefines::UNIT_NONE ) { depthTitle += ""; } @@ -999,7 +1003,7 @@ QString RimWellLogPlot::depthPlotTitle() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::enableDepthGridLines(AxisGridVisibility gridVisibility) +void RimWellLogPlot::enableDepthGridLines( AxisGridVisibility gridVisibility ) { m_depthAxisGridVisibility = gridVisibility; } @@ -1023,13 +1027,13 @@ bool RimWellLogPlot::isPlotTitleVisible() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setPlotTitleVisible(bool visible) +void RimWellLogPlot::setPlotTitleVisible( bool visible ) { m_showTitleInPlot = visible; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogPlot::areTrackLegendsVisible() const { @@ -1037,9 +1041,9 @@ bool RimWellLogPlot::areTrackLegendsVisible() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setTrackLegendsVisible(bool doShow) +void RimWellLogPlot::setTrackLegendsVisible( bool doShow ) { m_showTrackLegends = doShow; } @@ -1055,23 +1059,23 @@ bool RimWellLogPlot::areTrackLegendsHorizontal() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setTrackLegendsHorizontal(bool horizontal) +void RimWellLogPlot::setTrackLegendsHorizontal( bool horizontal ) { m_trackLegendsHorizontal = horizontal; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -size_t RimWellLogPlot::trackIndex(const RimWellLogTrack* track) const +size_t RimWellLogPlot::trackIndex( const RimWellLogTrack* track ) const { - return m_tracks.index(track); + return m_tracks.index( track ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::setDepthUnit(RiaDefines::DepthUnitType depthUnit) +void RimWellLogPlot::setDepthUnit( RiaDefines::DepthUnitType depthUnit ) { m_depthUnit = depthUnit; @@ -1087,7 +1091,7 @@ std::set RimWellLogPlot::availableDepthUnits() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- std::set RimWellLogPlot::availableDepthTypes() const { @@ -1099,9 +1103,9 @@ std::set RimWellLogPlot::availableDepthTypes() co //-------------------------------------------------------------------------------------------------- void RimWellLogPlot::updatePlotTitle() { - if (m_viewer) + if ( m_viewer ) { - m_viewer->setPlotTitle(this->createAutoName()); + m_viewer->setPlotTitle( this->createAutoName() ); } updateMdiWindowTitle(); } @@ -1109,7 +1113,4 @@ void RimWellLogPlot::updatePlotTitle() //-------------------------------------------------------------------------------------------------- /// Default empty implementation //-------------------------------------------------------------------------------------------------- -void RimWellLogPlot::onDepthTypeChanged() -{ -} - +void RimWellLogPlot::onDepthTypeChanged() {} diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h index 856a5687d4..801b35663e 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlot.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlot.h @@ -2,17 +2,17 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -39,8 +39,8 @@ class RimWellLogTrack; class QKeyEvent; //================================================================================================== -/// -/// +/// +/// //================================================================================================== class RimWellLogPlot : public RimViewWindow, public RimNameConfigHolderInterface { @@ -55,7 +55,12 @@ public: 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 AxisGridEnum; @@ -63,88 +68,95 @@ public: RimWellLogPlot(); ~RimWellLogPlot() override; - RimWellLogPlot& operator=(RimWellLogPlot&& rhs); + RimWellLogPlot& operator=( RimWellLogPlot&& rhs ); - QWidget* createPlotWidget(); - QWidget* viewWidget() override; + QWidget* createPlotWidget(); + QWidget* viewWidget() override; - void setDescription(const QString& description); - QString description() const; + void setDescription( const QString& description ); + QString description() const; - DepthTypeEnum depthType() const; - void setDepthType(DepthTypeEnum depthType); + DepthTypeEnum depthType() const; + void setDepthType( DepthTypeEnum depthType ); - RiaDefines::DepthUnitType depthUnit() const; - void setDepthUnit(RiaDefines::DepthUnitType depthUnit); + RiaDefines::DepthUnitType depthUnit() const; + void setDepthUnit( RiaDefines::DepthUnitType depthUnit ); - QString depthPlotTitle() const; - void enableDepthGridLines(AxisGridVisibility gridVisibility); - AxisGridVisibility depthGridLinesVisibility() const; + QString depthPlotTitle() const; + void enableDepthGridLines( AxisGridVisibility gridVisibility ); + AxisGridVisibility depthGridLinesVisibility() const; - bool isPlotTitleVisible() const; - void setPlotTitleVisible(bool visible); - bool areTrackLegendsVisible() const; - void setTrackLegendsVisible(bool doShow); - bool areTrackLegendsHorizontal() const; - void setTrackLegendsHorizontal(bool horizontal); + bool isPlotTitleVisible() const; + void setPlotTitleVisible( bool visible ); + bool areTrackLegendsVisible() const; + void setTrackLegendsVisible( bool doShow ); + bool areTrackLegendsHorizontal() const; + void setTrackLegendsHorizontal( bool horizontal ); - void addTrack(RimWellLogTrack* track); - void insertTrack(RimWellLogTrack* track, size_t index); - size_t trackCount() const { return m_tracks.size();} + void addTrack( RimWellLogTrack* track ); + void insertTrack( RimWellLogTrack* track, size_t index ); + size_t trackCount() const + { + return m_tracks.size(); + } - void removeTrack(RimWellLogTrack* track); - size_t trackIndex(const RimWellLogTrack* track) const; - RimWellLogTrack* trackByIndex(size_t index) const; - size_t firstVisibleTrackIndex() const; - std::vector tracks() const; - void updateTracks(bool autoScaleXAxis = false); - void updateTrackNames(); + void removeTrack( RimWellLogTrack* track ); + size_t trackIndex( const RimWellLogTrack* track ) const; + RimWellLogTrack* trackByIndex( size_t index ) const; + size_t firstVisibleTrackIndex() const; + std::vector tracks() const; + void updateTracks( bool autoScaleXAxis = false ); + void updateTrackNames(); - void updateDepthZoom(); - void setDepthZoomByFactorAndCenter(double zoomFactor, double zoomCenter); - void panDepth(double panFactor); - void setDepthZoomMinMax(double minimumDepth, double maximumDepth); - void depthZoomMinMax(double* minimumDepth, double* maximumDepth) const; + void updateDepthZoom(); + void setDepthZoomByFactorAndCenter( double zoomFactor, double zoomCenter ); + void panDepth( double panFactor ); + void setDepthZoomMinMax( double minimumDepth, double maximumDepth ); + void depthZoomMinMax( double* minimumDepth, double* maximumDepth ) const; - void calculateAvailableDepthRange(); - void availableDepthRange(double* minimumDepth, double* maximumDepth) const; - bool hasAvailableDepthRange() const; + void calculateAvailableDepthRange(); + void availableDepthRange( double* minimumDepth, double* maximumDepth ) const; + bool hasAvailableDepthRange() const; - void zoomAll() override; - void setDepthAutoZoom(bool on); - void enableAllAutoNameTags(bool enable); + void zoomAll() override; + void setDepthAutoZoom( bool on ); + void enableAllAutoNameTags( bool enable ); - QString asciiDataForPlotExport() const; + QString asciiDataForPlotExport() const; - void uiOrderingForDepthAxis(caf::PdmUiOrdering& uiOrdering); - void uiOrderingForPlotSettings(caf::PdmUiOrdering& uiOrdering); + void uiOrderingForDepthAxis( 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: - void performAutoNameUpdate() override; + void performAutoNameUpdate() override; // Overridden PDM methods - void fieldChangedByUi(const caf::PdmFieldHandle* changedField, const QVariant& oldValue, const QVariant& newValue) override; - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; - caf::PdmFieldHandle* userDescriptionField() override; - QList calculateValueOptions(const caf::PdmFieldHandle* fieldNeedingOptions, bool* useOptionsOnly) override; - void onLoadDataAndUpdate() override; + void fieldChangedByUi( const caf::PdmFieldHandle* changedField, + const QVariant& oldValue, + const QVariant& newValue ) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; + caf::PdmFieldHandle* userDescriptionField() override; + QList calculateValueOptions( const caf::PdmFieldHandle* fieldNeedingOptions, + bool* useOptionsOnly ) override; + void onLoadDataAndUpdate() override; - QImage snapshotWindowContent() override; + QImage snapshotWindowContent() override; - QWidget* createViewWidget(QWidget* mainWindowParent) override; - void deleteViewWidget() override; + QWidget* createViewWidget( QWidget* mainWindowParent ) override; + void deleteViewWidget() override; - void initAfterRead() override; + void initAfterRead() override; private: - void applyZoomAllDepths(); - void applyDepthZoomFromVisibleDepth(); - void recreateTrackPlots(); - void detachAllCurves(); + void applyZoomAllDepths(); + void applyDepthZoomFromVisibleDepth(); + void recreateTrackPlots(); + void detachAllCurves(); virtual std::set availableDepthUnits() const; virtual std::set availableDepthTypes() const; @@ -152,22 +164,22 @@ private: virtual void onDepthTypeChanged(); protected: - caf::PdmField m_userName_OBSOLETE; - caf::PdmChildField m_commonDataSource; - caf::PdmChildArrayField m_tracks; + caf::PdmField m_userName_OBSOLETE; + caf::PdmChildField m_commonDataSource; + caf::PdmChildArrayField m_tracks; - caf::PdmField< caf::AppEnum> m_depthType; - caf::PdmField< caf::AppEnum> m_depthUnit; - caf::PdmField m_minVisibleDepth; - caf::PdmField m_maxVisibleDepth; - caf::PdmField m_depthAxisGridVisibility; - caf::PdmField m_isAutoScaleDepthEnabled; - - caf::PdmField m_showTitleInPlot; - caf::PdmField m_showTrackLegends; - caf::PdmField m_trackLegendsHorizontal; + caf::PdmField> m_depthType; + caf::PdmField> m_depthUnit; + caf::PdmField m_minVisibleDepth; + caf::PdmField m_maxVisibleDepth; + caf::PdmField m_depthAxisGridVisibility; + caf::PdmField m_isAutoScaleDepthEnabled; - caf::PdmChildField m_nameConfig; + caf::PdmField m_showTitleInPlot; + caf::PdmField m_showTrackLegends; + caf::PdmField m_trackLegendsHorizontal; + + caf::PdmChildField m_nameConfig; double m_minAvailableDepth; double m_maxAvailableDepth; diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.cpp index 8bc92e9315..269448f805 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.cpp @@ -19,31 +19,31 @@ #include "RimWellLogPlotNameConfig.h" //================================================================================================== -/// -/// +/// +/// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig"); +CAF_PDM_SOURCE_INIT( RimWellLogPlotNameConfig, "RimWellLogPlotNameConfig" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogPlotNameConfig::RimWellLogPlotNameConfig() : 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_addWellName, "AddWellName", false, "Add Well Name", "", "", ""); - CAF_PDM_InitField(&m_addTimestep, "AddTimeStep", false, "Add Time Step", "", "", ""); - CAF_PDM_InitField(&m_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", ""); - CAF_PDM_InitField(&m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", ""); + CAF_PDM_InitField( &m_addCaseName, "AddCaseName", false, "Add Case 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_addAirGap, "AddAirGap", false, "Add Air Gap", "", "", "" ); + CAF_PDM_InitField( &m_addWaterDepth, "AddWaterDepth", false, "Add Water Depth", "", "", "" ); m_customName = "Well Log Plot"; } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogPlotNameConfig::addCaseName() const { @@ -51,7 +51,7 @@ bool RimWellLogPlotNameConfig::addCaseName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogPlotNameConfig::addWellName() const { @@ -59,7 +59,7 @@ bool RimWellLogPlotNameConfig::addWellName() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- bool RimWellLogPlotNameConfig::addTimeStep() const { @@ -85,7 +85,7 @@ bool RimWellLogPlotNameConfig::addWaterDepth() const //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RimWellLogPlotNameConfig::enableAllAutoNameTags(bool enable) +void RimWellLogPlotNameConfig::enableAllAutoNameTags( bool enable ) { m_addCaseName = 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); - uiOrdering.add(&m_addCaseName); - uiOrdering.add(&m_addWellName); - uiOrdering.add(&m_addTimestep); - uiOrdering.add(&m_addAirGap); - uiOrdering.add(&m_addWaterDepth); + RimNameConfig::defineUiOrdering( uiConfigName, uiOrdering ); + uiOrdering.add( &m_addCaseName ); + uiOrdering.add( &m_addWellName ); + uiOrdering.add( &m_addTimestep ); + uiOrdering.add( &m_addAirGap ); + uiOrdering.add( &m_addWaterDepth ); } - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.h b/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.h index ed2c34fb86..5f951e8db1 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogPlotNameConfig.h @@ -36,17 +36,15 @@ public: bool addTimeStep() const; bool addAirGap() const; bool addWaterDepth() const; - void enableAllAutoNameTags(bool enable) override; + void enableAllAutoNameTags( bool enable ) override; protected: - void defineUiOrdering(QString uiConfigName, caf::PdmUiOrdering& uiOrdering) override; + void defineUiOrdering( QString uiConfigName, caf::PdmUiOrdering& uiOrdering ) override; private: - caf::PdmField m_addCaseName; - caf::PdmField m_addWellName; - caf::PdmField m_addTimestep; - caf::PdmField m_addAirGap; - caf::PdmField m_addWaterDepth; + caf::PdmField m_addCaseName; + caf::PdmField m_addWellName; + caf::PdmField m_addTimestep; + caf::PdmField m_addAirGap; + caf::PdmField m_addWaterDepth; }; - - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.cpp b/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.cpp index 2f7389898b..8b69d2ae0d 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.cpp +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.cpp @@ -19,19 +19,18 @@ #include "RimWellLogRftCurveNameConfig.h" //================================================================================================== -/// -/// +/// +/// //================================================================================================== -CAF_PDM_SOURCE_INIT(RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig"); +CAF_PDM_SOURCE_INIT( RimWellLogRftCurveNameConfig, "RimWellLogRftCurveNameConfig" ); //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogRftCurveNameConfig::RimWellLogRftCurveNameConfig() : RimNameConfig() { - CAF_PDM_InitObject("Well Log Rft Curve Name Generator", "", "", ""); + CAF_PDM_InitObject( "Well Log Rft Curve Name Generator", "", "", "" ); m_customName = "Rft Curve"; } - diff --git a/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.h b/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.h index e86339354d..28b7a8f99a 100644 --- a/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.h +++ b/ApplicationCode/ProjectDataModel/RimWellLogRftCurveNameConfig.h @@ -31,4 +31,3 @@ class RimWellLogRftCurveNameConfig : public RimNameConfig public: RimWellLogRftCurveNameConfig(); }; - diff --git a/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp b/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp index 3ddec96630..b95607be3f 100644 --- a/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellAllocationPlot.cpp @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -21,11 +21,11 @@ #include "RiaApplication.h" #include "RimContextCommandBuilder.h" +#include "RimTofAccumulatedPhaseFractionsPlot.h" #include "RimTotalWellAllocationPlot.h" #include "RimWellAllocationPlot.h" #include "RimWellLogPlot.h" #include "RimWellLogTrack.h" -#include "RimTofAccumulatedPhaseFractionsPlot.h" #include "RiuContextMenuLauncher.h" #include "RiuNightchartsWidget.h" @@ -38,126 +38,120 @@ #include #include - - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RiuWellAllocationPlot::RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent) - : RiuWellLogPlot(plotDefinition, parent) +RiuWellAllocationPlot::RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent ) + : RiuWellLogPlot( plotDefinition, parent ) { - Q_ASSERT(m_plotDefinition); + Q_ASSERT( m_plotDefinition ); QVBoxLayout* mainLayout = new QVBoxLayout(); - this->setLayout(mainLayout); - this->layout()->setMargin(0); - this->layout()->setSpacing(2); + this->setLayout( mainLayout ); + this->layout()->setMargin( 0 ); + this->layout()->setSpacing( 2 ); - 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 rightColumnLayout = new QVBoxLayout(); - mainLayout->addLayout(plotWidgetsLayout); - plotWidgetsLayout->addLayout(rightColumnLayout); - - m_legendWidget = new RiuNightchartsWidget(this); - RimWellAllocationPlot* wellAllocationPlot = dynamic_cast(m_plotDefinition.p()); - new RiuPlotObjectPicker(m_legendWidget, wellAllocationPlot->plotLegend()); + mainLayout->addLayout( plotWidgetsLayout ); + plotWidgetsLayout->addLayout( rightColumnLayout ); + + m_legendWidget = new RiuNightchartsWidget( this ); + RimWellAllocationPlot* wellAllocationPlot = dynamic_cast( m_plotDefinition.p() ); + new RiuPlotObjectPicker( m_legendWidget, wellAllocationPlot->plotLegend() ); caf::CmdFeatureMenuBuilder menuBuilder; menuBuilder << "RicShowTotalAllocationDataFeature"; - new RiuContextMenuLauncher(m_legendWidget, menuBuilder); + new RiuContextMenuLauncher( m_legendWidget, menuBuilder ); - rightColumnLayout->addWidget(m_legendWidget); - m_legendWidget->showPie(false); + rightColumnLayout->addWidget( m_legendWidget ); + m_legendWidget->showPie( false ); - QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget(this); - new RiuPlotObjectPicker(totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot()); - new RiuContextMenuLauncher(totalFlowAllocationWidget, menuBuilder); + QWidget* totalFlowAllocationWidget = wellAllocationPlot->totalWellFlowPlot()->createViewWidget( this ); + new RiuPlotObjectPicker( totalFlowAllocationWidget, wellAllocationPlot->totalWellFlowPlot() ); + new RiuContextMenuLauncher( totalFlowAllocationWidget, menuBuilder ); - rightColumnLayout->addWidget(totalFlowAllocationWidget, Qt::AlignTop); - rightColumnLayout->addWidget(wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget(this), Qt::AlignTop); + rightColumnLayout->addWidget( totalFlowAllocationWidget, Qt::AlignTop ); + rightColumnLayout->addWidget( wellAllocationPlot->tofAccumulatedPhaseFractionsPlot()->createViewWidget( this ), + Qt::AlignTop ); rightColumnLayout->addStretch(); 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(); else 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->update(); } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RiuWellAllocationPlot::clearLegend() { m_legendWidget->clear(); } - //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QSize RiuWellAllocationPlot::minimumSizeHint() const { - return QSize(0, 100); + return QSize( 0, 100 ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellAllocationPlot::contextMenuEvent(QContextMenuEvent* event) +void RiuWellAllocationPlot::contextMenuEvent( QContextMenuEvent* event ) { - QMenu menu; + QMenu menu; caf::CmdFeatureMenuBuilder menuBuilder; menuBuilder << "RicShowContributingWellsFromPlotFeature"; - menuBuilder.appendToMenu(&menu); + menuBuilder.appendToMenu( &menu ); - if (menu.actions().size() > 0) + if ( menu.actions().size() > 0 ) { - menu.exec(event->globalPos()); + menu.exec( event->globalPos() ); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QSize RiuWellAllocationPlot::sizeHint() const { - return QSize(0, 0); + return QSize( 0, 0 ); } diff --git a/ApplicationCode/UserInterface/RiuWellAllocationPlot.h b/ApplicationCode/UserInterface/RiuWellAllocationPlot.h index 17da3c9eae..2149103373 100644 --- a/ApplicationCode/UserInterface/RiuWellAllocationPlot.h +++ b/ApplicationCode/UserInterface/RiuWellAllocationPlot.h @@ -1,17 +1,17 @@ ///////////////////////////////////////////////////////////////////////////////// // // Copyright (C) 2017 Statoil ASA -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -24,16 +24,17 @@ #include "qwt_plot.h" -#include #include +#include class RimWellAllocationPlot; class RiuNightchartsWidget; class QLabel; -namespace cvf { - class Color3f; +namespace cvf +{ +class Color3f; } //================================================================================================== @@ -44,19 +45,20 @@ namespace cvf { class RiuWellAllocationPlot : public RiuWellLogPlot { Q_OBJECT; + public: - RiuWellAllocationPlot(RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr); + RiuWellAllocationPlot( RimWellAllocationPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuWellAllocationPlot() override; - void showLegend(bool doShow); - void addLegendItem(const QString& name, const cvf::Color3f& color, float value); - void clearLegend(); + void showLegend( bool doShow ); + void addLegendItem( const QString& name, const cvf::Color3f& color, float value ); + void clearLegend(); protected: - QSize sizeHint() const override; - QSize minimumSizeHint() const override; + QSize sizeHint() const override; + QSize minimumSizeHint() const override; - void contextMenuEvent(QContextMenuEvent *) override; + void contextMenuEvent( QContextMenuEvent* ) override; private: QPointer m_legendWidget; diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp index 4684170310..f2427d1276 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.cpp +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.cpp @@ -2,17 +2,17 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -30,8 +30,8 @@ #include "RiuPlotObjectPicker.h" #include "RiuWellLogTrack.h" -#include "cafSelectionManager.h" #include "cafCmdFeatureMenuBuilder.h" +#include "cafSelectionManager.h" #include "cvfAssert.h" @@ -48,92 +48,97 @@ #include //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -RiuWellLogPlot::RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent) - : QWidget(parent), m_scheduleUpdateChildrenLayoutTimer(nullptr) +RiuWellLogPlot::RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent ) + : QWidget( parent ) + , m_scheduleUpdateChildrenLayoutTimer( nullptr ) { - Q_ASSERT(plotDefinition); + Q_ASSERT( plotDefinition ); m_plotDefinition = plotDefinition; - QPalette newPalette(palette()); - newPalette.setColor(QPalette::Background, Qt::white); - setPalette(newPalette); + QPalette newPalette( palette() ); + newPalette.setColor( QPalette::Background, Qt::white ); + setPalette( newPalette ); - setAutoFillBackground(true); + setAutoFillBackground( true ); - m_plotTitle = new QLabel("PLOT TITLE HERE", this); - QFont font = m_plotTitle->font(); - font.setPointSize(14); - font.setBold(true); - m_plotTitle->setFont(font); + m_plotTitle = new QLabel( "PLOT TITLE HERE", this ); + QFont font = m_plotTitle->font(); + font.setPointSize( 14 ); + font.setBold( true ); + m_plotTitle->setFont( font ); m_plotTitle->hide(); - m_scrollBar = new QScrollBar(this); - m_scrollBar->setOrientation(Qt::Vertical); - m_scrollBar->setVisible(true); + m_scrollBar = new QScrollBar( this ); + m_scrollBar->setOrientation( Qt::Vertical ); + m_scrollBar->setVisible( true ); - new RiuPlotObjectPicker(m_plotTitle, m_plotDefinition); + new RiuPlotObjectPicker( m_plotTitle, m_plotDefinition ); - this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding); - - setFocusPolicy(Qt::StrongFocus); - connect(m_scrollBar, SIGNAL(valueChanged(int)), this, SLOT(slotSetMinDepth(int))); + this->setSizePolicy( QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ); + + setFocusPolicy( Qt::StrongFocus ); + connect( m_scrollBar, SIGNAL( valueChanged( int ) ), this, SLOT( slotSetMinDepth( int ) ) ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RiuWellLogPlot::~RiuWellLogPlot() { - if (m_plotDefinition) + if ( m_plotDefinition ) { m_plotDefinition->detachAllCurves(); } } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::addTrackPlot(RiuWellLogTrack* trackPlot) +void RiuWellLogPlot::addTrackPlot( RiuWellLogTrack* trackPlot ) { // 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); - - m_trackPlots.insert(static_cast(index), trackPlot); + trackPlot->setParent( this ); - QwtLegend* legend = new QwtLegend(this); - int legendColumns = 1; - if (m_plotDefinition->areTrackLegendsHorizontal()) + m_trackPlots.insert( static_cast( index ), trackPlot ); + + QwtLegend* legend = new QwtLegend( this ); + int legendColumns = 1; + if ( m_plotDefinition->areTrackLegendsHorizontal() ) { legendColumns = 0; // unlimited } - legend->setMaxColumns(legendColumns); - - legend->horizontalScrollBar()->setVisible(false); - legend->verticalScrollBar()->setVisible(false); + legend->setMaxColumns( legendColumns ); - legend->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(updateLegend(const QVariant &, const QList< QwtLegendData > &))); - legend->contentsWidget()->layout()->setAlignment(Qt::AlignBottom | Qt::AlignHCenter); - m_legends.insert(static_cast(index), legend); - - this->connect(trackPlot, SIGNAL(legendDataChanged(const QVariant &, const QList< QwtLegendData > &)), SLOT(scheduleUpdateChildrenLayout())); + legend->horizontalScrollBar()->setVisible( false ); + legend->verticalScrollBar()->setVisible( false ); - if (!m_plotDefinition->areTrackLegendsVisible()) + legend->connect( trackPlot, + SIGNAL( legendDataChanged( const QVariant&, const QList& ) ), + SLOT( updateLegend( const QVariant&, const QList& ) ) ); + legend->contentsWidget()->layout()->setAlignment( Qt::AlignBottom | Qt::AlignHCenter ); + m_legends.insert( static_cast( index ), legend ); + + this->connect( trackPlot, + SIGNAL( legendDataChanged( const QVariant&, const QList& ) ), + SLOT( scheduleUpdateChildrenLayout() ) ); + + if ( !m_plotDefinition->areTrackLegendsVisible() ) { legend->hide(); } trackPlot->updateLegend(); - if (trackPlot->isRimTrackVisible()) + if ( trackPlot->isRimTrackVisible() ) { trackPlot->show(); } @@ -144,67 +149,67 @@ 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); - CVF_ASSERT(trackIdx >= 0); + int trackIdx = m_trackPlots.indexOf( trackPlot ); + CVF_ASSERT( trackIdx >= 0 ); - m_trackPlots.removeAt(trackIdx); - trackPlot->setParent(nullptr); + m_trackPlots.removeAt( trackIdx ); + trackPlot->setParent( nullptr ); QwtLegend* legend = m_legends[trackIdx]; - m_legends.removeAt(trackIdx); + m_legends.removeAt( trackIdx ); delete legend; } -//-------------------------------------------------------------------------------------------------- -/// -//-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::setDepthZoomAndReplot(double minDepth, double maxDepth) -{ - for (int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++) - { - m_trackPlots[tpIdx]->setDepthZoom(minDepth, maxDepth); - m_trackPlots[tpIdx]->replot(); - } - - updateScrollBar(minDepth, maxDepth); -} - //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::setPlotTitle(const QString& plotTitle) +void RiuWellLogPlot::setDepthZoomAndReplot( double minDepth, double maxDepth ) { - m_plotTitle->setText(plotTitle); + for ( int tpIdx = 0; tpIdx < m_trackPlots.count(); tpIdx++ ) + { + m_trackPlots[tpIdx]->setDepthZoom( minDepth, maxDepth ); + m_trackPlots[tpIdx]->replot(); + } + + updateScrollBar( minDepth, maxDepth ); +} + +//-------------------------------------------------------------------------------------------------- +/// +//-------------------------------------------------------------------------------------------------- +void RiuWellLogPlot::setPlotTitle( const QString& plotTitle ) +{ + m_plotTitle->setText( plotTitle ); this->updateChildrenLayout(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- QSize RiuWellLogPlot::preferredSize() const { int titleWidth = 0; int titleHeight = 0; - if (m_plotTitle && m_plotTitle->isVisible()) + if ( m_plotTitle && m_plotTitle->isVisible() ) { titleWidth = m_plotTitle->width(); titleHeight = m_plotTitle->height() + 10; } - int sumTrackWidth = 0; + int sumTrackWidth = 0; int maxTrackHeight = 0; - for (QPointer track : m_trackPlots) + for ( QPointer track : m_trackPlots ) { 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 ); } //-------------------------------------------------------------------------------------------------- @@ -224,23 +229,23 @@ void RiuWellLogPlot::hideTitle() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event) +void RiuWellLogPlot::contextMenuEvent( QContextMenuEvent* event ) { - QMenu menu; + QMenu menu; caf::CmdFeatureMenuBuilder menuBuilder; - caf::SelectionManager::instance()->setSelectedItem(ownerPlotDefinition()); + caf::SelectionManager::instance()->setSelectedItem( ownerPlotDefinition() ); menuBuilder << "RicShowPlotDataFeature"; 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,56 +254,56 @@ void RiuWellLogPlot::contextMenuEvent(QContextMenuEvent* event) //-------------------------------------------------------------------------------------------------- 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 availableMaxDepth; - m_plotDefinition->availableDepthRange(&availableMinDepth, &availableMaxDepth); - availableMaxDepth += 0.01*(availableMaxDepth-availableMinDepth); + m_plotDefinition->availableDepthRange( &availableMinDepth, &availableMaxDepth ); + availableMaxDepth += 0.01 * ( availableMaxDepth - availableMinDepth ); double visibleDepth = maxDepth - minDepth; - m_scrollBar->blockSignals(true); + m_scrollBar->blockSignals( true ); { - m_scrollBar->setRange((int) availableMinDepth, (int) ((availableMaxDepth - visibleDepth))); - m_scrollBar->setPageStep((int) visibleDepth); - m_scrollBar->setValue((int) minDepth); + m_scrollBar->setRange( (int)availableMinDepth, (int)( ( availableMaxDepth - visibleDepth ) ) ); + m_scrollBar->setPageStep( (int)visibleDepth ); + 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 maximumDepth; - m_plotDefinition->depthZoomMinMax(&minimumDepth, &maximumDepth); + m_plotDefinition->depthZoomMinMax( &minimumDepth, &maximumDepth ); double delta = value - minimumDepth; - m_plotDefinition->setDepthZoomMinMax(minimumDepth + delta, maximumDepth + delta); - m_plotDefinition->setDepthAutoZoom(false); + m_plotDefinition->setDepthZoomMinMax( minimumDepth + delta, maximumDepth + delta ); + m_plotDefinition->setDepthAutoZoom( false ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimWellLogPlot* RiuWellLogPlot::ownerPlotDefinition() { @@ -306,7 +311,7 @@ RimWellLogPlot* RiuWellLogPlot::ownerPlotDefinition() } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- RimViewWindow* RiuWellLogPlot::ownerViewWindow() const { @@ -314,77 +319,77 @@ RimViewWindow* RiuWellLogPlot::ownerViewWindow() const } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::resizeEvent(QResizeEvent *event) +void RiuWellLogPlot::resizeEvent( QResizeEvent* event ) { int height = event->size().height(); int width = event->size().width(); - placeChildWidgets(height, width); - QWidget::resizeEvent(event); + placeChildWidgets( height, width ); + QWidget::resizeEvent( event ); } //-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- -std::map RiuWellLogPlot::calculateTrackWidthsToMatchFrame(int frameWidth) const +std::map RiuWellLogPlot::calculateTrackWidthsToMatchFrame( int frameWidth ) const { 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 - 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(m_trackPlots[tIdx]->plotLayout()->canvasRect().left()); + firstTrackAxisOffset = static_cast( 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 - int otherTrackAxisOffset = static_cast(m_trackPlots[tIdx]->plotLayout()->canvasRect().left()); + int otherTrackAxisOffset = static_cast( m_trackPlots[tIdx]->plotLayout()->canvasRect().left() ); firstTrackAxisOffset -= otherTrackAxisOffset; } - ++visibleTrackCount; + ++visibleTrackCount; } } int scrollBarWidth = 0; - if (m_scrollBar->isVisible()) scrollBarWidth = m_scrollBar->sizeHint().width(); - + if ( m_scrollBar->isVisible() ) scrollBarWidth = m_scrollBar->sizeHint().width(); + std::map trackWidths; - if (visibleTrackCount) + if ( visibleTrackCount ) { - int totalTrackWidth = (frameWidth - firstTrackAxisOffset - scrollBarWidth); - int trackWidthExtra = (frameWidth - firstTrackAxisOffset - scrollBarWidth) % visibleTrackCount; + int totalTrackWidth = ( frameWidth - firstTrackAxisOffset - scrollBarWidth ); + int trackWidthExtra = ( frameWidth - firstTrackAxisOffset - scrollBarWidth ) % visibleTrackCount; 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(); } } 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; - - if (firstVisible) + int realTrackWidth = ( totalTrackWidth * m_trackPlots[tIdx]->widthScaleFactor() ) / totalWidthWeights; + + if ( firstVisible ) { realTrackWidth += firstTrackAxisOffset; firstVisible = false; } - if (trackWidthExtra > 0) + if ( trackWidthExtra > 0 ) { realTrackWidth += 1; --trackWidthExtra; @@ -399,100 +404,104 @@ std::map 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; - std::map trackWidths = calculateTrackWidthsToMatchFrame(frameWidth); - size_t visibleTrackCount = trackWidths.size(); + std::map trackWidths = calculateTrackWidthsToMatchFrame( frameWidth ); + size_t visibleTrackCount = trackWidths.size(); int maxLegendHeight = 0; - if (m_plotDefinition && m_plotDefinition->areTrackLegendsVisible()) + if ( m_plotDefinition && m_plotDefinition->areTrackLegendsVisible() ) { for ( int tIdx = 0; tIdx < m_trackPlots.size(); ++tIdx ) { if ( m_trackPlots[tIdx]->isVisible() ) { - int legendHeight = m_legends[tIdx]->heightForWidth(trackWidths[tIdx] - 2 * trackPadding); + int legendHeight = m_legends[tIdx]->heightForWidth( trackWidths[tIdx] - 2 * trackPadding ); if ( legendHeight > maxLegendHeight ) maxLegendHeight = legendHeight; } } } int titleHeight = 0; - if (m_plotTitle && m_plotTitle->isVisible()) + if ( m_plotTitle && m_plotTitle->isVisible() ) { titleHeight = m_plotTitle->height() + 2; } int trackHeight = frameHeight - maxLegendHeight - titleHeight; - int trackX = 0; + int trackX = 0; - if (visibleTrackCount) + if ( visibleTrackCount ) { - 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. QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect(); - maxCanvasOffset = std::max(maxCanvasOffset, static_cast(canvasRect.top())); + maxCanvasOffset = std::max( maxCanvasOffset, static_cast( 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 adjustedTrackHeight = trackHeight; + int adjustedTrackHeight = trackHeight; { // Hack to align QWT plots which doesn't have an x-axis with the other tracks. // Since they are missing the axis, QWT will shift them upwards. // So we shift the plot downwards and resize to match the others. // TODO: Look into subclassing QwtPlotLayout instead. - QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect(); - int myCanvasOffset = static_cast(canvasRect.top()); - int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin(QwtPlot::xTop); - int canvasShift = std::max(0, maxCanvasOffset - myCanvasOffset); + QRectF canvasRect = m_trackPlots[tIdx]->plotLayout()->canvasRect(); + int myCanvasOffset = static_cast( canvasRect.top() ); + int myMargins = m_trackPlots[tIdx]->plotLayout()->canvasMargin( QwtPlot::xTop ); + int canvasShift = std::max( 0, maxCanvasOffset - myCanvasOffset ); adjustedVerticalPosition += canvasShift - myMargins; adjustedTrackHeight -= canvasShift; } int realTrackWidth = trackWidths[tIdx]; - m_legends[tIdx]->setGeometry(trackX + trackPadding, titleHeight, realTrackWidth - 2 * trackPadding, maxLegendHeight); - m_trackPlots[tIdx]->setGeometry(trackX + trackPadding, adjustedVerticalPosition, realTrackWidth - 2 * trackPadding, adjustedTrackHeight); + m_legends[tIdx]->setGeometry( trackX + trackPadding, + titleHeight, + realTrackWidth - 2 * trackPadding, + maxLegendHeight ); + m_trackPlots[tIdx]->setGeometry( trackX + trackPadding, + adjustedVerticalPosition, + realTrackWidth - 2 * trackPadding, + adjustedTrackHeight ); trackX += realTrackWidth; } } } - if (m_scrollBar->isVisible()) + 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(); - 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(); } else @@ -502,25 +511,25 @@ void RiuWellLogPlot::positionTitle(int frameWidth) } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::updateChildrenLayout() -{ - int trackCount = m_trackPlots.size(); +{ + int trackCount = m_trackPlots.size(); 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; - if (m_plotDefinition->areTrackLegendsHorizontal()) + if ( m_plotDefinition->areTrackLegendsHorizontal() ) { legendColumns = 0; // unlimited } - m_legends[tIdx]->setMaxColumns(legendColumns); + m_legends[tIdx]->setMaxColumns( legendColumns ); m_legends[tIdx]->show(); - m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle(numTracksAlreadyShown == 0); + m_trackPlots[tIdx]->enableDepthAxisLabelsAndTitle( numTracksAlreadyShown == 0 ); numTracksAlreadyShown++; } else @@ -529,23 +538,23 @@ void RiuWellLogPlot::updateChildrenLayout() } } - placeChildWidgets(this->height(), this->width()); + placeChildWidgets( this->height(), this->width() ); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::showEvent(QShowEvent *) +void RiuWellLogPlot::showEvent( QShowEvent* ) { updateChildrenLayout(); } //-------------------------------------------------------------------------------------------------- -/// +/// //-------------------------------------------------------------------------------------------------- -void RiuWellLogPlot::changeEvent(QEvent *event) +void RiuWellLogPlot::changeEvent( QEvent* event ) { - if (event->type() == QEvent::WindowStateChange) + if ( event->type() == QEvent::WindowStateChange ) { updateChildrenLayout(); } @@ -558,15 +567,15 @@ void RiuWellLogPlot::changeEvent(QEvent *event) //-------------------------------------------------------------------------------------------------- void RiuWellLogPlot::scheduleUpdateChildrenLayout() { - if (!m_scheduleUpdateChildrenLayoutTimer) + if ( !m_scheduleUpdateChildrenLayoutTimer ) { - m_scheduleUpdateChildrenLayoutTimer = new QTimer(this); - connect(m_scheduleUpdateChildrenLayoutTimer, SIGNAL(timeout()), this, SLOT(updateChildrenLayout())); + m_scheduleUpdateChildrenLayoutTimer = new QTimer( this ); + connect( m_scheduleUpdateChildrenLayoutTimer, SIGNAL( timeout() ), this, SLOT( updateChildrenLayout() ) ); } - if (!m_scheduleUpdateChildrenLayoutTimer->isActive()) + if ( !m_scheduleUpdateChildrenLayoutTimer->isActive() ) { - m_scheduleUpdateChildrenLayoutTimer->setSingleShot(true); - m_scheduleUpdateChildrenLayoutTimer->start(100); + m_scheduleUpdateChildrenLayoutTimer->setSingleShot( true ); + m_scheduleUpdateChildrenLayoutTimer->start( 100 ); } } diff --git a/ApplicationCode/UserInterface/RiuWellLogPlot.h b/ApplicationCode/UserInterface/RiuWellLogPlot.h index 1046a5fb59..f1e7e74845 100644 --- a/ApplicationCode/UserInterface/RiuWellLogPlot.h +++ b/ApplicationCode/UserInterface/RiuWellLogPlot.h @@ -2,17 +2,17 @@ // // Copyright (C) 2015- Statoil ASA // Copyright (C) 2015- Ceetron Solutions AS -// +// // ResInsight is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. -// +// // ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY; without even the implied warranty of MERCHANTABILITY or // FITNESS FOR A PARTICULAR PURPOSE. -// -// See the GNU General Public License at +// +// See the GNU General Public License at // for more details. // ///////////////////////////////////////////////////////////////////////////////// @@ -47,45 +47,44 @@ class RiuWellLogPlot : public QWidget, public RiuInterfaceToViewWindow Q_OBJECT public: - RiuWellLogPlot(RimWellLogPlot* plotDefinition, QWidget* parent = nullptr); + RiuWellLogPlot( RimWellLogPlot* plotDefinition, QWidget* parent = nullptr ); ~RiuWellLogPlot() override; - RimWellLogPlot* ownerPlotDefinition(); - RimViewWindow* ownerViewWindow() const override; + RimWellLogPlot* ownerPlotDefinition(); + RimViewWindow* ownerViewWindow() const override; - void addTrackPlot(RiuWellLogTrack* trackPlot); - void insertTrackPlot(RiuWellLogTrack* trackPlot, size_t index); - void removeTrackPlot(RiuWellLogTrack* trackPlot); + void addTrackPlot( RiuWellLogTrack* trackPlot ); + void insertTrackPlot( RiuWellLogTrack* trackPlot, size_t index ); + void removeTrackPlot( RiuWellLogTrack* trackPlot ); - void setDepthZoomAndReplot(double minDepth, double maxDepth); - void setPlotTitle(const QString& plotTitle); - virtual QSize preferredSize() const; + void setDepthZoomAndReplot( double minDepth, double maxDepth ); + void setPlotTitle( const QString& plotTitle ); + virtual QSize preferredSize() const; - void showTitle(); - void hideTitle(); + void showTitle(); + void hideTitle(); public slots: - void updateChildrenLayout(); + void updateChildrenLayout(); protected: - void resizeEvent(QResizeEvent *event) override; - void showEvent(QShowEvent *) override; - void changeEvent(QEvent *) override; - void contextMenuEvent(QContextMenuEvent *) override; - QSize sizeHint() const override; + void resizeEvent( QResizeEvent* event ) override; + void showEvent( QShowEvent* ) override; + void changeEvent( QEvent* ) override; + void contextMenuEvent( QContextMenuEvent* ) override; + QSize sizeHint() const override; - - void keyPressEvent(QKeyEvent* keyEvent) override; + void keyPressEvent( QKeyEvent* keyEvent ) override; private: - void updateScrollBar(double minDepth, double maxDepth); - std::map calculateTrackWidthsToMatchFrame(int frameWidth) const; - void placeChildWidgets(int frameHeight, int frameWidth); - void positionTitle(int frameWidth); + void updateScrollBar( double minDepth, double maxDepth ); + std::map calculateTrackWidthsToMatchFrame( int frameWidth ) const; + void placeChildWidgets( int frameHeight, int frameWidth ); + void positionTitle( int frameWidth ); private slots: - void slotSetMinDepth(int value); - void scheduleUpdateChildrenLayout(); + void slotSetMinDepth( int value ); + void scheduleUpdateChildrenLayout(); protected: QPointer m_plotTitle; @@ -95,4 +94,3 @@ protected: caf::PdmPointer m_plotDefinition; QTimer* m_scheduleUpdateChildrenLayoutTimer; }; -